[cfe-dev] [libcxx/test] Puzzling floating point behaviour
Edward Meewis
ed at extraordinarymachine.nl
Fri Dec 9 23:04:12 PST 2011
On 10-12-11 5:34, Eli Friedman wrote:
> On Fri, Dec 9, 2011 at 8:23 PM, Edward Meewis
> <ed at extraordinarymachine.nl> wrote:
>> On 10-12-11 1:34, Eli Friedman wrote:
>>>
>>> On Fri, Dec 9, 2011 at 7:58 AM, Edward Meewis
>>> <ed at extraordinarymachine.nl> wrote:
>>>>
>>>> <snip>
>>>>
>>>>
>>>> I'm guessing long doubles get demoted somewhere. Does anyone have an
>>>> idea what the problem may be?
>>>
>>> I'm not getting quite the same results as you, but your testcase isn't
>>> really testing what you want to test: std::exp is not the same as
>>> ::exp.
>>>
>>> -Eli
>>
>> Thanks, Eli, that's probably a big clue, but I don't get it. This is
>> probably a stupid question, but can you explain? I would expect all exp's to
>> be in std::. What's the difference?
>
> std::exp is the properly overloaded exp defined by the C++ standard.
> ::exp isn't overloaded, so it loses precision.
>
> -Eli
I am certainly not convinced that things are working properly. The
attached program and test script tests 8 cases, all compiled with fresh
clang++ and fresh libc++:
library WITH_NS_STD WITH_EXP_OVERLOADED Result
-------------------------------------------------------
libc++ no no d incorrect, dx1 correct
libc++ no yes d, dx1 correct
libc++ yes no d, dx1 incorrect
libc++ yes yes d, dx1 incorrect
libstdc++ no no d, dx1 correct
libstdc++ no yes doesn't compile
libstdc++ yes no d, dx1 correct
libstdc++ yes yes d, dx1 correct
I'm going to give it a rest for a while, any ideas are highly appriciated!
Regards, Ed.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pow_complex_test.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111210/64c5e343/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_pow.sh
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111210/64c5e343/attachment-0001.ksh>
More information about the cfe-dev
mailing list