diff options
| author | soren <soren@NetBSD.org> | 2000-03-13 22:55:05 +0000 |
|---|---|---|
| committer | soren <soren@NetBSD.org> | 2000-03-13 22:55:05 +0000 |
| commit | 89c5a767f8fc7a4633b2d409966e2becbb98ff92 (patch) | |
| tree | 478a03635e0cf63ab282f636b0793b4dfbfca9bc /lib | |
| parent | 3872dc30f7c2e5e67fa8c65e08ea48171ebaaf1a (diff) | |
Fix doubled 'the's.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/arch/alpha/gen/modf.c | 4 | ||||
| -rw-r--r-- | lib/libc/arch/arm32/gen/modf.c | 4 | ||||
| -rw-r--r-- | lib/libc/arch/mips/gen/sf_modf.c | 104 | ||||
| -rw-r--r-- | lib/libc/arch/powerpc/gen/modf.c | 4 | ||||
| -rw-r--r-- | lib/libc/arch/sh3/gen/modf.c | 4 | ||||
| -rw-r--r-- | lib/libc/sys/fhopen.2 | 4 | ||||
| -rw-r--r-- | lib/libcrypt/crypt.c | 6 | ||||
| -rw-r--r-- | lib/libedit/refresh.c | 6 | ||||
| -rw-r--r-- | lib/libmenu/internals.c | 5 |
9 files changed, 122 insertions, 19 deletions
diff --git a/lib/libc/arch/alpha/gen/modf.c b/lib/libc/arch/alpha/gen/modf.c index 47de384a571..046bba4e428 100644 --- a/lib/libc/arch/alpha/gen/modf.c +++ b/lib/libc/arch/alpha/gen/modf.c @@ -1,4 +1,4 @@ -/* $NetBSD: modf.c,v 1.1 1995/02/10 17:50:25 cgd Exp $ */ +/* $NetBSD: modf.c,v 1.2 2000/03/13 22:59:20 soren Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -83,7 +83,7 @@ modf(val, iptr) * If you look at the math involved for a few seconds, it's * plain to see that the integral part is the input, with the * low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed, - * the the fractional part is the part with the rest of the + * the fractional part is the part with the rest of the * bits zeroed. Just zeroing the high bits to get the * fractional part would yield a fraction in need of * normalization. Therefore, we take the easy way out, and diff --git a/lib/libc/arch/arm32/gen/modf.c b/lib/libc/arch/arm32/gen/modf.c index dbf522a8d55..7f56f5fa1b4 100644 --- a/lib/libc/arch/arm32/gen/modf.c +++ b/lib/libc/arch/arm32/gen/modf.c @@ -1,4 +1,4 @@ -/* $NetBSD: modf.c,v 1.2 1997/10/06 00:18:34 mark Exp $ */ +/* $NetBSD: modf.c,v 1.3 2000/03/13 22:59:21 soren Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -83,7 +83,7 @@ modf(val, iptr) * If you look at the math involved for a few seconds, it's * plain to see that the integral part is the input, with the * low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed, - * the the fractional part is the part with the rest of the + * the fractional part is the part with the rest of the * bits zeroed. Just zeroing the high bits to get the * fractional part would yield a fraction in need of * normalization. Therefore, we take the easy way out, and diff --git a/lib/libc/arch/mips/gen/sf_modf.c b/lib/libc/arch/mips/gen/sf_modf.c new file mode 100644 index 00000000000..1aed913a67c --- /dev/null +++ b/lib/libc/arch/mips/gen/sf_modf.c @@ -0,0 +1,104 @@ +/* $NetBSD: sf_modf.c,v 1.3 2000/03/13 22:59:21 soren Exp $ */ + +/* + * Copyright (c) 1994, 1995 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#include <sys/types.h> +#include "ieee.h" +#include <errno.h> +#include <math.h> + +/* + * double modf(double val, double *iptr) + * returns: f and i such that |f| < 1.0, (f + i) = val, and + * sign(f) == sign(i) == sign(val). + * + * Beware signedness when doing subtraction, and also operand size! + */ +double +modf(val, iptr) + double val, *iptr; +{ + union doub { + double v; + struct ieee_double s; + } u, v; + u_int64_t frac; + + /* + * If input is Inf or NaN, return it and leave i alone. + */ + u.v = val; + if (u.s.dbl_exp == DBL_EXP_INFNAN) + return (u.v); + + /* + * If input can't have a fractional part, return + * (appropriately signed) zero, and make i be the input. + */ + if ((int)u.s.dbl_exp - DBL_EXP_BIAS > DBL_FRACBITS - 1) { + *iptr = u.v; + v.v = 0.0; + v.s.dbl_sign = u.s.dbl_sign; + return (v.v); + } + + /* + * If |input| < 1.0, return it, and set i to the appropriately + * signed zero. + */ + if (u.s.dbl_exp < DBL_EXP_BIAS) { + v.v = 0.0; + v.s.dbl_sign = u.s.dbl_sign; + *iptr = v.v; + return (u.v); + } + + /* + * There can be a fractional part of the input. + * If you look at the math involved for a few seconds, it's + * plain to see that the integral part is the input, with the + * low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed, + * the fractional part is the part with the rest of the + * bits zeroed. Just zeroing the high bits to get the + * fractional part would yield a fraction in need of + * normalization. Therefore, we take the easy way out, and + * just use subtraction to get the fractional part. + */ + v.v = u.v; + /* Zero the low bits of the fraction, the sleazy way. */ + frac = ((u_int64_t)v.s.dbl_frach << 32) + v.s.dbl_fracl; + frac >>= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS); + frac <<= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS); + v.s.dbl_fracl = frac & 0xffffffff; + v.s.dbl_frach = frac >> 32; + *iptr = v.v; + + u.v -= v.v; + u.s.dbl_sign = v.s.dbl_sign; + return (u.v); +} diff --git a/lib/libc/arch/powerpc/gen/modf.c b/lib/libc/arch/powerpc/gen/modf.c index 90c794729f5..87ff866c0ea 100644 --- a/lib/libc/arch/powerpc/gen/modf.c +++ b/lib/libc/arch/powerpc/gen/modf.c @@ -1,4 +1,4 @@ -/* $NetBSD: modf.c,v 1.1 1998/11/26 07:50:56 sakamoto Exp $ */ +/* $NetBSD: modf.c,v 1.2 2000/03/13 22:59:21 soren Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -83,7 +83,7 @@ modf(val, iptr) * If you look at the math involved for a few seconds, it's * plain to see that the integral part is the input, with the * low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed, - * the the fractional part is the part with the rest of the + * the fractional part is the part with the rest of the * bits zeroed. Just zeroing the high bits to get the * fractional part would yield a fraction in need of * normalization. Therefore, we take the easy way out, and diff --git a/lib/libc/arch/sh3/gen/modf.c b/lib/libc/arch/sh3/gen/modf.c index 9bb2cf299aa..87ff866c0ea 100644 --- a/lib/libc/arch/sh3/gen/modf.c +++ b/lib/libc/arch/sh3/gen/modf.c @@ -1,4 +1,4 @@ -/* $NetBSD: modf.c,v 1.1 2000/01/05 14:07:33 msaitoh Exp $ */ +/* $NetBSD: modf.c,v 1.2 2000/03/13 22:59:21 soren Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -83,7 +83,7 @@ modf(val, iptr) * If you look at the math involved for a few seconds, it's * plain to see that the integral part is the input, with the * low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed, - * the the fractional part is the part with the rest of the + * the fractional part is the part with the rest of the * bits zeroed. Just zeroing the high bits to get the * fractional part would yield a fraction in need of * normalization. Therefore, we take the easy way out, and diff --git a/lib/libc/sys/fhopen.2 b/lib/libc/sys/fhopen.2 index 02f0f2abc19..aef5843b503 100644 --- a/lib/libc/sys/fhopen.2 +++ b/lib/libc/sys/fhopen.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: fhopen.2,v 1.2 1999/12/02 21:42:36 kleink Exp $ +.\" $NetBSD: fhopen.2,v 1.3 2000/03/13 22:59:21 soren Exp $ .\" .\" Copyright (c) 1999 National Aeronautics & Space Administration .\" All rights reserved. @@ -14,7 +14,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the the name of the National Aeronautics & Space Administration +.\" 3. Neither the name of the National Aeronautics & Space Administration .\" nor the names of its contributors may be used to endorse or promote .\" products derived from this software without specific prior written .\" permission. diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index 64a0d14b058..0e00967f2e7 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -1,4 +1,4 @@ -/* $NetBSD: crypt.c,v 1.13 1998/10/20 02:02:30 matt Exp $ */ +/* $NetBSD: crypt.c,v 1.14 2000/03/13 22:59:22 soren Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93"; #else -__RCSID("$NetBSD: crypt.c,v 1.13 1998/10/20 02:02:30 matt Exp $"); +__RCSID("$NetBSD: crypt.c,v 1.14 2000/03/13 22:59:22 soren Exp $"); #endif #endif /* not lint */ @@ -609,7 +609,7 @@ des_setkey(key) /* * Encrypt (or decrypt if num_iter < 0) the 8 chars at "in" with abs(num_iter) - * iterations of DES, using the the given 24-bit salt and the pre-computed key + * iterations of DES, using the given 24-bit salt and the pre-computed key * schedule, and store the resulting 8 chars at "out" (in == out is permitted). * * NOTE: the performance of this routine is critically dependent on your diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c index 6253cbf86a0..411e14e08b9 100644 --- a/lib/libedit/refresh.c +++ b/lib/libedit/refresh.c @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.13 2000/02/19 09:08:16 mycroft Exp $ */ +/* $NetBSD: refresh.c,v 1.14 2000/03/13 22:59:22 soren Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: refresh.c,v 1.13 2000/02/19 09:08:16 mycroft Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.14 2000/03/13 22:59:22 soren Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -643,7 +643,7 @@ re_update_line(el, old, new, i) * ^.....................^ ^..................^ ^........^ * \new \nfd \nsb \nse \nls \ne * - * fx is the difference in length between the the chars between nfd and + * fx is the difference in length between the chars between nfd and * nsb, and the chars between ofd and osb, and is thus the number of * characters to delete if < 0 (new is shorter than old, as above), * or insert (new is longer than short). diff --git a/lib/libmenu/internals.c b/lib/libmenu/internals.c index 6a220667ffc..da7062d19c6 100644 --- a/lib/libmenu/internals.c +++ b/lib/libmenu/internals.c @@ -1,4 +1,4 @@ -/* $NetBSD: internals.c,v 1.4 1999/12/22 14:38:12 kleink Exp $ */ +/* $NetBSD: internals.c,v 1.5 2000/03/13 22:59:22 soren Exp $ */ /*- * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) @@ -111,8 +111,7 @@ _menui_stitch_items(menu) * Calculate the neighbours for an item in menu. This routine deliberately * does not refer to up/down/left/right as these concepts depend on the menu * layout style (row major or not). By arranging the arguments in the right - * order the caller can generate the the neighbours for either menu layout - * style. + * order the caller can generate the neighbours for either menu layout style. */ static void _menui_calc_neighbours(menu, item_no, cycle, item_rows, item_cols, next, prev, |
