public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: math: Fix the return value for tgammal for zero and negative integers
@ 2019-08-20 16:16 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-08-20 16:16 UTC (permalink / raw)
To: cygwin-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1213 bytes --]
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f4e7849fa9fcd5ff0d7318f9d3d13fada6e4b317
commit f4e7849fa9fcd5ff0d7318f9d3d13fada6e4b317
Author: Martin Storsjö <martin@martin.st>
Date: Mon Jul 29 23:48:01 2019 +0300
Cygwin: math: Fix the return value for tgammal for zero and negative integers
For zero, it should return HUGE_VAL (INFINITY), for negative integers,
it should return NAN.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diff:
---
winsup/cygwin/math/tgammal.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/math/tgammal.c b/winsup/cygwin/math/tgammal.c
index 99408ee..25a37ea 100644
--- a/winsup/cygwin/math/tgammal.c
+++ b/winsup/cygwin/math/tgammal.c
@@ -285,6 +285,9 @@ long double __tgammal_r(long double x, int* sgngaml)
return (x);
#endif
#endif
+ if (x == 0.0L)
+ return copysignl(HUGE_VALL, x);
+
q = fabsl(x);
if (q > 13.0L)
@@ -299,8 +302,8 @@ long double __tgammal_r(long double x, int* sgngaml)
gsing:
_SET_ERRNO(EDOM);
mtherr("tgammal", SING);
-#ifdef INFINITIES
- return (INFINITYL);
+#ifdef NANS
+ return (NAN);
#else
return (*sgngaml * MAXNUML);
#endif
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-20 16:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 16:16 [newlib-cygwin] Cygwin: math: Fix the return value for tgammal for zero and negative integers Corinna Vinschen
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).