Sujet : Re: History of CREATE...DOES> ?
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 02. Aug 2024, 08:11:57
Autres entêtes
Organisation : Ausics - https://newsgroups.ausics.net
Message-ID : <66ac86be$1@news.ausics.net>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 2/08/2024 4:27 pm, minforth wrote:
Really? With
SET-PRECISION / PRECISION ...
Return the number of significant digits currently used
by F.
and with
F. ...
Display, with a trailing space, the top number on the
floating-point stack using fixed-point notation:
[-] ⟨digits⟩.⟨digits0⟩
Fixed-point notation conventionally means decimal places. Here's the spec
from BASIS 17:
12.1.0084 (F.) "Paren-f-dot-paren"
( -- c-addr u )( F: r -- ) or ( r -- c-addr u )
Convert the top number on the floating-point stack to its character
string representation using fixed point notation:
[-] <digit>.<digits0>
The number of digits after the decimal point is determined by PLACES.
That clearly tells how many decimal places to print. There is no equivalent
to PLACES in ANS.
Here's the example ANS gave:
A.12.6.1.1427 F.
For example, 1E3 F. displays 1000.
Let's try it on several forths:
SwiftForth i386-Win32 3.11.9-RC1 01-Sep-2022
3 set-precision ok
1e3 f. 1000. ok
10 set-precision ok
1e3 f. 1000.000000 ok
Gforth 0.7.9_20200709
3 set-precision ok
1e3 f. 1000. ok
10 set-precision ok
1e3 f. 1000. ok
MinForth V3.4.8 - 32 bit
# 3 set-precision ok
# 1e3 f. 1.E3 ok
# 10 set-precision ok
# 1e3 f. 1000. ok
Arguably MinForth isn't compliant as it drops to scientific notation. The
other two, despite displaying differently, are harder to dismiss. I believe
iForth treats PRECISION as decimal places, so that's another variation.