PR #192 corrects the spec to match the implementations by doing floating point to integer conversion via truncation (round towards zero). Other rounding behaviors are sometimes useful.
Create an extension library for mathematics, e.g. math.*(), with at least the following functions:
PR #192 corrects the spec to match the implementations by doing floating point to integer conversion via truncation (round towards zero). Other rounding behaviors are sometimes useful.
Create an extension library for mathematics, e.g.
math.*()
, with at least the following functions:math.ceil(double) -> int
: rounds towards infinitymath.floor(double) -> int
: rounds toward negative infinitymath.round(double) -> int
: rounds "half away", i.e. rounds toward nearest integer, breaking ties by rounding away from zero.More behaviors are possible if needed, though this seems unlikely. See https://en.wikipedia.org/wiki/Rounding