On Sun, 18 Oct 2026 17:10:27 -0500 Krishna Myneni <kris…@ccreweb.org> wrote:
> On 10/8/26 3:07 PM, peter wrote:
> > On Thu, 8 Oct 2026 09:18:57 -0500 > > Krishna Myneni <kris…@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