-
Notifications
You must be signed in to change notification settings - Fork 14.1k
float::clamp: make treatment of signed zeros unspecified #149238
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
|
I have the unfortunate pleasure of working on a project where the sign of 0.0 matters. Adding documentation for what Rust guarantees is a very positive step. For functions where the sign is ignored, it would be good to also point to alternative functions where -0.0 < +0.0, if they exist, or mention that the functionality can be implemented in some way |
|
I don't think we should guarantee that these compare equal since that would rule out the ability to use the much more efficient |
cc92d4a to
d629308
Compare
|
@Amanieu something like this? |
d629308 to
a032dd8
Compare
This comment has been minimized.
This comment has been minimized.
a032dd8 to
69d3218
Compare
|
@bors r+ rollup |
Rollup of 8 pull requests Successful merges: - #149238 (float::clamp: make treatment of signed zeros unspecified) - #149270 (implement `Iterator::{exactly_one, collect_array}`) - #149295 (Suggest _bytes versions of endian-converting methods) - #149332 (fix rustdoc search says “Consider searching for "null" instead.” #149324) - #149349 (Fix typo in comment.) - #149353 (Tidying up UI tests [3/N]) - #149355 (Document that `build.description` affects symbol mangling and crate IDs) - #149360 (Enable CI download for windows-gnullvm) r? `@ghost` `@rustbot` modify labels: rollup
|
Doesn't this require some sort of team decision, since it fixes a previously undescribed part of the API for |
Rollup merge of #149238 - RalfJung:clamp-signed-zeros, r=Amanieu float::clamp: make treatment of signed zeros unspecified Fixes #83984 by explicitly documenting that we do not specify the treatment of signed zeros in `clamp`. `@rust-lang/libs-api` Is this what you'd like to see? Cc `@tgross35` `@thomcc`
|
Isn't non-deterministic return value pretty much a non-guarantee? |
|
Yeah, so people might reasonably disagree and say we should guarantee something.
But I guess this PR does not commit us to anything we can't take back (other than "the return value will be one of the arguments").
|
|
FWIW this was actually discussed in the libs-api meeting this week and it was a team decision to make this change to the docs. |
|
Ah, thanks for clarifying. :) |
Fixes #83984 by explicitly documenting that we do not specify the treatment of signed zeros in
clamp. @rust-lang/libs-api Is this what you'd like to see?Cc @tgross35 @thomcc