Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Preserve the floating-point precision of quantities in
uconvert
#754base: master
Are you sure you want to change the base?
Preserve the floating-point precision of quantities in
uconvert
#754Changes from 3 commits
13aae79
d1605dc
9059620
a20b45a
e156e51
d4e1e42
de56f8c
dc04b9b
bd81b57
8becfd6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Since
UnitConversionFactor
is (for now) always exactly equal to aFloat64
, it should hash the same. We should also implement==(::UnitConversionFactor, ::Real)
and==(::Real, ::UnitConversionFactor)
. However, since this type is only used internally, it probably doesn’t matter too much.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.
@sostock adjusted. Do you think the
==
withReal
is necessary? If so, I can add the methods and tests.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.
It probably isn’t necessary, since
==
orhash
is likely never used on this type. But I still thinkhash
andisequal
(which falls back to==
) should be consistent. So, I would either change backhash
to the old implementation (where the hashes are never equal to those of aFloat64
) or add the==
methods.I think we could actually remove the
hash
and==
methods and they would still be consistent using the fallback methods.