fix(span): f64::content_eq return false for 0 and -0#9007
Merged
graphite-app[bot] merged 1 commit intomainfrom Feb 10, 2025
Merged
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #9007 will not alter performanceComparing Summary
|
Member
Merge activity
|
Fixes #8982. Previously `0f64.content_eq(-0f64)` returned `true`. Now it returns `false`. This also affects the behavior for `NaN`. Previously `f64::NAN.content_eq(f64::NAN)` returned `false`. Now it returns `true`. But it's complicated: ```rs f64::NAN.content_eq(f64::NAN) == true f64::NAN.content_eq(-f64::NAN) == false f64::NAN.content_eq(--f64::NAN) == true ``` This does *not* align with JS's `Object.is` which returns `true` for *any* two `NaN` values. If this matters, we could instead implement `f64::content_eq` as: ```rs if self.is_nan() && other.is_nan() { true } else { self.to_bits() == other.to_bits() } ``` But this generates quite a lot of assembly for all `f64` values, just to cover this small edge case with `NaN`: https://godbolt.org/z/q9zYodn4e So I suggest that we go with it as in this PR for now, and see if `NaN` causes us problems in reality or not.
9124225 to
81bed37
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Fixes #8982.
Previously
0f64.content_eq(-0f64)returnedtrue. Now it returnsfalse.This also affects the behavior for
NaN. Previouslyf64::NAN.content_eq(f64::NAN)returnedfalse. Now it returnstrue. But it's complicated:This does not align with JS's
Object.iswhich returnstruefor any twoNaNvalues.If this matters, we could instead implement
f64::content_eqas:But this generates quite a lot of assembly for all
f64values, just to cover this small edge case withNaN: https://godbolt.org/z/q9zYodn4eSo I suggest that we go with it as in this PR for now, and see if
NaNcauses us problems in reality or not.