Article View: comp.lang.forth
Article #22Re: F.N floating point format word
From: peter
Date: Wed, 07 Oct 2026 20:35
Date: Wed, 07 Oct 2026 20:35
63 lines
3426 bytes
3426 bytes
On Wed, 7 Oct 2026 02:49:57 -0500 Krishna Myneni <krishna.myneni@ccreweb.org> wrote: > On 10/6/26 1:03 AM, peter wrote: > > On Mon, 5 Oct 2026 17:01:14 -0500 > ... > > If you are working on (f.n) that I posted there are 2 changes I have made > > later. > > > > f.n-case-e>0 should be > > > > : f.n-case-e>0 ( F:fp n e -- ) > > over + \ n e+n > > fpad 1024 '0' fill > > fpad swap represent 2drop \ n e' > > dup >r \ n e' r: e' > > fpad swap stype > > dup 0 >= if 46 semit then \ n > > fpad r> + \ n fpad+e' > > swap 0 max stype ; > > > > This will prevent the dot to be printed at the end when using negative n. > > > > The other is in a comment > > > > : .sign ( f -- ) > > 13 and 32 + semit ; \ prints bl for positive > > \ if 45 semit then ; \ use this to only print - > > > > The code I posted have 32 in the commented out part! > > It would print a blank instead of a - > > ... > > In the definition of (F.N) you use an argument of u = 32 significant > digits to REPRESENT. I did not understand why you chose this particular > number to obtain the decimal exponent (exp). I changed this to 17 and > all of the tests in fdotn-test.4th still pass. > > : (f.n) ... > fdup fabs fswap fpad ( 32) 17 represent \ find exp and sign > > Since binary -> decimal conversion with 17 significant digits is > guaranteed to cycle in a round trip for binary64, I think 17 will > suffice here for obtaining the correct decimal exponent. There were no real reason. The result at fpad is used only for INF and NAN. I also wanted a number larger then 17, 32 looked like a good round number. The importance of the first call to represent is to get a correct exp to use in the following calculations. The second time represent is called it will be with u=exp+n to get the correct rounding. Peter > -- > Krishna > > > -- > Krishna >
Technical Details
Message-ID:
<20261007223526.000065ab@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>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: Wed, 7 Oct 2026 22:35:26 +0200 Organization: A noiseless patient Spider Lines: 63 Message-ID: <20261007223526.000065ab@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> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Wed, 07 Oct 2026 20:35:29 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3272881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NUetIBw3MGFtJ6y9Ndosau2imXRSh4SY="; posting-host="29d734cbbd43298284cba30c63958454" Cancel-Lock: sha1:J9AAy+ONqPtdsD/Wcp+Zkyb90SA= sha256:F0hVmsSWDy+bMZv5d6oEVvbyZVmKJ8FpHhIgLHOnRuk= sha1:F7TmQzDblHzWAmt8SCFxExqmL3U= sha256:qBmPcyRhCb6/CzkkWn6RW3YYoM2g6RE3yyNNou1+0Iw= X-Newsreader: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32)