You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Base.zero(q::Q) where {T,Q<:Quantity{T}}=Quantity(zero(ustrip(q)), dimension(q))
59
-
Base.zero(::D) where {D<:Dimensions}=error("There is no such thing as an additive identity for a `Dimensions` object, as + is only defined for `Quantity`.")
60
-
Base.zero(::Type{Q}) where {Q<:Quantity} =error("Cannot create an additive identity for a `Quantity` type, as the dimensions are unknown. Please use `zero(::Quantity)` instead.")
61
-
Base.zero(::Type{D}) where {D<:Dimensions} =error("There is no such thing as an additive identity for a `Dimensions` type, as + is only defined for `Quantity`.")
Base.zero(::Dimensions)=error("There is no such thing as an additive identity for a `Dimensions` object, as + is only defined for `Quantity`.")
60
+
Base.zero(::Type{<:Quantity})=error("Cannot create an additive identity for a `Quantity` type, as the dimensions are unknown. Please use `zero(::Quantity)` instead.")
61
+
Base.zero(::Type{<:Dimensions})=error("There is no such thing as an additive identity for a `Dimensions` type, as + is only defined for `Quantity`.")
62
62
63
63
# Dimensionful 1:
64
-
Base.oneunit(q::Q) where {T,Q<:Quantity{T}}=Quantity(oneunit(ustrip(q)), dimension(q))
65
-
Base.oneunit(::Type{Q}) where {Q<:Quantity} =error("Cannot create a dimensionful 1 for a `Quantity` type without knowing the dimensions. Please use `oneunit(::Quantity)` instead.")
66
-
Base.oneunit(::D) where {D<:Dimensions}=error("There is no such thing as a dimensionful 1 for a `Dimensions` object, as + is only defined for `Quantity`.")
67
-
Base.oneunit(::Type{D}) where {D<:Dimensions} =error("There is no such thing as a dimensionful 1 for a `Dimensions` type, as + is only defined for `Quantity`.")
Base.oneunit(::Dimensions) =error("There is no such thing as a dimensionful 1 for a `Dimensions` object, as + is only defined for `Quantity`.")
66
+
Base.oneunit(::Type{<:Quantity})=error("Cannot create a dimensionful 1 for a `Quantity` type without knowing the dimensions. Please use `oneunit(::Quantity)` instead.")
67
+
Base.oneunit(::Type{<:Dimensions})=error("There is no such thing as a dimensionful 1 for a `Dimensions` type, as + is only defined for `Quantity`.")
0 commit comments