-
Notifications
You must be signed in to change notification settings - Fork 112
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
atol
used by isapprox
for affine units
#723
Comments
The case where the julia> isapprox(1K, 2K, atol=0.1°C)
true
julia> isapprox(1°C, 2°C, atol=0.1°C)
false IMO, these should both return julia> isapprox(20dBm, 21dBm, atol=10dBm) # equivalent to isapprox(20, 21, atol=10)
true
julia> isapprox(mW(20dBm), mW(21dBm), atol=mW(10dBm)) # equivalent to isapprox(100, 125.89…, atol=10)
false |
FWIW, over here we adhere strictly to "Temperature measurements can be either Kelvin or Celsius, temperature deltas must be in Kelvin", which Unitful nicely checks for us thanks to (I'm aware this isn't necessarily a very popular perspective...) EDIT: Ah, I guess it's #521 |
I also think that making (Making all comparisons between affine and linear quantities error, as proposed in #521, is something I consider breaking, since the current behavior is well-defined and consistent, although unexpected to some and therefore error-prone). |
Fair enough! |
As noted in #719 (comment), the specified
atol
is stripped of its units by callingustrip(unit(y), atol)
:Unitful.jl/src/quantities.jl
Line 254 in b80ab85
This means that the
atol
that is actually used depends on whether the units ofx
andy
are affine or not:The text was updated successfully, but these errors were encountered: