libm/copysign: respect signed zero/NaN in copysign

This commit is contained in:
Yingwei Zheng 2024-07-31 20:34:15 +08:00 committed by Xiang Xiao
parent b35f7aed48
commit 871cd306c5
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@
#ifdef CONFIG_HAVE_DOUBLE
double copysign(double x, double y)
{
if (y < 0)
if (signbit(y))
{
return -fabs(x);
}

View File

@ -34,7 +34,7 @@
#ifdef CONFIG_HAVE_LONG_DOUBLE
long double copysignl(long double x, long double y)
{
if (y < 0)
if (signbit(y))
{
return -fabsl(x);
}