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 the total order comparison for arbitrary floating point #703

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

lsrcz
Copy link
Collaborator

@lsrcz lsrcz commented Jun 7, 2024

This pull request fixes the total order comparison for arbitrary floating-point numbers and resolves issue #702.

For arbFPIsEqualObjectH, the bfIsInf clause has been removed because the == operator for BitFloat can handle the comparison correctly.

For arbFPCompareObjectH, the bfCompare function from libBF is used. This function provides a total order that differentiates between +0 and -0, while treating all NaN values as equal.

@lsrcz lsrcz added the Bug label Jun 7, 2024
@lsrcz lsrcz requested a review from LeventErkok June 7, 2024 03:10
Copy link
Owner

@LeventErkok LeventErkok left a comment

Choose a reason for hiding this comment

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

Ah excellent point about bfIsInf, and use of bfCompare (which I wasn't aware of) seems like the right choice. It's a bit annoying that the order I picked for regular floats differs, but it doesn't really matter.

@LeventErkok LeventErkok merged commit 6b1a68f into LeventErkok:master Jun 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants