[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x
--- Comment #1 from paolo dot carlini at oracle dot com 2010-09-05 12:42 --- There is nothing to fix here, see: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#550 -- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542
[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x
--- Comment #2 from vincenzo dot innocente at cern dot ch 2010-09-05 13:09 --- Subject: Re: std::pow(float) converts to double when compiled with -std=gnu++0x Ciao Paolo, On 5 Sep, 2010, at 2:42 PM, paolo dot carlini at oracle dot com wrote: --- Comment #1 from paolo dot carlini at oracle dot com 2010-09-05 12:42 --- There is nothing to fix here, see: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#550 1) this is VERY unfortunate 2) and then why std::exp(float) invokes expf? (a well as all other transcendental and trigonometric functions that invoke xyzf) also std::sqrt converts to sqrtss ? is this not a bit inconsistent? vincenzo -- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542 --- You are receiving this mail because: --- You reported the bug, or are watching the reporter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542
[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x
--- Comment #3 from paolo dot carlini at oracle dot com 2010-09-05 15:36 --- The issue affects only mixed mode arithmetic (thus, functions taking at least two arguments), and in that case, as Howard explained, C++0x does what Fortran and C do. In any case, we are implementing correctly the FCD, for sure. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542
[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x
--- 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... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542
[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x
--- 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
[Bug c++/45542] std::pow(float) converts to double when compiled with -std=gnu++0x
--- Comment #6 from paolo dot carlini at oracle dot com 2010-09-05 23:01 --- Ok... We can discuss these issues in better detail when we met. Well, remember that this is Free Software, thus, if you are unsure about a behavior, just open the header in an editor and look inside it: isn't only allowed, is encouraged! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45542