Skip to content
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

fix FLOOR behavior for values of "significance" that are not powers o… #65

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

patriciali
Copy link
Contributor

…f 10

#63 fixed a bug in CEILING. I realized FLOOR has the same problem. this PR fixes it

some code cleanliness changes, in addition:

  • CEILING implementation changes
    • move the Math.abs(significance) call to after we've actually parsed it as a number and checked for errors
    • use mode = (mode === undefined) ? 0 : mode instead of mode || 0 since checking truthiness of numbers is kind of an antipattern
  • FLOOR implementation changes
    • remove the check !(number > 0 && significance > 0) && !(number < 0 && significance < 0) for consistency for CEILING, which just silently takes the absolute value of significance
    • use exports.FLOOR.MATH = exports.FLOOR to be consistent with CEILING.MATH
    • remove mode === undefined check after we've already parsed it as number
  • change the ordering of FLOOR/FLOOR.MATH/FLOOR.PRECISE tests to be consistent with the analogous CEILING tests

@Y-- Y-- merged commit d13ec90 into sutoiku:master Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants