🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #50

Re: F.N floating point format word

#50
From: Krishna Myneni
Date: Fri, 09 Oct 2026 20:29
52 lines
3859 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:
> 
...
>> 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
...
Thank you! I will integrate the changes into fdot.4th and fdot-test.4th 
in the kForth packages, and verify the results.

REPRESENT in kForth now returns the three character 'inf' and 'nan' 
strings when appropriate. It can also return 'ERR' for an unspecified 
conversion error (when dtoa() returns 0 characters and exp is not equal 
to 9999). I don't actually know under what condition this might happen, 
but if it happens, there is a string to indicate it.

I factored my implementation of FS. in kForth to use the string output 
word (FS.) which is a factor of "FS.". (FS.) is now intrinsic to all 
kForth variants and is part of the Forth wordlist. It enables me to 
simplify considerably one of my strings library words.

My definition of (FS.) will only prepend a sign for the case of 'inf'. 
The possible outputs of (FS.) on conversion failure are '+inf' '-inf' 
'nan' and 'ERR'. I intend to follow this convention with (F.N) as well.

Presently, I'm making other corrections and enhancements to my strings 
library, most of which came from discussion in this thread.

--
Krishna
Technical Details
Message-ID: <11abiqp$14ei6$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-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>

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: Fri, 9 Oct 2026 15:29:13 -0500
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <11abiqp$14ei6$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: Fri, 09 Oct 2026 20:29:14 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1194566"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18iLDhnxms46iBUnEn8g2xg"; posting-host="f158375d86a66cd64e6404390dfa3c2c"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lKZgyz9DWjAM9L08lxeIv67+z4k= sha256:uJJSo5w3MORz6mrmGSuoY+YR5oskneGzkFWoGzWHxuY=
	sha1:0ZkT59T+zPycPdJtlLaKWYtGgKI= sha256:jpDMjlRhkh6KtkOx+v7/TdHxKT+NuZzNKKiotgxRilU=
In-Reply-To: <20261008220746.0000042f@tin.it>
Content-Language: en-US