public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: fix return value of sqrtl on negative infinity
Date: Tue, 27 Oct 2020 14:24:21 +0000 (GMT)	[thread overview]
Message-ID: <20201027142421.51B96386EC29@sourceware.org> (raw)

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

commit 262de3ecf08e8981a2b2d5949a3d31c613a36b2b
Author: Ken Brown <kbrown@cornell.edu>
Date:   Tue Oct 27 09:52:48 2020 -0400

    Cygwin: fix return value of sqrtl on negative infinity
    
    The return value is now -NaN.
    
    This fixes a bug in the mingw-w64 code that was imported into Cygwin.
    The fix is consistent with Posix and Linux.  It is also consistent
    with the current mingw-w64 code, with one exception: The mingw-w64
    code sets errno to EDOM if the input is -NaN, but this appears to
    differ from Posix and Linux.
    
    Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html

Diff:
---
 winsup/cygwin/math/sqrt.def.h | 5 ++++-
 winsup/cygwin/release/3.2.0   | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/math/sqrt.def.h b/winsup/cygwin/math/sqrt.def.h
index cf8b5cbe6..3d1a00908 100644
--- a/winsup/cygwin/math/sqrt.def.h
+++ b/winsup/cygwin/math/sqrt.def.h
@@ -73,8 +73,11 @@ __FLT_ABI (sqrt) (__FLT_TYPE x)
       if (x_class == FP_ZERO)
 	return __FLT_CST (-0.0);
 
+      if (x_class == FP_NAN)
+	return x;
+
       errno = EDOM;
-      return x;
+      return -__FLT_NAN;
     }
   else if (x_class == FP_ZERO)
     return __FLT_CST (0.0);
diff --git a/winsup/cygwin/release/3.2.0 b/winsup/cygwin/release/3.2.0
index 11de87dbc..22f78e7a7 100644
--- a/winsup/cygwin/release/3.2.0
+++ b/winsup/cygwin/release/3.2.0
@@ -37,5 +37,8 @@ Bug Fixes
 - Fix assertion failure on an invalid path under /proc/<pid>/fd/.
   Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246160.html
 
-- Fix crash on stat(2)'ing /dev/ptmx on 32 bit
+- Fix crash on stat(2)'ing /dev/ptmx on 32 bit.
   Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246218.html
+
+- Fix return value of sqrtl on negative infinity.
+  Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html


                 reply	other threads:[~2020-10-27 14:24 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=20201027142421.51B96386EC29@sourceware.org \
    --to=kbrown@sourceware.org \
    --cc=cygwin-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).