mirror of
https://github.com/fluencelabs/musl
synced 2025-06-30 07:02:41 +00:00
math: excess precision fix modf, modff, scalbn, scalbnf
old code was correct only if the result was stored (without the excess precision) or musl was compiled with -ffloat-store. now we use STRICT_ASSIGN to work around the issue. (see note 160 in c11 section 6.8.6.4)
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include "libm.h"
|
||||
|
||||
float modff(float x, float *iptr)
|
||||
{
|
||||
@ -33,5 +32,6 @@ float modff(float x, float *iptr)
|
||||
}
|
||||
u.n &= ~mask;
|
||||
*iptr = u.x;
|
||||
return x - *iptr;
|
||||
STRICT_ASSIGN(float, x, x - *iptr);
|
||||
return x;
|
||||
}
|
||||
|
Reference in New Issue
Block a user