diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2019-07-09 20:06:59 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2019-07-09 20:06:59 +0300 |
commit | 0d24a86822a5ee73d6a6aa69e2a0118aa1e35204 (patch) | |
tree | 97a2dba4a232bfe8924f730d1fbd4156356198a9 /newlib/libm/common/s_log1p.c | |
parent | fff17ad73f6ae6b75ef293e17a837f23f6134753 (diff) |
Set errno in expm1{,f} / log1p{,f}
2019-07-09 Joern Rennecke <joern.rennecke@riscy-ip.com>
* libm/common/s_expm1.c ("math_config.h"): Include.
(expm1): Use __math_oflow to set errno.
* libm/common/s_log1p.c ("math_config.h"): Include.
(log1p): Use __math_divzero and __math_invalid to set errno.
* libm/common/sf_expm1.c ("math_config.h"): Include.
(expm1f): Use __math_oflow to set errno.
* libm/common/sf_log1p.c ("math_config.h"): Include.
(log1pf): Use __math_divzero and __math_invalid to set errno.
Diffstat (limited to 'newlib/libm/common/s_log1p.c')
-rw-r--r-- | newlib/libm/common/s_log1p.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/newlib/libm/common/s_log1p.c b/newlib/libm/common/s_log1p.c index 359c257d8..c44461e8d 100644 --- a/newlib/libm/common/s_log1p.c +++ b/newlib/libm/common/s_log1p.c @@ -113,6 +113,7 @@ Interface Definition (Issue 2). */ #include "fdlibm.h" +#include "math_config.h" #ifndef _DOUBLE_IS_32BITS @@ -154,8 +155,10 @@ static double zero = 0.0; k = 1; if (hx < 0x3FDA827A) { /* x < 0.41422 */ if(ax>=0x3ff00000) { /* x <= -1.0 */ - if(x==-1.0) return -two54/zero; /* log1p(-1)=+inf */ - else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ + if(x==-1.0) + return __math_divzero (1); /* log1p(-1)=-inf */ + else + return __math_invalid (x); /* log1p(x<-1)=NaN */ } if(ax<0x3e200000) { /* |x| < 2**-29 */ if(two54+x>zero /* raise inexact */ |