On 19/10/2026 12:29 pm, dxf wrote:
> 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 )
BTW for this use SCALE can be simplified to:
: SCALE ( r1 n -- r2 ) >r f10. r> f^n f* ;
as only numbers with powers <= precision would be involved.
In REPRESENT SCALE had to deal multipliers exceeding 10^308.