libc/math: Fix wrong ouput in modf() API

The sign of integral part given by the modf() should be same as sign of input.
But for inputs between 0 and 1, the sign of integral part was not same as sign of input.

Signed-off-by: Lokesh B V <lokeshbv333@gmail.com>
This commit is contained in:
Lokesh B V 2017-07-20 17:59:39 +05:30
parent af8b254754
commit 6062af0a94
3 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ double modf(double x, double *iptr)
}
else if (fabs(x) < 1.0)
{
*iptr = 0.0;
*iptr = (x * 0.0);
return x;
}
else

View File

@ -44,7 +44,7 @@ float modff(float x, float *iptr)
}
else if (fabsf(x) < 1.0F)
{
*iptr = 0.0F;
*iptr = (x * 0.0F);
return x;
}
else

View File

@ -49,7 +49,7 @@ long double modfl(long double x, long double *iptr)
}
else if (fabs(x) < 1.0)
{
*iptr = 0.0;
*iptr = (x * 0.0);
return x;
}
else