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 Float.Extra.aboutEqual behaviour with infinities #51

Conversation

ianmackenzie
Copy link
Contributor

This is a precursor to #49 - as I started looking at the code to make sure aboutEqual and equalWithin had consistent behaviour I noticed that aboutEqual currently treats positive and negative infinity as equal! (Since isInfinite returns true for both.)

  • Fix comparison so that it does not treat positive infinity as equal to negative infinity
  • Add some tests to check this
  • For good measure, test to make sure comparisons against NaN also behave as expected (always return false)
  • Tweak test code style to use Float.Extra.aboutEqual qualified like everything else

- Fix comparison so that it does not treat positive infinity as equal to negative infinity
- Add some tests to check this
- For good measure, test to make sure comparisons against NaN also behave as expected (always return false)
- Tweak test code style to use Float.Extra.aboutEqual qualified like everything else
Copy link
Collaborator

@gampleman gampleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, greatly appreciated!

@gampleman gampleman merged commit 59a6247 into elmcraft:master Mar 20, 2024
2 checks passed
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.

3 participants