We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
one(1u"kg")
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Example below:
julia> using DynamicQuantities julia> zero(1u"kg") 0.0 kg julia> one(1u"kg") 1.0 julia> zero(1u"kg") |> dimension kg julia> one(1u"kg") |> dimension # nothing displayed
I wonder why dimensions for the results of zero and one functions are different. Is it intentional or a bug?
zero
one
The text was updated successfully, but these errors were encountered:
This is the difference between one and oneunit. See https://docs.julialang.org/en/v1/base/numbers/#Base.oneunit
If you want a quantity that is of the same type as x, or of type T, even if x is dimensionful, use oneunit instead.
The way these are defined is that one is a multiplicative identity and zero is an additive identity. This is why one does not have units.
Sorry, something went wrong.
@liuyxpp on #136 you can find an alternative dimensions type that permits zero(::Type)
zero(::Type)
No branches or pull requests
Example below:
I wonder why dimensions for the results of
zero
andone
functions are different. Is it intentional or a bug?The text was updated successfully, but these errors were encountered: