-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
variable-precision float operations can differ depending on optimization levels #124609
Conversation
I don't think this is a good idea. Why should libm functions be privileged in this way? They ought to be treated as ordinary library calls. |
This describes the current reality. Feel free to make a proposal for changing our semantics, but I don't think that should block documenting the current semantics. In particular this is future compatible with changing them later to be optimization-independent.
Also note that we are not really privileging anything here. What we are effectively saying is that these functions are returning a result with arbitrary nondeterministic precision. It then follows as a consequence that the precision can depend on host, target, compiler version, flags, or literally anything else. This is generally always the case when a function says that there are multiple possible results, so there's nothing special about libm functions here. It's just something people are also often confused by so it may be worth explaining these unexpected consequences of non-determinism.
Maybe we should mention the non-determinism more explicitly.
|
How about something like "The precision of this function is non-deterministic, meaning each call to this function may return a value with a different precision even if given the same inputs"? |
7de46e5
to
8a012c0
Compare
Yeah, something like that -- I updated the PR. The section title "Platform-specific precision" doesn't make a lot of sense any more now, since precision is not "specific" to any platform, so I changed that as well. |
Works for me! @bors r+ rollup |
variable-precision float operations can differ depending on optimization levels Follow-up to rust-lang#121793 and rust-lang#118217 that accounts for optimizations changing the precision of these functions. Fixes rust-lang#109118 Fixes rust-lang#71355
Ah, I like this a lot better. At least the danger of using them is much clearer now. |
variable-precision float operations can differ depending on optimization levels Follow-up to rust-lang#121793 and rust-lang#118217 that accounts for optimizations changing the precision of these functions. Fixes rust-lang#109118 Fixes rust-lang#71355
Rollup of 8 pull requests Successful merges: - rust-lang#124412 (io safety: update Unix explanation to use `Arc`) - rust-lang#124441 (String.truncate comment microfix (greater or equal)) - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS) - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature) - rust-lang#124607 (`rustc_expand` cleanups) - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels) - rust-lang#124610 (Tweak `consts_may_unify`) - rust-lang#124612 (Add support for inputing via stdin with run-make-support) r? `@ghost` `@rustbot` modify labels: rollup
variable-precision float operations can differ depending on optimization levels Follow-up to rust-lang#121793 and rust-lang#118217 that accounts for optimizations changing the precision of these functions. Fixes rust-lang#109118 Fixes rust-lang#71355
Rollup of 7 pull requests Successful merges: - rust-lang#124441 (String.truncate comment microfix (greater or equal)) - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS) - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature) - rust-lang#124607 (`rustc_expand` cleanups) - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels) - rust-lang#124610 (Tweak `consts_may_unify`) - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription) Failed merges: - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#123480 (deref patterns: impl `DerefPure` for more std types) - rust-lang#124412 (io safety: update Unix explanation to use `Arc`) - rust-lang#124441 (String.truncate comment microfix (greater or equal)) - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS) - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature) - rust-lang#124607 (`rustc_expand` cleanups) - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels) - rust-lang#124610 (Tweak `consts_may_unify`) - rust-lang#124626 (const_eval_select: add tracking issue) - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription) Failed merges: - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124609 - RalfJung:float-precision, r=cuviper variable-precision float operations can differ depending on optimization levels Follow-up to rust-lang#121793 and rust-lang#118217 that accounts for optimizations changing the precision of these functions. Fixes rust-lang#109118 Fixes rust-lang#71355
@bors r- |
Follow-up to #121793 and #118217 that accounts for optimizations changing the precision of these functions.
Fixes #109118
Fixes #71355