Skip to content

Commit 89d232d

Browse files
committed
more accurate comment for the x==1.0 hack
1 parent 9bc257a commit 89d232d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/e_exp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ __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. */
128+
/* this implementation gives 2.7182818284590455 for exp(1.0),
129+
which is well within the allowable error. however,
130+
2.718281828459045 is closer to the true value so we prefer that
131+
answer, given that 1.0 is such an important argument value. */
130132
if (x == 1.0)
131133
return 2.718281828459045235360;
132134

0 commit comments

Comments
 (0)