aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/flt-32/e_j0f.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2021-12-31 09:50:50 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-01-10 14:27:17 +0000
commit347a5b592c91f0230d52a5117fd83e1f75028207 (patch)
treecef1eb7585b59b17118ad72f82856b39f94cfd14 /sysdeps/ieee754/flt-32/e_j0f.c
parente72ef23ee88187284b4b1ca9b2e314e618429d35 (diff)
downloadglibc-347a5b592c91f0230d52a5117fd83e1f75028207.tar
glibc-347a5b592c91f0230d52a5117fd83e1f75028207.tar.gz
glibc-347a5b592c91f0230d52a5117fd83e1f75028207.tar.bz2
glibc-347a5b592c91f0230d52a5117fd83e1f75028207.zip
math: Fix float conversion regressions with gcc-12 [BZ #28713]
Converting double precision constants to float is now affected by the runtime dynamic rounding mode instead of being evaluated at compile time with default rounding mode (except static object initializers). This can change the computed result and cause performance regression. The known correctness issues (increased ulp errors) are already fixed, this patch fixes remaining cases of unnecessary runtime conversions. Add float M_* macros to math.h as new GNU extension API. To avoid conversions the new M_* macros are used and instead of casting double literals to float, use float literals (only required if the conversion is inexact). The patch was tested on aarch64 where the following symbols had new spurious conversion instructions that got fixed: __clog10f __gammaf_r_finite@GLIBC_2.17 __j0f_finite@GLIBC_2.17 __j1f_finite@GLIBC_2.17 __jnf_finite@GLIBC_2.17 __kernel_casinhf __lgamma_negf __log1pf __y0f_finite@GLIBC_2.17 __y1f_finite@GLIBC_2.17 cacosf cacoshf casinhf catanf catanhf clogf gammaf_positive Fixes bug 28713. Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Diffstat (limited to 'sysdeps/ieee754/flt-32/e_j0f.c')
-rw-r--r--sysdeps/ieee754/flt-32/e_j0f.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c
index 0453a30109..9ae91a9dcc 100644
--- a/sysdeps/ieee754/flt-32/e_j0f.c
+++ b/sysdeps/ieee754/flt-32/e_j0f.c
@@ -233,7 +233,7 @@ j0f_near_root (float x, float z)
float index_f;
int index;
- index_f = roundf ((x - FIRST_ZERO_J0) / (float) M_PI);
+ index_f = roundf ((x - FIRST_ZERO_J0) / M_PIf);
/* j0f_asympt fails to give an error <= 9 ulps for x=0x1.324e92p+7
(index 48) thus we can't reduce SMALL_SIZE below 49. */
if (index_f >= SMALL_SIZE)
@@ -514,7 +514,7 @@ y0f_near_root (float x, float z)
float index_f;
int index;
- index_f = roundf ((x - FIRST_ZERO_Y0) / (float) M_PI);
+ index_f = roundf ((x - FIRST_ZERO_Y0) / M_PIf);
if (index_f >= SMALL_SIZE)
return y0f_asympt (x);
index = (int) index_f;