summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Packard via Newlib <newlib@sourceware.org>2020-08-04 15:22:22 -0700
committerCorinna Vinschen <corinna@vinschen.de>2020-08-05 22:16:31 +0200
commit98a4f8de47602e3aaff50715d53fc49fb43d0d9e (patch)
tree10d97cec9b6767ead52b2bbf5742d0abf98325db
parent2eafcc78dfe6d356a8d6debe439c8aa9839b1dbe (diff)
downloadcygnal-98a4f8de47602e3aaff50715d53fc49fb43d0d9e.tar.gz
cygnal-98a4f8de47602e3aaff50715d53fc49fb43d0d9e.tar.bz2
cygnal-98a4f8de47602e3aaff50715d53fc49fb43d0d9e.zip
libm/math: Set errno to ERANGE for pow(0, -y)
POSIX says that the errno for pow(0, -y) should be ERANGE instead of EDOM. https://pubs.opengroup.org/onlinepubs/9699919799/functions/pow.html Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--newlib/libm/math/w_pow.c3
-rw-r--r--newlib/libm/math/wf_pow.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/newlib/libm/math/w_pow.c b/newlib/libm/math/w_pow.c
index 6e953360a..d8556a170 100644
--- a/newlib/libm/math/w_pow.c
+++ b/newlib/libm/math/w_pow.c
@@ -84,8 +84,7 @@ PORTABILITY
}
if(finite(y)&&y<0.0) {
/* 0**neg */
- errno = EDOM;
- return -HUGE_VAL;
+ errno = ERANGE;
}
return z;
}
diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c
index 73648b83f..e551e6b48 100644
--- a/newlib/libm/math/wf_pow.c
+++ b/newlib/libm/math/wf_pow.c
@@ -50,8 +50,7 @@
}
if(finitef(y)&&y<0.0f) {
/* 0**neg */
- errno = EDOM;
- return -HUGE_VALF;
+ errno = ERANGE;
}
return z;
}