Skip to content
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

Merged
merged 2 commits into from
Oct 31, 2020

Conversation

tspiteri
Copy link
Contributor

@tspiteri tspiteri commented Sep 23, 2020

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().

@rust-highfive
Copy link
Collaborator

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 23, 2020
@tspiteri tspiteri changed the title make exp_m1 examples more representative of use make exp_m1 and ln_1p examples more representative of use Sep 23, 2020
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().
@sfackler
Copy link
Member

r? @rust-lang/docs

@steveklabnik
Copy link
Member

Honestly, I never use these functions so I have no idea if this is an improvement or not.

@tspiteri
Copy link
Contributor Author

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 (exp and ln) functions instead, they will be able to see what the point of these functions is.

@jyn514 jyn514 added A-floating-point Area: Floating point numbers and arithmetic A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Oct 13, 2020
@Dylan-DPC-zz
Copy link

r? @steveklabnik

@steveklabnik
Copy link
Member

I still have not used these functions and so don't know if it's an improvement, so I shouldn't be the reviewer.

@m-ou-se m-ou-se assigned m-ou-se and unassigned steveklabnik Oct 30, 2020
@m-ou-se
Copy link
Member

m-ou-se commented Oct 30, 2020

Nice, those are much better examples for these functions.

would fail if __ is used instead of __

Do you think it would be good to show that in the examples as well?

@tspiteri
Copy link
Contributor Author

would fail if __ is used instead of __

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.

@m-ou-se
Copy link
Member

m-ou-se commented Oct 30, 2020

Alright, makes sense.

Thanks for the improvement.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 30, 2020

📌 Commit 50d3ddc has been approved by m-ou-se

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 30, 2020
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Oct 30, 2020
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()`.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Oct 31, 2020
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()`.
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Oct 31, 2020
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()`.
This was referenced Oct 31, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 31, 2020
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`
@bors bors merged commit 4ebd553 into rust-lang:master Oct 31, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 31, 2020
@tspiteri tspiteri deleted the exp_m1-examples branch October 31, 2020 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-floating-point Area: Floating point numbers and arithmetic S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants