-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension functions for rounding #193
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: