https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114363

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |xry111 at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Harald van Dijk from comment #1)
> This is, I believe, correct. Before C++11, calling std::pow with float and
> int arguments, it returned a float. As of C++11, it returns a double.
> 
> If the result of pow(x,2) is immediately converted to float, then it is a
> valid optimisation to convert it to x*x: that is guaranteed to produce the
> exact same result. But if it isn't, then converting to x*x loses accuracy
> and alters the result.

Thus invalid.

> You can call std::powf instead of std::pow to avoid the promotion to double.

Or add -std=c++98.

Reply via email to