🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #199

Re: FCONSTANT specification

#199
From: dxf
Date: Fri, 30 Oct 2026 00:11
54 lines
3008 bytes
On 29/10/2026 8:18 pm, Anton Ertl wrote:
> dxf <dxforth@gmail.com> writes:
>> Whatever GCC is printing - it's not what
>> the user entered.
> 
> GCC prints the things you ask it to, usually not FP numbers, but,
> e.g., compiler warnings and error messages.
> 
> But as for printing what the user entered, here's what Gforth does:
> 
> .1000000000000000055511151231257827021181583404541015625e e.exact
> 
> outputs
> 
> .1000000000000000055511151231257827021181583404541015625e

3.14159265358979323846264338327
3.14159265358979311599796346854

0.66666666666666666666666666666
0.666666666666666629659232512495

What the user expects/wanted to see?

> Admittedly, there are a lot of numbers around that cannot be
> represented exactly as binary64 number, and for those the cycle
> decimal->binary64->decimal (using >FLOAT and E.EXACT based on a recent
> glibc release) does not print what is input, but the rounding happens
> at decimal->binary64 stage, not on the output.
> 
> Does it look any better for, e.g., E. or 17 e.p?  Consider
> 
> .90000000000000007e
> 
> E. prints
> 
> .9e
> 
> 17 E.P prints
> 
> .90000000000000002e
> 
> Note that none of these numbers has more than 17 decimal digits.

It's not clear to me that IEEE even talks in terms of 'representable' numbers
which leads to the junk that GCC et al print out:

 5.1 Overview

 "Each of the computational operations that return a numeric result specified by
  this standard shall be performed as if it first produced an intermediate result
  correct to infinite precision and with unbounded range, and then rounded that
  intermediate result, if necessary, to fit in the destination’s format"
Technical Details
Message-ID: <6ae3e0af$1@news.ausics.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mail
References: <11aide4$1ibse$1@dont-email.me> <2026Oct15.075508@mips.complang.tuwien.ac.at> <6ad17c5a$1@news.ausics.net> <2026Oct16.071212@mips.complang.tuwien.ac.at> <6ad2df65$1@news.ausics.net> <11auu2d$3t6hf$2@dont-email.me> <11b2cv4$142ig$1@dont-email.me> <11b2nct$17v9i$1@dont-email.me> <11bl2ar$3lj23$1@dont-email.me> <11bobpu$trdt$1@dont-email.me> <11bogem$vnlk$1@dont-email.me> <6ae16eae$1@news.ausics.net> <11bsn80$2cg90$1@dont-email.me> <6ae2b06f$1@news.ausics.net> <6ae30b4f$1@news.ausics.net> <2026Oct29.101853@mips.complang.tuwien.ac.at>

Show Full Headers
Complete Article Headers
Date: Fri, 30 Oct 2026 11:11:28 +1100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: FCONSTANT specification
Newsgroups: comp.lang.forth
References: <11aide4$1ibse$1@dont-email.me>
 <2026Oct15.075508@mips.complang.tuwien.ac.at> <6ad17c5a$1@news.ausics.net>
 <2026Oct16.071212@mips.complang.tuwien.ac.at> <6ad2df65$1@news.ausics.net>
 <11auu2d$3t6hf$2@dont-email.me> <11b2cv4$142ig$1@dont-email.me>
 <11b2nct$17v9i$1@dont-email.me> <11bl2ar$3lj23$1@dont-email.me>
 <11bobpu$trdt$1@dont-email.me> <11bogem$vnlk$1@dont-email.me>
 <6ae16eae$1@news.ausics.net> <11bsn80$2cg90$1@dont-email.me>
 <6ae2b06f$1@news.ausics.net> <6ae30b4f$1@news.ausics.net>
 <2026Oct29.101853@mips.complang.tuwien.ac.at>
Content-Language: en-GB
From: dxf <dxforth@gmail.com>
In-Reply-To: <2026Oct29.101853@mips.complang.tuwien.ac.at>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <6ae3e0af$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 54
X-Complaints: abuse@ausics.net
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mail