Cygwin: math: Properly propagate input NANs in a few functions

While the C99 standard doesn't explicitly require this, the standard
says it is recommended (F.9.13).

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö
2019-07-25 00:13:13 +03:00
committed by Corinna Vinschen
parent 8dee6fe6a5
commit f7f296b46f
6 changed files with 20 additions and 8 deletions

View File

@@ -50,7 +50,12 @@ __FLT_TYPE
__FLT_ABI(acosh) (__FLT_TYPE x)
{
int x_class = fpclassify (x);
if (x_class == FP_NAN || x < __FLT_CST(1.0))
if (x_class == FP_NAN)
{
errno = EDOM;
return x;
}
else if (x < __FLT_CST(1.0))
{
errno = EDOM;
return __FLT_NAN;