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

Verbalize definition of isapprox in docstring #39765

Merged
merged 2 commits into from
Apr 3, 2021

Conversation

mschauer
Copy link
Contributor

Did I take the correct emphasis style for or?

@mschauer mschauer changed the title Verbalize definition of isapprox Verbalize definition of isapprox in docstring Feb 20, 2021
Copy link
Contributor

@oxinabox oxinabox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a couple of examples while here?
Especially ones with big human friendly numbers like

isaporox(10, 12; atol=5)

@mschauer
Copy link
Contributor Author

Not sure if making it "too" easy will be a break with the docstring style, but...

7 and 9 have the same absolute distance as 107, 109, namely 2 = |9-7|. Likewise 0.9, 1.0 and 90, 100 have the same relative distance, namely 0.1 = |100-90|/100 = (1.0-0.9)/1.0. Therefore isapprox(7, 9, atol=2) == true and isapprox(90, 100, rtol=0.099) == false.

@oxinabox
Copy link
Contributor

Or even just:

julia> isapprox(0.1, 0.15; atol=0.05)
true


julia> isapprox(0.1, 0.15; rtol=0.5)
true

julia> isapprox(0.1, 0.15; rtol=0.34)
true

julia> isapprox(0.1, 0.15; rtol=0.33)
false

@mschauer
Copy link
Contributor Author

Taking to points with relative distance 1/3 and do rtol=0.33, rtol=0.34 is a good idea for the example to avoid tricky issues with rounding errors when rtol exactly equals the relative distance

@simeonschaub
Copy link
Member

LGTM

@simeonschaub simeonschaub merged commit aaf2b9f into JuliaLang:master Apr 3, 2021
@mschauer mschauer deleted the patch-3 branch April 3, 2021 13:42
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
* Verbalize definition of isapprox

* More examples for isapprox
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
* Verbalize definition of isapprox

* More examples for isapprox
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
* Verbalize definition of isapprox

* More examples for isapprox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants