public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a41c517
)
changed pow() a little
author
eck
<none@none>
Tue, 28 Aug 1990 13:59:36 +0000
(13:59 +0000)
committer
eck
<none@none>
Tue, 28 Aug 1990 13:59:36 +0000
(13:59 +0000)
lang/cem/libcc.ansi/math/pow.c
patch
|
blob
|
history
diff --git
a/lang/cem/libcc.ansi/math/pow.c
b/lang/cem/libcc.ansi/math/pow.c
index
b9b7106
..
b4a9006
100644
(file)
--- a/
lang/cem/libcc.ansi/math/pow.c
+++ b/
lang/cem/libcc.ansi/math/pow.c
@@
-38,17
+38,15
@@
pow(double x, double y)
x = -x;
}
x = log(x);
+
if (x < 0) {
x = -x;
y = -y;
}
- if (y > M_LN_MAX_D/x) {
+ /* Beware of overflow in the multiplication */
+ if (x > 1.0 && y > DBL_MAX/x) {
errno = ERANGE;
- return 0;
- }
- if (y < M_LN_MIN_D/x) {
- errno = ERANGE;
- return 0;
+ return result_neg ? -HUGE_VAL : HUGE_VAL;
}
x = exp(x * y);