Open rawlik opened 7 years ago
It should be very easy to define a fallback as abs2(x::SIQuantity) = abs(x)^2
, but a more efficient implementation is probably something like
function abs2{T,m,kg,s,A,K,mol,cd,rad,sr}(x::SIQuantity{T,m,kg,s,A,K,mol,cd,rad,sr})
val = abs2(x.val)
SIQuantity{typeof(val),2*m,2*kg,2*s,2*A,2*K,2*mol,2*cd,2*rad,2*sr}(val)
end
A PR with this (and a couple of tests) would most likely get merged in no time ;)
It would be very interesting if this would work, as then one can propagate units through linear fits: