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

fix: correctly parse small floats, use correct comparison in add #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zbaylin
Copy link
Contributor

@zbaylin zbaylin commented Aug 18, 2023

This fixes two bugs:

  • When serializing small floats, string_of_float uses scientific notation which the current parser doesn't account for. Furthermore, there is no way to specify the amount of precision in the resultant string.
    • Solution: use Printf.sprintf to serialize the string with the precision being context.prec
  • When adding numbers, we check to see if they are equal but of opposite sign. This is done using string comparisons which do not take into account leading 0s that can be added by normalize
    • Solution: parse the coefficients as Z.ts earlier and use those for the comparison

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 this pull request may close these issues.

None yet

1 participant