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 IEEE 754 comparison ((>) and (>=)) for BigFloat when NaN is involved #32

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

lsrcz
Copy link
Contributor

@lsrcz lsrcz commented Jun 5, 2024

This pull request fixes the (>) and (>=) operator of the BigFloat, which aren't IEEE 754 complaint when NaN is involved.

The original implementation relies on the default implementation of the (>) and (>=). Unfortunately, the base library implemented them as negation of (<) and (<=), which would make nan > 1 or 1 > nan evaluate to True.

@RyanGlScott
Copy link
Contributor

Thanks, @lsrcz! Would you be willing to add a test case here that demonstrates that the fix works?

@lsrcz
Copy link
Contributor Author

lsrcz commented Jun 5, 2024

Sure, let me write some test cases soon.

@lsrcz
Copy link
Contributor Author

lsrcz commented Jun 5, 2024

Hi @RyanGlScott , I've added some tests for the comparison operators with NaN.

@RyanGlScott RyanGlScott merged commit 280c5bd into GaloisInc:master Jun 5, 2024
6 checks passed
RyanGlScott added a commit that referenced this pull request Jun 5, 2024
@RyanGlScott
Copy link
Contributor

I've uploaded libBF-0.6.8 to Hackage with these changes.

@lsrcz
Copy link
Contributor Author

lsrcz commented Jun 5, 2024

Thank you for all the quick response!

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.

2 participants