[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x

vincenzo dot innocente at cern dot ch gcc-bugzilla@gcc.gnu.org
Sun Sep 5 19:55:00 GMT 2010



------- Comment #5 from vincenzo dot innocente at cern dot ch  2010-09-05 19:55 -------
Subject: Re:  std::pow(float) converts to double when compiled with
-std=gnu++0x


On 5 Sep, 2010, at 6:15 PM, paolo dot carlini at oracle dot com wrote:

> 
> 
> ------- Comment #4 from paolo dot carlini at oracle dot com  2010-09-05 16:15 -------
> By the way, if a function taking a single argument is passed and integer, the
> return type is double, not float or long double and one can see that the
> underlying mechanism is the same. All in all, I agreed with the resolution
> suggested by Howard, at the time, and frankly I don't thick the DR should be
> re-opened. CERN should send somebody to the ISO Meetings, like Fermilab doesÂ…

After reading the standard a couple of times,
I fully agree that gcc implements the standard as written including the last
resolution
to remove std::(T,int) (this last bit escaped my first reading)

I've discovered that std::pow(float,float) (called for instance as
std::pow(x,2.f))
behaves as "I" expect.

The fact that CERN is not represented in ISO is an old story (we are NOT
affiliated to any national committee)
and we rely on Fermilab representatives.

In any case this seems to be a C99 issue and my understanding is that C++ never
overrules C.

The conclusion is that we will have now to recommend to use pow(float,float)
not pow(float, int)
if float behavior is desiredÂ…


          vincenzo

> 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542



More information about the Gcc-bugs mailing list