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

Zeros store negative #12

Closed
karasjoh000 opened this issue Mar 7, 2019 · 4 comments
Closed

Zeros store negative #12

karasjoh000 opened this issue Mar 7, 2019 · 4 comments
Labels

Comments

@karasjoh000
Copy link

Not sure if it is intended but zeros store negatives inside. When I print a zero fraction I get -0.

@karasjoh000
Copy link
Author

karasjoh000 commented Mar 7, 2019

not all zeros but I think after a number turns into a 0 from a negative on the Ops.

@karasjoh000
Copy link
Author

Although if it returns equals on -0 and 0 it should be fine. Did not have time to check yet.

@dnsl48
Copy link
Owner

dnsl48 commented Mar 7, 2019

yes, that's been intentional so far. We even have a separate method Fraction::neg_zero().

However, now I'm contemplating the actual benefits of having negative zeroes. Rust core float implementation does handle negative zeroes and zeroes as the same thing, so do we to be compatible. I'm not sure we need this any more. Perhaps worth deprecating and removing them.

@dnsl48 dnsl48 added the question label Mar 7, 2019
@dnsl48
Copy link
Owner

dnsl48 commented Mar 7, 2019

Although if it returns equals on -0 and 0 it should be fine. Did not have time to check yet.

Yes, they are equals. We have it covered with tests
https://github.com/dnsl48/fraction/blob/master/src/fraction/mod.rs#L2746

If you have any other questions or recommendations that we can consider when deciding on if it's worth deprecating negative zeroes and removing those, please feel free to leave them here and reopen or make a new issue.

Cheers

@dnsl48 dnsl48 closed this as completed Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants