🐛 use fuzzy comparison for floating point in const evaluation equality check #809
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes another small bug observed as part of #803, which only surfaced under macOS when using GCC as the compiler.
Turns out that GitHub's CodeQL was right after all and exact equality checks on floating point values can come back to bite you.
In this case, two computations of
std::tan(1.0)
resulted in values that were off by a single ULP.Although I am not 100% certain how this can even happen, this PR works around any such errors by using a fuzzy floating point comparison with an epsilon on the order of
10-12
.Checklist: