From b2711b749f59c632287dc892fd5c9c04abd179cf Mon Sep 17 00:00:00 2001 From: kargl Date: Sat, 30 Aug 2014 17:14:47 +0000 Subject: Make tiny volatile to prevent the compiler(s) from constant folding expressions of the form "1 - tiny", which are used to raise FE_INEXACT. --- lib/msun/src/s_tanh.c | 3 ++- lib/msun/src/s_tanhf.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/msun/src') diff --git a/lib/msun/src/s_tanh.c b/lib/msun/src/s_tanh.c index f7b71c5..27197b0 100644 --- a/lib/msun/src/s_tanh.c +++ b/lib/msun/src/s_tanh.c @@ -42,7 +42,8 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" -static const double one = 1.0, two = 2.0, tiny = 1.0e-300, huge = 1.0e300; +static volatile const double tiny = 1.0e-300; +static const double one = 1.0, two = 2.0, huge = 1.0e300; double tanh(double x) diff --git a/lib/msun/src/s_tanhf.c b/lib/msun/src/s_tanhf.c index 04f09c6..d6a3634 100644 --- a/lib/msun/src/s_tanhf.c +++ b/lib/msun/src/s_tanhf.c @@ -19,7 +19,9 @@ __FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" -static const float one=1.0, two=2.0, tiny = 1.0e-30, huge = 1.0e30; +static volatile const float tiny = 1.0e-30; +static const float one=1.0, two=2.0, huge = 1.0e30; + float tanhf(float x) { -- cgit v1.1