Skip to content

Commit 9bc257a

Browse files
committed
special-case more accurate answer for exp(1.0)
1 parent 9b23967 commit 9bc257a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/e_exp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ __ieee754_exp(double x) /* default IEEE double exp */
125125
if(x < u_threshold) return twom1000*twom1000; /* underflow */
126126
}
127127

128+
/* by pure bad luck, this implementation's error for x==1.0 is
129+
unusually large, although still within 1 ulp. */
130+
if (x == 1.0)
131+
return 2.718281828459045235360;
132+
128133
/* argument reduction */
129134
if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
130135
if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */

0 commit comments

Comments
 (0)