From 89d232d114ae1865c7e7b06cb7a62e4cefaaa1ce Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sat, 14 Dec 2013 15:49:02 -0500 Subject: [PATCH] more accurate comment for the x==1.0 hack --- src/e_exp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/e_exp.c b/src/e_exp.c index ade6015..88a90f7 100644 --- a/src/e_exp.c +++ b/src/e_exp.c @@ -125,8 +125,10 @@ __ieee754_exp(double x) /* default IEEE double exp */ if(x < u_threshold) return twom1000*twom1000; /* underflow */ } - /* by pure bad luck, this implementation's error for x==1.0 is - unusually large, although still within 1 ulp. */ + /* this implementation gives 2.7182818284590455 for exp(1.0), + which is well within the allowable error. however, + 2.718281828459045 is closer to the true value so we prefer that + answer, given that 1.0 is such an important argument value. */ if (x == 1.0) return 2.718281828459045235360;