marcel hendrix <m…@iae.nl> writes:
>None of my floating point code rounds in any of the printing words, it
>indeed truncates. For it to be automatic, an idea about the precision
>of the calculation is needed and the printing knows nothing about that.
I don't see a difference between rounding and truncation here. If the
program knows the precision, it can use a appropriate word that
outputs only the significant digits or marks the last significant
digit (e.g., by underlining it). However, given that the program
usually does not compute this information, the Gforth words that you
can pass a precision to, such as F.RDP and E.P, treat it as a minimum
rather than exact number of significant digits to be shown, i.e., they
may show more digits. E.g.:
123e 2 e.p \ prints "123e"
- 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