public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] libm/math: Set errno to ERANGE for pow(0, -y)
Date: Wed,  5 Aug 2020 20:43:16 +0000 (GMT)	[thread overview]
Message-ID: <20200805204316.85BFE385701E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=98a4f8de47602e3aaff50715d53fc49fb43d0d9e

commit 98a4f8de47602e3aaff50715d53fc49fb43d0d9e
Author: Keith Packard via Newlib <newlib@sourceware.org>
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 <keithp@keithp.com>

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;
 	}


                 reply	other threads:[~2020-08-05 20:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200805204316.85BFE385701E@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).