🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #141

Re: F.N floating point format word

#141
From: Krishna Myneni
Date: Mon, 19 Oct 2026 16:41
29 lines
2549 bytes
On 10/19/26 11:03 AM, peter wrote:
> On Mon, 19 Oct 2026 09:51:12 -0500
> Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
> 
...
>> \ 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.N where n is decimal places is often what users want.
>>
...
> 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!
> 

That's nice and compact.

--
KM
Technical Details
Message-ID: <11b5h85$281i8$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-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> <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> <20261019180323.00005baf@tin.it>

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 11:41:41 -0500
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <11b5h85$281i8$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> <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>
 <20261019180323.00005baf@tin.it>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 19 Oct 2026 16:41:42 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2360904"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/VYhTU1sDSR+SEpeKBnAdR"; posting-host="53448866990c10d050150d317b8d863b"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/5YImbsXi6QpW50Od6uTrP1xU1s= sha256:8Ncdj7jhpdSNnYsUuASusSyYRiTMtCvXlmPBvE2/fvQ=
	sha1:fNHJ66mrlK8jOItmjLcruXnHQ/o= sha256:fC65TJjOOb+z6P/BdjdpwyJE7FKbQxP5K5V4qGLHmIc=
Content-Language: en-US
In-Reply-To: <20261019180323.00005baf@tin.it>