We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c38479 commit 3b334aeCopy full SHA for 3b334ae
src/systems/validation.jl
@@ -22,7 +22,9 @@ function get_units(x::Symbolic)
22
elseif x isa Add # Cannot simply add the units b/c they may differ in magnitude (eg, kg vs g)
23
terms = get_units.(arguments(x))
24
firstunit = unit(terms[1])
25
- @assert all(map(x -> ustrip(firstunit, x) == 1, terms[2:end]))
+ for other in terms[2:end]
26
+ unit(other) == firstunit || throw(ArgumentError("Units mismatch: [$x] with units [$terms]."))
27
+ end
28
return 1 * firstunit
29
elseif operation(x) == Symbolics._mapreduce
30
if x.arguments[2] == +
0 commit comments