[PATCH] math: Fix float conversion regressions with gcc-12 [BZ #28713]

Szabolcs Nagy szabolcs.nagy@arm.com
Tue Jan 4 08:52:30 GMT 2022


The 01/03/2022 11:24, Paul Zimmermann wrote:
>        Dear Szabolcs,
> 
> > > +# define M_PI_2f	1.57079632679489661923f	/* pi/2 */
> > > 
> > > -      __real__ res = (FLOAT) M_MLIT (M_PI_2) - __real__ y;
> > > +      __real__ res = M_MLIT (M_PI_2) - __real__ y;
> > > 
> > > I wonder why your patch never uses M_PI_2f. Should it be M_PI_2f above?
> > 
> > this is template code under math/ and M_MLIT (M_PI_2) should
> > expand to M_PI_2f when it is used for the float variant.
> > 
> > see the change in
> > sysdeps/generic/math-type-macros-float.h
> 
> ok.
> 
> While looking at that patch, in math/math.h, I thought new constants should
> be declared as hexadecimal values?
> 
> +# define M_Ef		2.7182818284590452354f	/* e */
> 
> Otherwise this patch seems good to me.

this is a public header, i think decimal consts
are used because hexadecimal is >=c99 only and
not c++ compatible (at least before c++17).


More information about the Libc-alpha mailing list