-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
make exp_m1 and ln_1p examples more representative of use #77099
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
With this commit, the examples for exp_m1 would fail if x.exp() - 1.0 is used instead of x.exp_m1().
With this commit, the examples for ln_1p would fail if (x + 1.0).ln() is used instead of x.ln_1p().
b51cc31
to
50d3ddc
Compare
r? @rust-lang/docs |
Honestly, I never use these functions so I have no idea if this is an improvement or not. |
As far as I know, both functions are there basically to provide more accuracy when the operand is close to zero, so my thinking was that the example should use an operand that is close to zero. And if someone tries to modify the examples to use the other ( |
I still have not used these functions and so don't know if it's an improvement, so I shouldn't be the reviewer. |
Nice, those are much better examples for these functions.
Do you think it would be good to show that in the examples as well? |
My concern is that maybe then the examples might become a bit too cluttered/daunting. At least I did not find a way to show this in the examples that satisfied me. |
Alright, makes sense. Thanks for the improvement. @bors r+ rollup |
📌 Commit 50d3ddc has been approved by |
make exp_m1 and ln_1p examples more representative of use With this PR, the examples for `exp_m1` would fail if `x.exp() - 1.0` is used instead of `x.exp_m1()`, and the examples for `ln_1p` would fail if `(x + 1.0).ln()` is used instead of `x.ln_1p()`.
make exp_m1 and ln_1p examples more representative of use With this PR, the examples for `exp_m1` would fail if `x.exp() - 1.0` is used instead of `x.exp_m1()`, and the examples for `ln_1p` would fail if `(x + 1.0).ln()` is used instead of `x.ln_1p()`.
make exp_m1 and ln_1p examples more representative of use With this PR, the examples for `exp_m1` would fail if `x.exp() - 1.0` is used instead of `x.exp_m1()`, and the examples for `ln_1p` would fail if `(x + 1.0).ln()` is used instead of `x.ln_1p()`.
Rollup of 7 pull requests Successful merges: - rust-lang#74622 (Add std::panic::panic_any.) - rust-lang#77099 (make exp_m1 and ln_1p examples more representative of use) - rust-lang#78526 (Strip tokens from trait and impl items before printing AST JSON) - rust-lang#78550 (x.py setup: Create config.toml in the current directory, not the top-level directory) - rust-lang#78577 (validator: Extend aliasing check to a call terminator) - rust-lang#78581 (Constantify more BTreeMap and BTreeSet functions) - rust-lang#78587 (parser: Cleanup `LazyTokenStream` and avoid some clones) Failed merges: r? `@ghost`
With this PR, the examples for
exp_m1
would fail ifx.exp() - 1.0
is used instead ofx.exp_m1()
, and the examples forln_1p
would fail if(x + 1.0).ln()
is used instead ofx.ln_1p()
.