Index: head/lib/msun/src/s_fabs.c =================================================================== --- head/lib/msun/src/s_fabs.c (revision 306408) +++ head/lib/msun/src/s_fabs.c (revision 306409) @@ -1,31 +1,30 @@ /* @(#)s_fabs.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include +__FBSDID("$FreeBSD$"); /* * fabs(x) returns the absolute value of x. */ #include "math.h" #include "math_private.h" double fabs(double x) { u_int32_t high; GET_HIGH_WORD(high,x); SET_HIGH_WORD(x,high&0x7fffffff); return x; } Index: head/lib/msun/src/s_logbl.c =================================================================== --- head/lib/msun/src/s_logbl.c (revision 306408) +++ head/lib/msun/src/s_logbl.c (revision 306409) @@ -1,55 +1,54 @@ /* * From: @(#)s_ilogb.c 5.1 93/09/24 * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include +__FBSDID("$FreeBSD$"); #include #include #include #include "fpmath.h" long double logbl(long double x) { union IEEEl2bits u; unsigned long m; int b; u.e = x; if (u.bits.exp == 0) { if ((u.bits.manl | u.bits.manh) == 0) { /* x == 0 */ u.bits.sign = 1; return (1.0L / u.e); } /* denormalized */ if (u.bits.manh == 0) { m = 1lu << (LDBL_MANL_SIZE - 1); for (b = LDBL_MANH_SIZE; !(u.bits.manl & m); m >>= 1) b++; } else { m = 1lu << (LDBL_MANH_SIZE - 1); for (b = 0; !(u.bits.manh & m); m >>= 1) b++; } #ifdef LDBL_IMPLICIT_NBIT b++; #endif return ((long double)(LDBL_MIN_EXP - b - 1)); } if (u.bits.exp < (LDBL_MAX_EXP << 1) - 1) /* normal */ return ((long double)(u.bits.exp - LDBL_MAX_EXP + 1)); else /* +/- inf or nan */ return (x * x); } Index: head/lib/msun/src/s_scalbn.c =================================================================== --- head/lib/msun/src/s_scalbn.c (revision 306408) +++ head/lib/msun/src/s_scalbn.c (revision 306409) @@ -1,66 +1,66 @@ /* @(#)s_scalbn.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include +__FBSDID("$FreeBSD$"); /* * scalbn (double x, int n) * scalbn(x,n) returns x* 2**n computed by exponent * manipulation rather than by actually performing an * exponentiation or a multiplication. */ -#include #include #include "math.h" #include "math_private.h" static const double two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ huge = 1.0e+300, tiny = 1.0e-300; double scalbn (double x, int n) { int32_t k,hx,lx; EXTRACT_WORDS(hx,lx,x); k = (hx&0x7ff00000)>>20; /* extract exponent */ if (k==0) { /* 0 or subnormal x */ if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ x *= two54; GET_HIGH_WORD(hx,x); k = ((hx&0x7ff00000)>>20) - 54; if (n< -50000) return tiny*x; /*underflow*/ } if (k==0x7ff) return x+x; /* NaN or Inf */ k = k+n; if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */ if (k > 0) /* normal result */ {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} - if (k <= -54) + if (k <= -54) { if (n > 50000) /* in case integer overflow in n+k */ return huge*copysign(huge,x); /*overflow*/ - else return tiny*copysign(tiny,x); /*underflow*/ + else + return tiny*copysign(tiny,x); /*underflow*/ + } k += 54; /* subnormal result */ SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x*twom54; } #if (LDBL_MANT_DIG == 53) __weak_reference(scalbn, ldexpl); __weak_reference(scalbn, scalbnl); #endif Index: head/lib/msun/src/s_scalbnf.c =================================================================== --- head/lib/msun/src/s_scalbnf.c (revision 306408) +++ head/lib/msun/src/s_scalbnf.c (revision 306409) @@ -1,58 +1,57 @@ /* s_scalbnf.c -- float version of s_scalbn.c. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif - #include +__FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" static const float two25 = 3.355443200e+07, /* 0x4c000000 */ twom25 = 2.9802322388e-08, /* 0x33000000 */ huge = 1.0e+30, tiny = 1.0e-30; float scalbnf (float x, int n) { int32_t k,ix; GET_FLOAT_WORD(ix,x); k = (ix&0x7f800000)>>23; /* extract exponent */ if (k==0) { /* 0 or subnormal x */ if ((ix&0x7fffffff)==0) return x; /* +-0 */ x *= two25; GET_FLOAT_WORD(ix,x); k = ((ix&0x7f800000)>>23) - 25; if (n< -50000) return tiny*x; /*underflow*/ } if (k==0xff) return x+x; /* NaN or Inf */ k = k+n; if (k > 0xfe) return huge*copysignf(huge,x); /* overflow */ if (k > 0) /* normal result */ {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} - if (k <= -25) + if (k <= -25) { if (n > 50000) /* in case integer overflow in n+k */ return huge*copysignf(huge,x); /*overflow*/ - else return tiny*copysignf(tiny,x); /*underflow*/ + else + return tiny*copysignf(tiny,x); /*underflow*/ + } k += 25; /* subnormal result */ SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x*twom25; } __strong_reference(scalbnf, ldexpf); Index: head/lib/msun/src/s_scalbnl.c =================================================================== --- head/lib/msun/src/s_scalbnl.c (revision 306408) +++ head/lib/msun/src/s_scalbnl.c (revision 306409) @@ -1,71 +1,71 @@ /* @(#)s_scalbn.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include +__FBSDID("$FreeBSD$"); /* * scalbnl (long double x, int n) * scalbnl(x,n) returns x* 2**n computed by exponent * manipulation rather than by actually performing an * exponentiation or a multiplication. */ /* * We assume that a long double has a 15-bit exponent. On systems * where long double is the same as double, scalbnl() is an alias * for scalbn(), so we don't use this routine. */ -#include #include #include #include "fpmath.h" #if LDBL_MAX_EXP != 0x4000 #error "Unsupported long double format" #endif static const long double huge = 0x1p16000L, tiny = 0x1p-16000L; long double scalbnl (long double x, int n) { union IEEEl2bits u; int k; u.e = x; k = u.bits.exp; /* extract exponent */ if (k==0) { /* 0 or subnormal x */ if ((u.bits.manh|u.bits.manl)==0) return x; /* +-0 */ u.e *= 0x1p+128; k = u.bits.exp - 128; if (n< -50000) return tiny*x; /*underflow*/ } if (k==0x7fff) return x+x; /* NaN or Inf */ k = k+n; if (k >= 0x7fff) return huge*copysignl(huge,x); /* overflow */ if (k > 0) /* normal result */ {u.bits.exp = k; return u.e;} - if (k <= -128) + if (k <= -128) { if (n > 50000) /* in case integer overflow in n+k */ return huge*copysign(huge,x); /*overflow*/ - else return tiny*copysign(tiny,x); /*underflow*/ + else + return tiny*copysign(tiny,x); /*underflow*/ + } k += 128; /* subnormal result */ u.bits.exp = k; return u.e*0x1p-128; } __strong_reference(scalbnl, ldexpl);