🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #63

FCONSTANT specification

#63
From: marcel hendrix
Date: Mon, 12 Oct 2026 10:40
30 lines
2375 bytes
In view of the current thread of floating-point input and output, how 
should we specify FCONSTANTs ? My concern is when the system potentially 
uses single, double, or extended-double (or worse).
Is the algorithm that guarantees that a printed number can be converted 
'losslessly' back to its internal presentation able to do that 
regardless of the number of bits in the internal representation?

We probably don't want that FP library code developed for a double 
implementation specifies table constants etc. that are depending on the 
precision of its internal implementation. (I had this problem last week 
when porting a ddfloat library to xdfloats, although there it was 
especially tricky.)

Example:
0e dfvalue t1  0e sfvalue t2
1e f>xd 7e f>xd xd/ xdconstant xd=1/7
xd=1/7 xdfe. 1.42857142857142857142857142857142857142e-1

1e 7e f/          +e. 1.4285714285714285714e-0001
1e 7e f/ TO t1 t1 +e. 1.4285714285714284921e-0001
1e 7e f/ TO t2 t2 +e. 1.4285714924335479736e-0001

You will notice that simply rounding the 80-bit output will not produce 
the correct double and single constants. (xd => extended double is ok, 
by accident?)

The standard (can't?) say(s) anything about this?

-marcel
Technical Details
Message-ID: <11aide4$1ibse$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: marcel hendrix <mhx@iae.nl>
Newsgroups: comp.lang.forth
Subject: FCONSTANT specification
Date: Mon, 12 Oct 2026 12:40:03 +0200
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <11aide4$1ibse$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 12 Oct 2026 10:40:05 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1650574"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/hGA+f70jjB0fnMzIT+nnzrIvhbvax9QM="; posting-host="2cbd0f5d5bdd21d0759d7ae701ea74d9"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uFyqciu/+kv+ilgXMXnAEAXR2YA= sha256:Juws35p3zE90B9FxfXIYi3QjFpzMoYQ+yFhFViF5T8g=
	sha1:uofe5VaW9QuH9X7PjxTNn8qkzxE= sha256:2WNrJ91qTuNJstDN0oZFOdQzMEImADI/yy5LzFsg1Pw=
Content-Language: en-US