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

divide_to_string panics on negative dividend #43

Closed
csarn opened this issue Jul 30, 2021 · 2 comments · Fixed by #44
Closed

divide_to_string panics on negative dividend #43

csarn opened this issue Jul 30, 2021 · 2 comments · Fixed by #44

Comments

@csarn
Copy link

csarn commented Jul 30, 2021

Using version 0.8.0, this testcase panics:

    #[test]
    fn divide() {
        fraction::division::divide_to_string(-1, 1, 10, false);
    }

Panic:

thread 'tests::divide' panicked at 'internal error: entered unreachable code', C:.cargo\registry\src\github.com-1ecc6299db9ec823\fraction-0.8.0\src\division.rs:350:21

@dnsl48
Copy link
Owner

dnsl48 commented Aug 5, 2021

hi @csarn,
Thank you for reporting the issue!
I think we missed that bit in the documentation, but these functions do not work with negative numbers.
We may need to document this limitation better.

@csarn
Copy link
Author

csarn commented Aug 26, 2021

Thanks for documenting this! I also worked around this issue by using fraction for the absolute values and adding a minus sign to the resulting string when applicable.

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