floor
Definition: | atom x2 = floor(atom x1) |
Description: | Return the greatest integer less than or equal to x1. (Round down to an integer, towards -infinity.) |
Comments: |
This function may be applied to an atom or sq_floor() to all elements of a
sequence. The rules for sequence operations apply.
floor(a/b) is treated specially for performance reasons, as there is no point storing a floating point intermediate/parameter when the fractional part gets discarded immediately. There is a corresponding sq_floor_div() sequence operation to match that performance enhancement, which yields exactly the same results as sq_floor(sq_div()), only faster. |
Example: |
y = sq_floor({0.5, -1.6, 9.99, 100}) -- y is {0, -2, 9, 100} |
Implementation: | via :%opFloor in builtins\VM\pUnary.e (an autoinclude) |
See Also: | remainder, ceil, trunc |