🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #136

Re: F.N floating point format word

#136
From: peter
Date: Mon, 19 Oct 2026 13:41
87 lines
4673 bytes
On Sun, 18 Oct 2026 17:10:27 -0500
Krishna Myneni <krishna.myneni@ccreweb.org> wrote:

> On 10/8/26 3:07 PM, peter wrote:
> > On Thu, 8 Oct 2026 09:18:57 -0500
> > Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
> ...
> >>> Thanks to dxf's question I continued testing and found an error.
> >>>
> >>> 0.999955555e 2 f.n  0.0100
> >>>
> >>> What happened was that in this case exp from the first represent is 0
> >>> in the test to choose action f.n-case-e<=0 get chosen. In this part
> >>> exp is recalculated and became 1!
> >>> The correction is to move the second represent earlier before choosing.
> >>>
> > 
> >>
> >> Would you please attach the complete code when you get a chance since
> >> several revisions have been made?
> >>
> >> Also, I found the following issue with n < 0. It's possible I introduced
> >> a bug in my revisions of your code, or that I missed some change.
> >>
> >> 0.1e -1 (f.n) type 0.1 ok  \ should be "0."
> >> 0.01e -1 (f.n) type 0.01 ok \ should be "0."
> >> 0.1e -2 (f.n) type 0.1 ok  \ should be "0."
> >>
> >> and similar.
> >>
> ...
> > No they were actually designed to behave like that! I made it so that
> > when an impossible combination of exp and n were found n was set to a
> > value that showed the number with one significant digit. That is exactly
> > what happens in the above tests. But I agree with you when both exp and n
> > are negative n will be set as 0 and the number rounded to 1. or 0.
> > I have implemented that test now. I also restructured the code better
> > and combined 2 cases into one case normal.
> > 
> > Below follows code for both F.N and (F.N) tested on kForth64
> > 
> ...
> >       
> > \ 0 [IF]
> > \ Test cases
> > : testing cr begin refill while source 2dup type space evaluate cr repeat ;
> > testing
> > 0.9e  0 f.n
> > 0.3e  0 f.n
> > -0.9e 0 f.n
> > -0.3e 0 f.n
> > ...
> 
> I have patched the code with all recent fixes for the logic of (F.N) and 
> revised it to work on both separate stack and unified data/fp stack in 
> fdotn.4th. I have also revised the automated tests in fdotn-test.4th to 
> include your tests. The two files,
> 
> fdotn.4th
> fdotn-test.4th
> 
> may be found in the lastest commits for the git repos for 
> kForth-64/32/Win32 on github or in the repos on ccreweb.org.
> 
> Direct links to the revised files:
> 
> https://github.com/mynenik/kForth-64/blob/master/forth-src/fdotn.4th
> https://github.com/mynenik/kForth-64/blob/master/forth-src/fdotn-test.4th
> 
> An additional change to the definition of (F.N) prevents the sign on 
> conversion failure from being output except for "inf". The last two 
> tests in fdotn-test.4th have been revised accordingly.
> 
> --
> KM
> 
Nice to see that you could integrate it in kForth!

I have also introduced it in ntf64/lxf64.
I liked the possibility to directly specify how many digits to print
instead of setting precision (that I half of the time misspell!)

I might do a FS.N where n would be significant digits

BR
Peter
Technical Details
Message-ID: <20261019154105.0000595f@tin.it>
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: <119oin2$26n99$1@dont-email.me> <11a01mr$sqrm$1@dont-email.me> <20261005150222.00006cf5@tin.it> <11a16nc$1camn$1@dont-email.me> <20261006080347.00002cdf@tin.it> <11a4tj5$2ku7v$1@dont-email.me> <20261007223526.000065ab@tin.it> <6ac7013a$1@news.ausics.net> <20261008121302.00007412@tin.it> <20261008152645.00001682@tin.it> <11a88oh$3t0ti$1@dont-email.me> <20261008220746.0000042f@tin.it> <11b3g4l$1hubr$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: peter <peter.noreply@tin.it>
Newsgroups: comp.lang.forth
Subject: Re: F.N floating point format word
Date: Mon, 19 Oct 2026 15:41:05 +0200
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <20261019154105.0000595f@tin.it>
References: <119oin2$26n99$1@dont-email.me>
	<11a01mr$sqrm$1@dont-email.me>
	<20261005150222.00006cf5@tin.it>
	<11a16nc$1camn$1@dont-email.me>
	<20261006080347.00002cdf@tin.it>
	<11a4tj5$2ku7v$1@dont-email.me>
	<20261007223526.000065ab@tin.it>
	<6ac7013a$1@news.ausics.net>
	<20261008121302.00007412@tin.it>
	<20261008152645.00001682@tin.it>
	<11a88oh$3t0ti$1@dont-email.me>
	<20261008220746.0000042f@tin.it>
	<11b3g4l$1hubr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 19 Oct 2026 13:41:07 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2215165"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18icZ8S2Mppw4B+78QN93yIeMIszVrov1Y="; posting-host="2a9ffb9e9908d1d53263e6b46252b91f"
Cancel-Lock: sha1:L/taquJuKdwiJspansy0COj9Zb4= sha256:xD6VKI89uG86C/PiraVH7Vlpb2k+EC1v9sMtCr3Yye4=
	sha1:EbfMPsJus8wTrg70eHWR4upEKHc= sha256:xWVkXht9SrLB3P/JoAStD9TNm8Q1l1N36DBvMVqLZUc=
X-Newsreader: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32)