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:
parent
666271c105
commit
c4359e0130
4 changed files with 18 additions and 22 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue