summaryrefslogtreecommitdiffstats
path: root/newlib/libm/math/ef_pow.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2007-05-01 18:42:15 +0000
committerJeff Johnston <jjohnstn@redhat.com>2007-05-01 18:42:15 +0000
commit2babeb3d94cb8a507ca12b46252995b453600290 (patch)
tree3e16553171a63e889183bdc36ac4588bd1b3e2e5 /newlib/libm/math/ef_pow.c
parentbb57ddfeb7e766fafb510bce9d1deaa062bb6fd0 (diff)
downloadcygnal-2babeb3d94cb8a507ca12b46252995b453600290.tar.gz
cygnal-2babeb3d94cb8a507ca12b46252995b453600290.tar.bz2
cygnal-2babeb3d94cb8a507ca12b46252995b453600290.zip
2007-05-01 Cary R. <cygcary <at> yahoo.com>
* libm/math/e_pow.c: Fix to be consistent with glibc with regards to treatment of NaN and +-inf arguments. * libm/math/ef_pow.c: Ditto. * libm/math/w_pow.c: Ditto. * libm/math/wf_pow.c: Ditto. * libm/math/w_acos.c: Fix domain errors to return NaN. * libm/math/w_asin.c: Ditto. * libm/math/wf_acos.c: Ditto. * libm/math/wf_asin.c: Ditto. * libm/math/w_log.c: Fix to return NaN for negative number inputs. * libm/math/wf_log.c: Ditto. * libm/math/wf_log10.c: Ditto. * libm/math/w_log10.c: Ditto.
Diffstat (limited to 'newlib/libm/math/ef_pow.c')
-rw-r--r--newlib/libm/math/ef_pow.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/newlib/libm/math/ef_pow.c b/newlib/libm/math/ef_pow.c
index 8b1fc18b7..6804ce45a 100644
--- a/newlib/libm/math/ef_pow.c
+++ b/newlib/libm/math/ef_pow.c
@@ -75,10 +75,11 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
/* y==zero: x**0 = 1 */
if(FLT_UWORD_IS_ZERO(iy)) return one;
- /* +-NaN return x+y */
+ /* x|y==NaN return NaN unless x==1 then return 1 */
if(FLT_UWORD_IS_NAN(ix) ||
FLT_UWORD_IS_NAN(iy))
- return x+y;
+ if(ix==0x3f800000) return one;
+ else return nanf("");
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer
@@ -98,7 +99,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
/* special value of y */
if (FLT_UWORD_IS_INFINITE(iy)) { /* y is +-inf */
if (ix==0x3f800000)
- return y - y; /* inf**+-1 is NaN */
+ return one; /* +-1**+-inf = 1 */
else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */
return (hy>=0)? y: zero;
else /* (|x|<1)**-,+inf = inf,0 */