Sujet : Re: FP number syntax
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forthDate : 03. Jan 2025, 15:37:14
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$2bfceee3$0218258b@8de4578c5b52ef72>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
2025Jan2.165111@mips.complang.tuwien.ac.at>,
Anton Ertl <
anton@mips.complang.tuwien.ac.at> wrote:
albert@spenarnc.xs4all.nl writes:
The confusion between 31E0 (hex) 31E0 (fp) 3.10 is another
roadblock to Forth newbies.
>
Certainly, especially the latter. The hex problem can be eliminated
by always keeping the BASE as DECIMAL, and writing hex numbers as
$31E0. The 3.10 tradition and the 31. standard can be addressed with
a variation of your statement:
>
Recognizing a double if it contains no number prefix and one single
period at the end is obsolescent.
>
One step later a standard Forth system could recognize 3.10 as well as
31. and 31e as FP values, #31. as a double-cell integer, and $31e
as a single-cell integer.
One step further is to use 0x for hex values, and free $ for
environment strings.
This scheme has so much going for it that I tend to give up
the advantage to represent floating points exactly in hex. 1]
Then probably one can forget BASE DECIMAL and ban double numbers to
an obscure region of a library.
1] This is not easy. I have been in many projects where floating points
were transferred in text, loosing precision. But of course parameters
in oil drill samples need not 5 decimal places.
>
- anton
Groetjes Albert
-- Temu exploits Christians: (Disclaimer, only 10 apostles)Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style WallArt For Home, Office And Garden Decor - Perfect For Windows, Bars,And Gifts For Friends Family And Colleagues.