add #DFP for Decimal Fixed Precision numeric output
This commit is contained in:
parent
67bb06dd8f
commit
687012b7df
|
|
@ -740,6 +740,10 @@ CREATE PNO-POINTER PNO-BUFFER-END ,
|
||||||
|
|
||||||
: #S ( ud -- ) 10 #SB ;
|
: #S ( ud -- ) 10 #SB ;
|
||||||
|
|
||||||
|
\ Decimal Fixed Precision with u digits after the decimal point
|
||||||
|
\ Example: 12345 0 <# 3 #DFP #> ≡ "12.345"
|
||||||
|
: #DFP ( ud1 u -- ud2 ) BEGIN ?DUP WHILE 1- >R # R> REPEAT [CHAR] . HOLD #S ;
|
||||||
|
|
||||||
\ Display the unsigned number at the top of the stack
|
\ Display the unsigned number at the top of the stack
|
||||||
: DU. ( ud -- "<digits>" ) <# #S #> TYPE ;
|
: DU. ( ud -- "<digits>" ) <# #S #> TYPE ;
|
||||||
: U. ( u -- "<digits>" ) 0 DU. ;
|
: U. ( u -- "<digits>" ) 0 DU. ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue