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
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.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html