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

Floor and ceiling swapped in rounding mode explanation #7

Closed
Merlin04 opened this issue Sep 30, 2022 · 2 comments · Fixed by #8
Closed

Floor and ceiling swapped in rounding mode explanation #7

Merlin04 opened this issue Sep 30, 2022 · 2 comments · Fixed by #8

Comments

@Merlin04
Copy link

Merlin04 commented Sep 30, 2022

On https://matloka.com/blog/floating-point-101#the-more-or-less, the first two rounding modes are described as:

roundTowardPositive – takes the floor (i.e. towards positive infinity),
roundTowardNegative – takes the ceiling (i.e. towards negative infinity),

Shouldn't floor and ceiling be swapped, since ceiling rounds up and floor rounds down? (I could very well be wrong on this, if so just let me know)

@Twixes
Copy link
Owner

Twixes commented Oct 2, 2022

That's a good catch, thanks! You're right, I must have reversed those points at some point and missed that the descriptions got out of sync. Fixed that in #8.

@Merlin04
Copy link
Author

Merlin04 commented Oct 3, 2022

Awesome, thanks so much! Your article was super helpful for studying for CS class, if you ever want to expand on this in the future I think an explanation of math with floats (addition, multiplication, etc) in your style would be a very good read.

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 a pull request may close this issue.

2 participants