Article View: comp.lang.forth
Article #140Re: F.N floating point format word
From: peter
Date: Mon, 19 Oct 2026 16:03
Date: Mon, 19 Oct 2026 16:03
49 lines
3299 bytes
3299 bytes
On Mon, 19 Oct 2026 09:51:12 -0500 Krishna Myneni <krishna.myneni@ccreweb.org> wrote: > 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 I did it even simpler as I already had a factor for fs. and fe. : (FS.) fpad precision 2dup represent 1 (fx.) ; : (FS.N) fpad swap 1+ 1 max 2dup represent 1 (fx.) ; : (FE.) fpad precision 3 max 2dup represent 3 (fx.) ; no negative n allowed here! Peter
Technical Details
Message-ID:
<20261019180323.00005baf@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-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> <11b5ap0$2579h$2@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 18:03:23 +0200 Organization: A noiseless patient Spider Lines: 49 Message-ID: <20261019180323.00005baf@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> <20261019154105.0000595f@tin.it> <11b5acr$2579h$1@dont-email.me> <11b5ap0$2579h$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Mon, 19 Oct 2026 16:03:24 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2313590"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+f+FIOPf9jh8kRWZWAjQfY6ixX6p6k9os="; posting-host="2a9ffb9e9908d1d53263e6b46252b91f" Cancel-Lock: sha1:hjO9ebf43qOx1PxXzq31w9jrKXA= sha256:Q+YXIioiVFbNvisQ3A0p3OyoROSiOjeh0w30pcLNtI4= sha1:HJNz13gOP9zK2JG7Owa4rmRiNho= sha256:HsWOhqm4bKAWmuA0oN46B+SwoMUbcn2x+XWg48VI6/A= X-Newsreader: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32)