From c4359e01303da2755fe7e8033826b132eb3659b1 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 13 Nov 2012 10:55:35 +0100 Subject: 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) --- src/math/modff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/math/modff.c') diff --git a/src/math/modff.c b/src/math/modff.c index 84d0b82a..90caf316 100644 --- a/src/math/modff.c +++ b/src/math/modff.c @@ -1,5 +1,4 @@ -#include -#include +#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; } -- cgit 1.4.1