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 ;
On 10/18/2026 6:09 PM, dxf wrote:
It appears ROUND() is a fairly common function.-a I created it using[..]
a factor from REPRESENT.-a Are there other ways implementing it?
\ SCALE ( r1 n -- r2 )-a scale r1 left/right by n digits
: ROUND ( r1 n -- r2 )
-a-a >r-a fbad? if-a 2drop-a rdrop-a end
-a-a r@ scale-a fround-a r> negate scale ;
Interesting. Please show your current SCALE and fbad? words.
-marcel
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.-a I created it using[..]
a factor from REPRESENT.-a Are there other ways implementing it?
\ SCALE ( r1 n -- r2 )-a scale r1 left/right by n digits
: ROUND ( r1 n -- r2 )
-a-a >r-a fbad? if-a 2drop-a rdrop-a end
-a-a r@ scale-a fround-a 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 )
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 54:30:57 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,563 |