Article View: comp.lang.forth
Article #138Re: F.N floating point format word
From: Krishna Myneni
Date: Mon, 19 Oct 2026 14:51
Date: Mon, 19 Oct 2026 14:51
40 lines
2866 bytes
2866 bytes
On 10/19/26 9:44 AM, Krishna Myneni wrote:
> On 10/19/26 8:41 AM, peter wrote:
...
>> 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
>>
>
> Do you mean decimal places? The latest strings library in kForth-x has
> (FS.N) where n is decimal places. I think this corresponds to Fortran
> 90's ES<w>.<n> format, but haven't verified it yet.
>
> Normal FS. and (FS.) converts to output in significant digits specified
> via PRECISION.
>
...
From strings.4th:
\ Convert r to a scientific notation string, caddr u pair,
\ with n decimal places
: (fs.n) ( n -- a u ) ( F: r -- ) \ ( r n -- a u )
precision >r 1+ set-precision (fs.) strbufmove
r> set-precision ;
(FS.) is an intrinsic word in kForth, but it is easy to write using
REPRESENT. I think I posted it in a previous thread.
FS.N where n is decimal places is often what users want.
--
KM
Technical Details
Message-ID:
<11b5ap0$2579h$2@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> <11b3g4l$1hubr$1@dont-email.me> <20261019154105.0000595f@tin.it> <11b5acr$2579h$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: Krishna Myneni <krishna.myneni@ccreweb.org> Newsgroups: comp.lang.forth Subject: Re: F.N floating point format word Date: Mon, 19 Oct 2026 09:51:12 -0500 Organization: A noiseless patient Spider Lines: 40 Message-ID: <11b5ap0$2579h$2@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> <11b3g4l$1hubr$1@dont-email.me> <20261019154105.0000595f@tin.it> <11b5acr$2579h$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 19 Oct 2026 14:51:13 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2268465"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ipH4+3hK7jmcuAuXiBeRs"; posting-host="53448866990c10d050150d317b8d863b" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:7I7nSMm0rQo6hbjzkRSJ6Rjsot0= sha256:UYQHt2Hm6WREPWoj0o+x9hpz/R/dg0BdCllE6lrrvYs= sha1:/p11TjAs7T0rO+j4HeF5QlgsI4s= sha256:szlvHmHdUe0HpHQXg9g75gvd9rRN7rZRYiNqYRWzUxI= In-Reply-To: <11b5acr$2579h$1@dont-email.me> Content-Language: en-US