🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #27

Re: F.N floating point format word

#27
From: Krishna Myneni
Date: Thu, 08 Oct 2026 02:51
27 lines
2547 bytes
On 10/7/26 9:17 PM, Krishna Myneni wrote:
> On 10/7/26 4:59 PM, Krishna Myneni wrote:
...
> 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). ...
Also, the ability to use -n to round the integer part of a number to n 
significant digits is awesome!

Example:

1906.0e  0 f.n  1906.  ok  \ round to 1's place, 4 sig digits
1906.0e -1 f.n  1910  ok   \ round to 10's place, 3 sig digits
1906.0e -2 f.n  1900  ok   \ round to 100's place, 2 sig digits
1906.0e -3 f.n  2000  ok   \ round to 1000's place, 1 sig digit

Note there is a trailing decimal point for rounding to the 1's place 
(n=0): all four digits are significant.

There is no trailing decimal point for n = -1 through -3 which is 
appropriate -- the trailing zeros are not significant. For integers, 
trailing zeros would only be significant if a decimal point appears at 
the end.

--
KM
Technical Details
Message-ID: <11a70fk$3dp9c$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-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> <11a6fc4$39ehc$1@dont-email.me> <11a6ug9$3dp9c$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:51:32 -0500
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <11a70fk$3dp9c$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> <11a6fc4$39ehc$1@dont-email.me>
 <11a6ug9$3dp9c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 08 Oct 2026 02:51:32 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3597612"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+cUyW2KFp7kC8u6SxlTX60"; posting-host="2719ee4311593aa901b5aaaf2caa5538"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TwufafHl+MQb4jAaweg2MM5jODU= sha256:/MOGUAdf1IN1PLyvER1jSg6N6JDH2prPNaT5w79wiKA=
	sha1:127ia2m7OIkLwB5DNhW5mYI9lKk= sha256:v0DFWE50+da700+9iPsFzrfqLzlSwjYI04wyoSZpMKg=
In-Reply-To: <11a6ug9$3dp9c$1@dont-email.me>
Content-Language: en-US