From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 85BFE385701E; Wed, 5 Aug 2020 20:43:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85BFE385701E Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] libm/math: Set errno to ERANGE for pow(0, -y) X-Act-Checkin: newlib-cygwin X-Git-Author: Keith Packard via Newlib X-Git-Refname: refs/heads/master X-Git-Oldrev: 2eafcc78dfe6d356a8d6debe439c8aa9839b1dbe X-Git-Newrev: 98a4f8de47602e3aaff50715d53fc49fb43d0d9e Message-Id: <20200805204316.85BFE385701E@sourceware.org> Date: Wed, 5 Aug 2020 20:43:16 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 20:43:16 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=98a4f8de47602e3aaff50715d53fc49fb43d0d9e commit 98a4f8de47602e3aaff50715d53fc49fb43d0d9e Author: Keith Packard via Newlib Date: Tue Aug 4 15:22:22 2020 -0700 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 Diff: --- newlib/libm/math/w_pow.c | 3 +-- newlib/libm/math/wf_pow.c | 3 +-- 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; }