summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-07-29 23:48:01 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-08-20 18:15:16 +0200
commitf4e7849fa9fcd5ff0d7318f9d3d13fada6e4b317 (patch)
tree9de256cdcaf7f83278449c0528780b893708231f
parentb99887c4283f7b21428d21f98ae9f6fcf573c756 (diff)
downloadcygnal-f4e7849fa9fcd5ff0d7318f9d3d13fada6e4b317.tar.gz
cygnal-f4e7849fa9fcd5ff0d7318f9d3d13fada6e4b317.tar.bz2
cygnal-f4e7849fa9fcd5ff0d7318f9d3d13fada6e4b317.zip
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>
-rw-r--r--winsup/cygwin/math/tgammal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/winsup/cygwin/math/tgammal.c b/winsup/cygwin/math/tgammal.c
index 99408eed7..25a37eaeb 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