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:
parent
af8b254754
commit
6062af0a94
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user