-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add single argument version of isapprox
#32305
Conversation
@fredrikekre, why are you confused? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Could you add some tests and a NEWS entry?
base/floatfuncs.jl
Outdated
|
||
Create a function that compares its argument to x using ≈, i.e. a function equivalent to y -> y ≈ x. | ||
|
||
The keyword arguments supported here are the same as those in [`isapprox`](@ref). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Documenter ref there is self-referential. Probably doesn't matter a whole lot, but you could have it point to the other method specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you do that - with the method signature? So something like [\
isapprox(1, 2)`]`?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% on the syntax, but I think it'd be something like
[`isapprox`](@ref Base.isapprox(::Any, ::Any))
You'd probably want to build the documentation locally to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just say "The keyword arguments supported are the same as those in 2-argument isapprox
."
Co-Authored-By: Alex Arslan <ararslan@comcast.net>
Co-Authored-By: Alex Arslan <ararslan@comcast.net>
Thanks for the review, @ararslan! |
I'm surprised not to find this pattern - like Line 8 in 90d481e
|
Codecov Report
@@ Coverage Diff @@
## master #32305 +/- ##
=========================================
Coverage ? 75.74%
=========================================
Files ? 380
Lines ? 66442
Branches ? 0
=========================================
Hits ? 50326
Misses ? 16116
Partials ? 0
Continue to review full report at Codecov.
|
Co-Authored-By: Alex Arslan <ararslan@comcast.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! I would find this useful :)
Is there any reason not to use the Fix2
machinery, same as with isequal
?
Co-Authored-By: Nick Robinson <npr251@gmail.com>
If the intention is approximate numerical equality, then |
Ready to merge. |
Thanks. Good point :) Somewhat off topic here (sorry), but I was thinking of the case where |
Adds a single argument version of isapprox or ≈, in the same vein as the single argument version of
==
.