Skip to content

[Core] Add Utility for Floating Point Comparison #13433

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

matekelemen
Copy link
Contributor

Working with finite precision floating point numbers is ugly. Here's a utility to help with comparisons that's more robust than what we have right now.

see https://stackoverflow.com/a/32334103/12350793

FYI @aronnoordam

@loumalouomega
Copy link
Member

I am OK with it

@aronnoordam
Copy link
Member

aronnoordam commented May 21, 2025

can you add a test case which would fail when comparing 2 floats with a less robust method?

e.g. : 0.1+0.2 == 0.3

and the stackoverflow example

@matekelemen
Copy link
Contributor Author

can you add a test case which would fail when comparing 2 floats with a less robust method?

e.g. : 0.1+0.2 == 0.3

and the stackoverflow example

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants