On 10/22/26 1:32 AM, Anton Ertl wrote:
> 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"
>
This sort of behavior, not getting what you asked for, is not likely to be used by the scientific community. In calculations or experiments, it is important to show the actual number of significant digits.
--
KM