Deleted Added
full compact
s_log1p.c (177711) s_log1p.c (251024)
1/* @(#)s_log1p.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
11 */
12
13#include <sys/cdefs.h>
1/* @(#)s_log1p.c 5.1 93/09/24 */
2/*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 *
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
11 */
12
13#include <sys/cdefs.h>
14__FBSDID("$FreeBSD: head/lib/msun/src/s_log1p.c 177711 2008-03-29 16:37:59Z das $");
14__FBSDID("$FreeBSD: head/lib/msun/src/s_log1p.c 251024 2013-05-27 08:50:10Z das $");
15
16/* double log1p(double x)
17 *
18 * Method :
19 * 1. Argument Reduction: find k and f such that
20 * 1+x = 2^k * (1+f),
21 * where sqrt(2)/2 < 1+f < sqrt(2) .
22 *

--- 68 unchanged lines hidden (view full) ---

91Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
92Lp3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */
93Lp4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
94Lp5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
95Lp6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
96Lp7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
97
98static const double zero = 0.0;
15
16/* double log1p(double x)
17 *
18 * Method :
19 * 1. Argument Reduction: find k and f such that
20 * 1+x = 2^k * (1+f),
21 * where sqrt(2)/2 < 1+f < sqrt(2) .
22 *

--- 68 unchanged lines hidden (view full) ---

91Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
92Lp3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */
93Lp4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
94Lp5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
95Lp6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
96Lp7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
97
98static const double zero = 0.0;
99static volatile double vzero = 0.0;
99
100double
101log1p(double x)
102{
103 double hfsq,f,c,s,z,R,u;
104 int32_t k,hx,hu,ax;
105
106 GET_HIGH_WORD(hx,x);
107 ax = hx&0x7fffffff;
108
109 k = 1;
110 if (hx < 0x3FDA827A) { /* 1+x < sqrt(2)+ */
111 if(ax>=0x3ff00000) { /* x <= -1.0 */
100
101double
102log1p(double x)
103{
104 double hfsq,f,c,s,z,R,u;
105 int32_t k,hx,hu,ax;
106
107 GET_HIGH_WORD(hx,x);
108 ax = hx&0x7fffffff;
109
110 k = 1;
111 if (hx < 0x3FDA827A) { /* 1+x < sqrt(2)+ */
112 if(ax>=0x3ff00000) { /* x <= -1.0 */
112 if(x==-1.0) return -two54/zero; /* log1p(-1)=+inf */
113 if(x==-1.0) return -two54/vzero; /* log1p(-1)=+inf */
113 else return (x-x)/(x-x); /* log1p(x<-1)=NaN */
114 }
115 if(ax<0x3e200000) { /* |x| < 2**-29 */
116 if(two54+x>zero /* raise inexact */
117 &&ax<0x3c900000) /* |x| < 2**-54 */
118 return x;
119 else
120 return x - x*x*0.5;

--- 55 unchanged lines hidden ---
114 else return (x-x)/(x-x); /* log1p(x<-1)=NaN */
115 }
116 if(ax<0x3e200000) { /* |x| < 2**-29 */
117 if(two54+x>zero /* raise inexact */
118 &&ax<0x3c900000) /* |x| < 2**-54 */
119 return x;
120 else
121 return x - x*x*0.5;

--- 55 unchanged lines hidden ---