Article View: comp.lang.forth
Article #25Re: F.N floating point format word
From: Krishna Myneni
Date: Thu, 08 Oct 2026 02:17
Date: Thu, 08 Oct 2026 02:17
47 lines
3411 bytes
3411 bytes
On 10/7/26 4:59 PM, Krishna Myneni wrote: > On 10/7/26 3:35 PM, peter wrote: >> On Wed, 7 Oct 2026 02:49:57 -0500 >> Krishna Myneni <krishna.myneni@ccreweb.org> wrote: >> > ... >>> >>> 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. >> > > There may be an efficiency gain to going with the minimum number of > significant digits to get the exponent. I haven't benchmarked it, but > big number arithmetic comes into play when dealing with such a large > number of significant digits. > Initial tests show there is no appreciable difference in execution time between using 32 significant digits and 17 significant digits in the initial call to REPRESENT for benchmarking (F.N). Also, the F>FPSTR method of obtaining the string to n decimal places is approximately twice as fast as the REPRESENT-based (F.N) method, but the latter is more versatile (works over a larger range of n). Incidentally, I replaced raising 10.0e0 to the n^th power via F** with FALOG in the defn of F>FPSTR. -- KM
Technical Details
Message-ID:
<11a6ug9$3dp9c$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-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> <11a6fc4$39ehc$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: Wed, 7 Oct 2026 21:17:45 -0500 Organization: A noiseless patient Spider Lines: 47 Message-ID: <11a6ug9$3dp9c$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> <11a6fc4$39ehc$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 08 Oct 2026 02:17:46 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3597612"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wfP8Tzk4HCcJgQDBYZ4eW"; posting-host="2719ee4311593aa901b5aaaf2caa5538" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:iOD3vfGaV7SwmJfje+/suxm/z+Q= sha256:SkwO3cHjHua7wsLAZSWqlzrD9JfHah6X79D5wZX5aeg= sha1:cvgSfHdDDrNWKyzE8AAqrTZuFus= sha256:o5pUJ1l1dw4LqlZL9zfd6AXzKbffQEWUDlPuHPKspe8= Content-Language: en-US In-Reply-To: <11a6fc4$39ehc$1@dont-email.me>