diff options
author | Szabolcs Nagy <nsz@port70.net> | 2013-08-15 10:08:45 +0000 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2013-08-15 10:08:45 +0000 |
commit | f29fea00b5bc72d4b8abccba2bb1e312684d1fce (patch) | |
tree | e61c9ae30c9d5eedf60522e34de13ddb69788d75 /src | |
parent | 1b77b9072f374bd26eb0574b83a0d5f18d75ec60 (diff) | |
download | musl-f29fea00b5bc72d4b8abccba2bb1e312684d1fce.zip musl-f29fea00b5bc72d4b8abccba2bb1e312684d1fce.tar.gz musl-f29fea00b5bc72d4b8abccba2bb1e312684d1fce.tar.bz2 |
math: fix pow(0,-inf) to raise divbyzero flag
Diffstat (limited to 'src')
-rw-r--r-- | src/math/pow.c | 2 | ||||
-rw-r--r-- | src/math/powf.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/math/pow.c b/src/math/pow.c index f257814..ac3abc0 100644 --- a/src/math/pow.c +++ b/src/math/pow.c @@ -143,7 +143,7 @@ double pow(double x, double y) return 1.0; else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ return hy >= 0 ? y : 0.0; - else /* (|x|<1)**+-inf = 0,inf */ + else if ((ix|lx) != 0) /* (|x|<1)**+-inf = 0,inf if x!=0 */ return hy >= 0 ? 0.0 : -y; } if (iy == 0x3ff00000) /* y is +-1 */ diff --git a/src/math/powf.c b/src/math/powf.c index 427c896..59baf6f 100644 --- a/src/math/powf.c +++ b/src/math/powf.c @@ -90,7 +90,7 @@ float powf(float x, float y) return 1.0f; else if (ix > 0x3f800000) /* (|x|>1)**+-inf = inf,0 */ return hy >= 0 ? y : 0.0f; - else /* (|x|<1)**+-inf = 0,inf */ + else if (ix != 0) /* (|x|<1)**+-inf = 0,inf if x!=0 */ return hy >= 0 ? 0.0f: -y; } if (iy == 0x3f800000) /* y is +-1 */ |