This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in std::floor?
On 13 November 2017 at 11:42, Andrew Haley wrote:
> 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.
It might be nice to have that as an option (maybe via an I/O
manipulator like std::fixed) but even if it wasn't too late to change
the default behaviour, most people probably want 1.1 to be printed as
1.1 even though it's really something different.