APLX Help : Help on APL language : APL Primitives : ⌊ Floor




Oneargument form See also twoargument form Lesser of The number or numbers in the righthand argument are rounded down to the next whole number. ⌊ 45.9 45 ⌊ ¯2.3 (Note the effect on a negative number) ¯3 ⌊ 1.2 ¯0.3 99.1 2.8 (Each number in a vector is rounded 1 ¯1 99 2 down) ⌊0.5+1.2 ¯0.3 99.1 2.8 (0.5 is added to each number before 1 0 99 3 ⌊ is applied to it, ensuring 'true' rounding) TABLE 62.8 3.0 ¯2.9 9.1 7.3 0.01 ⌊ TABLE (Each number in TABLE is rounded down) 62 3 ¯3 9 7 0 ⌊(¯0.1 ¯10.1 11.3 7.4) ( 2 2⍴¯0.3 2.8 99.1 ¯2.3) ¯1 ¯11 11 7 ¯1 2 (Each element is rounded down) 99 ¯3 Comparison toleranceWhen acting on a number which is very close to but slightly smaller than an integer, Floor may round up to that integer rather than round down. This will happen if the argument is within comparison tolerance of the integer, and is therefore considered in APL to be equal to it. Effect on internal representationIf the argument to Floor or Ceiling is an array which is held internally in boolean or integer form, then the result will always be represented in integer form and the numbers in the array will be unchanged. If the argument to Floor or Ceiling is internally in floatingpoint form, then in general, provided all the numbers within the argument are in the range of numbers which can be represented as integers, the result will internally be represented as integers rather than floating points. Floor or Ceiling can therefore be used to force the internal representation of numbers to integer form: X←3.0 100.0 ¯20.0 ⎕DR X 3 Y←⌊X ⎕DR Y 2 X 3 100 ¯20 Y 3 100 ¯20 X=Y 1 1 1 In this example, X is held internally in floatingpoint format, but Y is held internally in integer format. The values of the array elements are, however, equal. See Differences between 32bit and 64bit implementations of APLXIn the 32bit version of APLX, numbers can be represented as integers if they are in the range In the 64bit APLX64 interpreter, numbers can be represented as integers if they are in the range In this example using APLX64, X←2*53 X 9007199254740992 ⎕DR X 2 Y←X×1.0 Y 9.007199255E15 ⎕DR Y 3 ⌊Y 9.007199255E15 ⎕DR ⌊Y 3 ⌊Y1 9007199254740991 ⎕DR ⌊Y1 2 

APLX Help : Help on APL language : APL Primitives : ⌊ Floor

Copyright © 19962010 MicroAPL Ltd