Impressum/Kontaktparent nodes: implemented functions
⌈ Ceiling
testAplCeiling
| table a result |
"http://www.microapl.co.uk/apl_help/ch_020_020_090.htm"
"data aplCeiling"
"The number or numbers in the data argument are rounded up to the next whole number."
self assert: 45.9 asApl aplCeiling aplContents = 46.
"Note effect of rounding up on a negative number"
self assert: -3.8 asApl aplCeiling aplContents = -3.
"Each number in a vector is rounded up"
self assert: #(1.2 -0.3 99.1 2.8) asApl aplCeiling aplContents = #(2 0 100 3).
"0.5 is subtracted from each number before ceiling is applied, producing 'true' rounding"
self assert: (-0.5 asApl + #(1.2 -0.3 9.1 2.8)) aplCeiling aplContents = #(1 0 9 3).
"Each number in TABLE is rounded up"
table := #( 62.8 3.0 -2.9 9.1 7.3 0.01) asApl aplReshape: #(3 2) .
self assert: table ceiling aplContents = #( 63 3 -2 10 8 1).
"Each element is rounded up"
a:= (Array with:#(1.7 11.99 -2.3) asApl with:(#(-1.1 17.3 -0.1 103.4) asApl aplReshape:#(2 2)))asApl.
result := (Array with:#(2 12 -2) asApl with:(#(-1 18 0 104) asApl aplReshape:#(2 2)))asApl.
self assert: result = ( a aplCeiling).