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

Consistent division by zero semantics #132

Closed
oscbyspro opened this issue Jun 11, 2023 · 0 comments
Closed

Consistent division by zero semantics #132

oscbyspro opened this issue Jun 11, 2023 · 0 comments
Labels
addition oh, so shiny! documentation please write it down subtraction huh? where did it go?
Milestone

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Jun 11, 2023

When dividing by zero, Swift has the semantics of returning the truncated (if needed) dividend. Currently, I'm returning the divisor for single digit remainder operations because the dividend may not fit in the remainder type. At some point, I changed this in Numberick when I concluded that being consistent is better. These values are junk by definition, but consistent junk is better than inconsistent junk.

TL;DR: division by zero will return the truncated dividend similar to Swift's stdlib.

@oscbyspro oscbyspro added documentation please write it down addition oh, so shiny! subtraction huh? where did it go? labels Jun 11, 2023
@oscbyspro oscbyspro added this to the v3.0.0 milestone Jun 11, 2023
@oscbyspro oscbyspro changed the title Consistent division by zero semantic Consistent division by zero semantics Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition oh, so shiny! documentation please write it down subtraction huh? where did it go?
Projects
None yet
Development

No branches or pull requests

1 participant