From 4641693796509d595f8c0521f914faccff77b3ba Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 15 Sep 2020 10:10:07 -0700 Subject: [PATCH] libm: Make tgamma(-small) = -INFINITY Need to copy the argument sign to the output for tgamma(finite) overflow case. Signed-off-by: Keith Packard --- newlib/libm/math/k_standard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libm/math/k_standard.c b/newlib/libm/math/k_standard.c index 906412ba7..beab51e16 100644 --- a/newlib/libm/math/k_standard.c +++ b/newlib/libm/math/k_standard.c @@ -331,7 +331,7 @@ static double zero = 0.0; /* used as const */ case 40: case 140: /* gamma(finite) overflow */ - retval = HUGE_VAL; + retval = copysign(HUGE_VAL, x); errno = ERANGE; break; case 41: