On 29/10/2026 8:18 pm, Anton Ertl wrote:
> dxf <dxfo…@gmail.com> writes:
>> Whatever GCC is printing - it's not what
>> the user entered.
>
> GCC prints the things you ask it to, usually not FP numbers, but,
> e.g., compiler warnings and error messages.
>
> But as for printing what the user entered, here's what Gforth does:
>
> .1000000000000000055511151231257827021181583404541015625e e.exact
>
> outputs
>
> .1000000000000000055511151231257827021181583404541015625e
3.14159265358979323846264338327
3.14159265358979311599796346854
0.66666666666666666666666666666
0.666666666666666629659232512495
What the user expects/wanted to see?
> Admittedly, there are a lot of numbers around that cannot be
> represented exactly as binary64 number, and for those the cycle
> decimal->binary64->decimal (using >FLOAT and E.EXACT based on a recent
> glibc release) does not print what is input, but the rounding happens
> at decimal->binary64 stage, not on the output.
>
> Does it look any better for, e.g., E. or 17 e.p? Consider
>
> .90000000000000007e
>
> E. prints
>
> .9e
>
> 17 E.P prints
>
> .90000000000000002e
>
> Note that none of these numbers has more than 17 decimal digits.
It's not clear to me that IEEE even talks in terms of 'representable' numbers
which leads to the junk that GCC et al print out:
5.1 Overview
"Each of the computational operations that return a numeric result specified by
this standard shall be performed as if it first produced an intermediate result
correct to infinite precision and with unbounded range, and then rounded that
intermediate result, if necessary, to fit in the destination’s format"