]> sourceware.org Git - newlib-cygwin.git/commitdiff
libm/math: Set errno to ERANGE for pow(0, -y)
authorKeith Packard via Newlib <newlib@sourceware.org>
Tue, 4 Aug 2020 22:22:22 +0000 (15:22 -0700)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 5 Aug 2020 20:16:31 +0000 (22:16 +0200)
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>
newlib/libm/math/w_pow.c
newlib/libm/math/wf_pow.c

index 6e953360a0857e98b1917fa3800e709c32584c8e..d8556a170ae67849eab9550b35a281c08dcb395b 100644 (file)
@@ -84,8 +84,7 @@ PORTABILITY
            }
            if(finite(y)&&y<0.0) {
                /* 0**neg */
-               errno = EDOM;
-               return -HUGE_VAL;
+               errno = ERANGE;
            }
            return z;
        }
index 73648b83f8399b6b56366985c7c9f0213d6489fc..e551e6b487faf906478e3b1d9fb5a50a6dce1e12 100644 (file)
@@ -50,8 +50,7 @@
            }
            if(finitef(y)&&y<0.0f) {
                /* 0**neg */
-               errno = EDOM;
-               return -HUGE_VALF;
+               errno = ERANGE;
            }
            return z;
        }
This page took 0.031743 seconds and 5 git commands to generate.