šŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.forth
Article #133

Re: ROUND function

#133
From: dxf
Date: Mon, 19 Oct 2026 01:29
21 lines
1379 bytes
On 19/10/2026 3:47 am, marcel hendrix wrote:
> On 10/18/2026 6:09 PM, dxf wrote:
> 
>> It appears ROUND() is a fairly common function.Ā  I created it using
>> a factor from REPRESENT.Ā  Are there other ways implementing it?
>>
>>
>> \ SCALE ( r1 n -- r2 )Ā  scale r1 left/right by n digits
>>
>> : ROUND ( r1 n -- r2 )
>> Ā Ā  >rĀ  fbad? ifĀ  2dropĀ  rdropĀ  end
>> Ā Ā  r@ scaleĀ  froundĀ  r> negate scale ;
> [..]
> 
> Interesting. Please show your current SCALE and fbad? words.
> -marcel

https://pastebin.com/skQArj3E

(If F^N looks familiar, I adapted it from JVN's dd^n )
Technical Details
Message-ID: <6ad57278$1@news.ausics.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mail
References: <6ad4ef23$1@news.ausics.net> <11b2t7k$229ps$1@dont-email.me>

Show Full Headers
Complete Article Headers
Date: Mon, 19 Oct 2026 12:29:27 +1100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: ROUND function
Newsgroups: comp.lang.forth
References: <6ad4ef23$1@news.ausics.net> <11b2t7k$229ps$1@dont-email.me>
Content-Language: en-GB
From: dxf <dxforth@gmail.com>
In-Reply-To: <11b2t7k$229ps$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: news.ausics.net
Message-ID: <6ad57278$1@news.ausics.net>
Organization: Ausics - https://newsgroups.ausics.net
Lines: 21
X-Complaints: abuse@ausics.net
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mail