🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #123

Re: FCONSTANT specification

#123
From: albert
Date: Sun, 18 Oct 2026 12:47
73 lines
3692 bytes
In article <2026Oct18.081501@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>albert@spenarnc.xs4all.nl writes:
>>In article <2026Oct16.174024@mips.complang.tuwien.ac.at>,
>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>A better way to think about them is: Each FP number has an exact
>>>value, but in some cases conversions to FP and FP operations round,
>>>because there is no FP value for the exact result; this rounding leads
>>>to errors.  The size of this error is the subject of numerical
>>>analysis.
>>
>>Exactly
>>0.0001E0 DUP FSIN F-
>
>I assume you mean FDUP here.
Good catch.

>
>>looses a whole lot of precision.
>>Maybe "imprecise numbers" is not a bad name after all.
>
>It is.  It's not the numbers that are imprecise, it's the operations.
>They round (but not in every case).

F- generates the exact result of the number that is supposed
to represent 0.001 (maybe imprecisely)  and the number that
represents sin(0.001) imprecisely. The latter is bound to be imprecise
because sin(0.001) is transcendental, so irrational.

So F- is not to blame that the result is imprecise.
: thou 0.001E0 ; OK
 HEX OK
  thou FS.
  4.189374BC6A7EC00000_-3  OK
  thou FSIN FS.
  4.18936948629841A800_-3  OK
 OK
 thou FSIN thou F- FDUP FS.
 -B.7407E67E5800000000_-9  OK

Now it can be demonstrated by adding the thou back to the result,
that F- doesn't introduce loss of precision.
 thou F+ FDUP FS.
 4.18936948629841A800_-3  OK
 thou FSIN FS.
 4.18936948629841A800_-3  OK

Summary F- is working with precision on imprecise numbers.

>In the present case the conversion from the decimal string to the FP
>number rounds (but that makes little difference for what follows), and
>FSIN rounds.  F- does not round in this case, but the absolute error
>from the FSIN rounding is still present in the result and is
>relatively larger compared to the result, so the number of significant
>digits is smaller; this phenomenon is called cancellation.

FSIN doesn't round. It is not magically bound to the math sine function.
It is defined as an operation that returns a rational number that
is close within x ULP to the mathematical sine function.

More succinctly: the sine function is beholden to be represented
by an imprecise number. All operation results  with imprecise numbers
should be regarded with suspicion.


>
>- anton

Groetjes Albert
-- 
The Chinese government is satisfied with its military superiority over USA.
The next 5 year plan has as primary goal to advance life expectancy
over 80 years, like Western Europe.
Technical Details
Message-ID: <nnd$0498866d$0b627e68@b46808a41b3ca970>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!npeer.as286.net!npeer-ng0.as286.net!peer04.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!abo004.abavia.com!feed.abavia.com!abr004.abavia.com!abp003.abavia.com!reseller!not-for-mail
References: <11aide4$1ibse$1@dont-email.me> <2026Oct16.174024@mips.complang.tuwien.ac.at> <nnd$394cc66f$08a48cb4@da8b86a855ca7c1b> <2026Oct18.081501@mips.complang.tuwien.ac.at>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.forth
References: <11aide4$1ibse$1@dont-email.me> <2026Oct16.174024@mips.complang.tuwien.ac.at> <nnd$394cc66f$08a48cb4@da8b86a855ca7c1b> <2026Oct18.081501@mips.complang.tuwien.ac.at>
From: albert@spenarnc.xs4all.nl
Subject: Re: FCONSTANT specification
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$0498866d$0b627e68@b46808a41b3ca970>
Organization: www.abavia.com
Date: Sun, 18 Oct 2026 14:47:10 +0200
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!npeer.as286.net!npeer-ng0.as286.net!peer04.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!abo004.abavia.com!feed.abavia.com!abr004.abavia.com!abp003.abavia.com!reseller!not-for-mail
Lines: 74
Injection-Date: Sun, 18 Oct 2026 14:47:10 +0200
Injection-Info: reseller; mail-complaints-to="abuse@abavia.com"
X-Received-Bytes: 3446