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/modf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/math/modf.c') diff --git a/src/math/modf.c b/src/math/modf.c index de45069f..8f337ef0 100644 --- a/src/math/modf.c +++ b/src/math/modf.c @@ -1,5 +1,4 @@ -#include -#include +#include "libm.h" double modf(double x, double *iptr) { @@ -33,5 +32,6 @@ double modf(double x, double *iptr) } u.n &= ~mask; *iptr = u.x; - return x - *iptr; + STRICT_ASSIGN(double, x, x - *iptr); + return x; } -- cgit v1.2.1