🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #106

Re: F.N floating point format word

#106
From: Anton Ertl
Date: Sat, 17 Oct 2026 10:06
37 lines
2434 bytes
peter <peter.noreply@tin.it> writes:
>Here is a version that corrects this.
>
>over 0 >= if 
>   swap over 1024 swap - min swap else   \ limit positive n
>   dup 0<= if nip 0 swap else            \ limit negative n when e negative
>   1 over - rot max swap then then       \ limit negative n


Can this be simplified?  Here's what I came up with:

over 0 >= if
    1024 2 pick - rot min
else 
    dup 0<= if
        nip 0
    else
        1 over - rot max 
    then
then
swap

Or, using CASE with ?OF:

case
    dup 0 >= ?of 1024 2 pick - rot min endof
    dup 0<=  ?of nip 0 endof
    1 over - rot max
0 endcase
swap

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: https://forth-standard.org/
EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html
Technical Details
Message-ID: <2026Oct17.120620@mips.complang.tuwien.ac.at>
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> <11autmd$3t6hf$1@dont-email.me> <20261017115221.0000440b@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: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: F.N floating point format word
Date: Sat, 17 Oct 2026 10:06:20 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 37
Message-ID: <2026Oct17.120620@mips.complang.tuwien.ac.at>
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> <11autmd$3t6hf$1@dont-email.me> <20261017115221.0000440b@tin.it>
Injection-Date: Sat, 17 Oct 2026 10:18:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="82832"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+/SFEta8g7+TIS38k0MAQj"; posting-host="16c33216d85d56b66611c21098e8c6f9"
Cancel-Lock: sha1:BlrHv6T/Lux24NbDWt87bQRcnA4= sha256:a9SMYnkSFNLD3QrSEB2W0cdSfQREwJ3UO0TOkxcio/A=
	sha1:96Ac9XssQzsu9wkoh08W3MumSxs= sha256:PTM/2/Nag2vKcPcuciOta1sCumeVt6Nae+sKo5sk98A=
X-newsreader: xrn 10.11