-
Notifications
You must be signed in to change notification settings - Fork 14k
Add [f32]::sort_floats and [f64]::sort_floats
#93397
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
Conversation
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
|
Discussed on Zulip at https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/float.20total_cmp . |
This comment has been minimized.
This comment has been minimized.
|
They'll need distinct new lang items, just like |
f147c69 to
820a8ae
Compare
|
@cuviper Thanks, done. |
This comment has been minimized.
This comment has been minimized.
820a8ae to
5945acf
Compare
|
Marked as |
This comment has been minimized.
This comment has been minimized.
5945acf to
8313bdb
Compare
1f05d40 to
b16f09b
Compare
This comment has been minimized.
This comment has been minimized.
b16f09b to
aea0cc0
Compare
|
...works better if I actually sort the |
This comment has been minimized.
This comment has been minimized.
aea0cc0 to
37ad800
Compare
This comment has been minimized.
This comment has been minimized.
|
This looks like the mir-opt segfault hitting CI for various PRs right now (#93447); waiting for that to get sorted out before retrying. |
[f32]::sort_floats and [f64]::sort_floats[f32]::sort and [f64]::sort
This comment has been minimized.
This comment has been minimized.
It's inconvenient to sort a slice or Vec of floats, compared to sorting integers. To simplify numeric code, add a convenience method to `[f32]` and `[f64]` to sort them using `sort_unstable_by` with `total_cmp`.
37ad800 to
bded8fc
Compare
|
I've rebased this to eliminate the merge conflicts. Thanks to #94963 this got a lot simpler. |
|
I continue to believe that this doesn't hide NaN behavior any more than However, if people feel that a name like |
|
r? rust-lang/compiler |
|
@rustbot r? rust/compiler |
|
Not compiler, @rustbot r? rust/libs-api |
|
@rustbot r? rust-lang/libs-api |
|
@rustbot r? rust-lang/library |
|
r? @rust-lang/libs-api |
|
(╯°□°)╯︵ ┻━┻ |
|
I find these questionably useful, but I guess we can defer this discussion until stabilization. @bors r+ |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (ed793d8): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
It's inconvenient to sort a slice or Vec of floats, compared to sorting integers. To simplify numeric code, add a convenience method to
[f32]and[f64]to sort them usingsort_unstable_bywithtotal_cmp.