fix floor/ceiling words
parent
cd978d822e
commit
9835ce4b03
|
@ -39,7 +39,7 @@ math namespaces parser strings words ;
|
||||||
: array-constructor ( width -- )
|
: array-constructor ( width -- )
|
||||||
#! Make a word <foo-array> ( n -- byte-array ).
|
#! Make a word <foo-array> ( n -- byte-array ).
|
||||||
"struct-name" get "-array" cat2 constructor-word
|
"struct-name" get "-array" cat2 constructor-word
|
||||||
swap cell / ceiling [ * <byte-array> ] cons
|
swap [ * <byte-array> ] cons
|
||||||
define-compound ;
|
define-compound ;
|
||||||
|
|
||||||
: define-nth ( width -- )
|
: define-nth ( width -- )
|
||||||
|
|
|
@ -39,5 +39,5 @@ M: ratio /i scale /i ;
|
||||||
M: ratio /f scale /f ;
|
M: ratio /f scale /f ;
|
||||||
|
|
||||||
M: ratio truncate >fraction /i ;
|
M: ratio truncate >fraction /i ;
|
||||||
M: ratio floor >fraction /mod dup 0 < [ 1 - ] when ;
|
M: ratio floor >fraction /i dup 0 < [ 1 - ] when ;
|
||||||
M: ratio ceiling >fraction /mod dup 0 > [ 1 + ] when ;
|
M: ratio ceiling >fraction /i dup 0 > [ 1 + ] when ;
|
||||||
|
|
Loading…
Reference in New Issue