diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2021-06-04 14:36:38 -0400 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2021-06-04 14:42:58 -0400 |
commit | a9165ea07ce3a99bbfd294ada9c0fd54db738bb9 (patch) | |
tree | 8241f6063f952db54cb8a24dc8e2e83eac4e9b70 /newlib/libm/math/ef_sqrt.c | |
parent | dfe5988f961ff97d283a9c460e75499db168163a (diff) | |
download | newlib-a9165ea07ce3a99bbfd294ada9c0fd54db738bb9.zip newlib-a9165ea07ce3a99bbfd294ada9c0fd54db738bb9.tar.gz newlib-a9165ea07ce3a99bbfd294ada9c0fd54db738bb9.tar.bz2 |
Fix rounding issues with sqrt/sqrtf
- compiler is sometimes optimizing out the rounding check in
e_sqrt.c and ef_sqrt.c which uses two constants to create
an inexact operation
- there is a similar constant operation in s_tanh.c/sf_tanh.c
- make the one and tiny constants volatile to stop this
Diffstat (limited to 'newlib/libm/math/ef_sqrt.c')
-rw-r--r-- | newlib/libm/math/ef_sqrt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/newlib/libm/math/ef_sqrt.c b/newlib/libm/math/ef_sqrt.c index 80e7f36..448e26e 100644 --- a/newlib/libm/math/ef_sqrt.c +++ b/newlib/libm/math/ef_sqrt.c @@ -16,9 +16,9 @@ #include "fdlibm.h" #ifdef __STDC__ -static const float one = 1.0, tiny=1.0e-30; +static const volatile float one = 1.0, tiny=1.0e-30; #else -static float one = 1.0, tiny=1.0e-30; +static float volatile one = 1.0, tiny=1.0e-30; #endif #ifdef __STDC__ |