Sujet : Re: FP number syntax
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 31. Dec 2024, 22:51:35
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Dec31.225135@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : xrn 10.11
Paul Rubin <
no.email@nospam.invalid> writes:
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
<https://forth-standard.org/standard/double#subsection.8.3.1>
>
Aha, thanks. Similarly 8.3.2 for DPANS94. Oddly, in gforth, "123.45"
pushes 12345 0. I can understand "123." is a number (123) followed by a
decimal point, but I'd expect the 45 to either be invalid or another
number, giving 123 0 45.
Traditionally, Forth has used the syntax 123.45 for fixed-point
numbers. You get the same number on the stack as with the standard
"12345.", and in addition, the (user) variable DPL is set to indicate
the position of the decimal point. I have no idea how this crude way
was used in practice, but in any case, Gforth implements this feature.
The Forth-94 standardizers were apparently less convinced, so they
standardized neither numbers with an embedded decimal point, nor DPL.
- 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