[Bug libc/34123] MATH: squaring: improve consistency! and speed of pow( x, 2 ),

wdijkstr at arm dot com via Glibc-bugs <[email protected]> Wed, 17 Jun 2026 11:44:00 +0000
Newsgroups gmane.comp.lib.glibc.bugs
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34123

--- Comment #10 from Wilco <wdijkstr at arm dot com> ---
(In reply to b. from comment #9)
> (In reply to Wilco from comment #8)  
>   
> > Like I said, the optimization is already implemented both in GCC and LLVM,
> > so you could propose to enable it by default.  
>   
> Do you mean in applications? Or in gcc / GLIBC ...?  
> In an application ( bigger codebase which I don't fully grasp ) I have the
> idiosyncrasie that despite compilation with -O2 x^2 != x*x for some values.  
> That's why I'm investigating / asking.  

I mean changing GCC to enable the optimization by default.

> > There isn't anything useful that can be done in GLIBC.  
>   
> Activating substitution by default? If - I doubt - there is any useful use
> of deviating powers one could implement a switch "-fno-reliable-squaring" or
> similar ( kidding ) or perhaps the already existing -fno-builtin-pow can do
> the job for people who want the nonsense. Those then should know what they
> are doing, and would avoid irritations / surprises for others.

Not sure what you mean. Everyone who knows what they are doing are already
writing x*x or enable fast-math.

-- 
You are receiving this mail because:
You are on the CC list for the bug.