Sujet : Re: FP number syntax
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 01. Jan 2025, 12:47:16
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Jan1.124716@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : xrn 10.11
dxf <
dxforth@gmail.com> writes:
On 1/01/2025 2:42 pm, Bernd Linsel wrote:
It's usually implemented that DPL is reset to -1 when entering >NUMBER,
each successful digit conversion increments it only if it is >= 0, and the first decimal separator encountered changes it from -1 to 0.
>
Yes, in Fig-Forth. In Swiftforth DPL is just a flag.
SwiftForth x64-Linux 4.0.0-RC89 15-Jul-2024
1 dpl ? -1023 ok
1.234 dpl ? 3 ok
12 dpl ? -1022 ok
Apparently SwiftForth counts every digit starting with -1024, and "."
setting the count to 0. So for doubles the behaviour is the same as
that of Gforth, and testing for dpl @ 0< identifies singles on both
systems. lxf and VFX behave like Gforth.
So systems that implement DPL implement it similarly enough that
programs can determine the number of digits after the decimal point.
But does anybody actually make use of DPL? I have not seen a single
use, ever. Is it just some feature that someone thought up and
implemented, and we all continued to implement it because we could and
it was traditional?
If there has been a use at some time, is there still? I have not seen
complaints about the non-standardization of DPL and the
only-terminating decimal point in Forth-94 or Forth-2012.
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/ EuroForth 2024: https://euro.theforth.net