Article View: comp.lang.forth
Article #131Re: F.N floating point format word
From: Krishna Myneni
Date: Sun, 18 Oct 2026 22:10
Date: Sun, 18 Oct 2026 22:10
74 lines
4141 bytes
4141 bytes
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
Technical Details
Message-ID:
<11b3g4l$1hubr$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-mailReferences:
<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>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: F.N floating point format word Date: Sun, 18 Oct 2026 17:10:27 -0500 Organization: A noiseless patient Spider Lines: 74 Message-ID: <11b3g4l$1hubr$1@dont-email.me> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 18 Oct 2026 22:10:31 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1636731"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PAKwSDpDPnm1gZ4Jt6eDA"; posting-host="8668172a2a9ec4f3b6b3e07356248417" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Y55l6Cgc2hRR/j9xNdmafB0+AJI= sha256:SdxZNAViexSORhNqOMeD7QmyFGsMlKc49WeMGm3ZwkM= sha1:M9qzgqvTqJzsa3f9w4sw1BODuC0= sha256:lwhKP9Dg9EUhodFGYbjWFL5WzoxEfSbcZPMreAy+NFE= In-Reply-To: <20261008220746.0000042f@tin.it> Content-Language: en-US