Created
June 23, 2020 11:14
-
-
Save czj/bb2c905840b4c2a2951918f9961e4b15 to your computer and use it in GitHub Desktop.
Ruby ceil() round() floor() with negative arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10.32.round(-1) | |
# 10 | |
11.32.round(-1) | |
# 10 | |
19.32.round(-1) | |
# 20 | |
19.32.ceil(-1) | |
# 20 | |
1919.32.ceil(-1) | |
# 1920 | |
1919.32.round(-1) | |
# 1920 | |
119.32.round(-1) | |
# 120 | |
1419.32.round(-1) | |
# 1420 | |
1414.32.round(-1) | |
# 1410 | |
1414.32.ceil(-1) | |
# 1420 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment