🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #66

Re: FCONSTANT specification

#66
From: Krishna Myneni
Date: Mon, 12 Oct 2026 13:38
38 lines
2449 bytes
On 10/12/26 7:31 AM, Krishna Myneni wrote:
> On 10/12/26 5:40 AM, marcel hendrix wrote:
>> 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).

> ... For all IEEE binary 
> formats, the number of decimal digits which must be specified for 
> roundtrip binary -> decimal -> binary are given in the IEEE 754 
> standard. For double precision, it is 17.
> ..

I was unable to give a more complete answer for IEEE binary formats, 
having been pulled away from the computer. Here is a more complete 
answer, from the IEEE 754 standard:

Limits on correctly rounded conversion:

binary16: Pmin = 5 digits
binary32: Pmin = 9 digits
binary64: Pmin = 17 digits
binary128: Pmin = 36 digits

For all other binary formats bf,

Pmin(bf) = 1 + ceiling(p*log_10(2)), where p is the number of 
significant bits in bf.

e.g. for double precision, p = 53 bit significand, the above formula 
gives 17 decimal digits.

For 64 bit significand (80-bit extended precision) , the formula gives 
21 digits.

--
KM

Technical Details
Message-ID: <11ainru$3kbfc$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
References: <11aide4$1ibse$1@dont-email.me> <11aijvt$3iobp$1@dont-email.me>

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: Krishna Myneni <krishna.myneni@ccreweb.org>
Newsgroups: comp.lang.forth
Subject: Re: FCONSTANT specification
Date: Mon, 12 Oct 2026 08:38:06 -0500
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <11ainru$3kbfc$1@dont-email.me>
References: <11aide4$1ibse$1@dont-email.me> <11aijvt$3iobp$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 13:38:07 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3812844"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+L3W/epyenLLrJv/jkzFdj"; posting-host="0049bcdfbab9457ae4461d9eec926e65"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UVTDjGVbi/zGxoS7aMlkZFHjIDc= sha256:HoypNE5WaMlTIICM4/VtcNB4loIzzpv5foABw8Y2ybE=
	sha1:IFqE2JZ4Ewq5grbEDtNcwxK82p0= sha256:yUMTJ25KmZbV3gjOIlgZYOuRU8Qcd/8oMn6in0mrmqc=
In-Reply-To: <11aijvt$3iobp$1@dont-email.me>
Content-Language: en-US