Bug in std::floor?

Andrew Haley aph@redhat.com
Mon Nov 13 11:43:00 GMT 2017


On 13/11/17 10:38, Mason wrote:
> On 09/11/2017 16:46, Vincent Lefevre wrote:
> 
>> Actually, that's mainly a language design bug, which doesn't show
>> the error for 460 (which is representable exactly).
> 
> It's not clear to me exactly /what/ you are calling a language design bug?
> And in what language? C? IEEE 754?> (AFAIK, C is pretty loose with the floating point spec.)

This is C++.  The problem is that std::cout << v doesn't print all of
the digits in v: ideally, it'd print the minimum number of digits such
that reading the number back would result in a double equal to v.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the Gcc-help mailing list