11for (type, base_type, _) in ABSTRACT_QUANTITY_TYPES
22 @eval begin
33 function Base.:* (l:: $type , r:: $type )
4- l, r = promote (l, r)
4+ l, r = promote_except_value (l, r)
55 new_quantity (typeof (l), ustrip (l) * ustrip (r), dimension (l) * dimension (r))
66 end
77 function Base.:/ (l:: $type , r:: $type )
8- l, r = promote (l, r)
8+ l, r = promote_except_value (l, r)
99 new_quantity (typeof (l), ustrip (l) / ustrip (r), dimension (l) / dimension (r))
1010 end
1111 function Base. div (x:: $type , y:: $type , r:: RoundingMode = RoundToZero)
12- x, y = promote (x, y)
12+ x, y = promote_except_value (x, y)
1313 new_quantity (typeof (x), div (ustrip (x), ustrip (y), r), dimension (x) / dimension (y))
1414 end
1515
@@ -57,7 +57,7 @@ Base.:/(l::AbstractDimensions, r::AbstractDimensions) = map_dimensions(-, l, r)
5757for (type, base_type, _) in ABSTRACT_QUANTITY_TYPES, op in (:+ , :- )
5858 @eval begin
5959 function Base. $op (l:: $type , r:: $type )
60- l, r = promote (l, r)
60+ l, r = promote_except_value (l, r)
6161 dimension (l) == dimension (r) || throw (DimensionError (l, r))
6262 return new_quantity (typeof (l), $ op (ustrip (l), ustrip (r)), dimension (l))
6363 end
@@ -81,7 +81,7 @@ for op in (:*, :/, :+, :-, :div, :atan, :atand, :copysign, :flipsign, :mod),
8181
8282 t1 == t2 && continue
8383
84- @eval Base.$ op (l:: $t1 , r:: $t2 ) = $ op (promote (l, r)... )
84+ @eval Base.$ op (l:: $t1 , r:: $t2 ) = $ op (promote_except_value (l, r)... )
8585end
8686
8787# We don't promote on the dimension types:
@@ -156,7 +156,7 @@ for (type, base_type, _) in ABSTRACT_QUANTITY_TYPES, f in (:atan, :atand)
156156 return $ f (ustrip (x))
157157 end
158158 function Base. $f (y:: $type , x:: $type )
159- y, x = promote (y, x)
159+ y, x = promote_except_value (y, x)
160160 dimension (y) == dimension (x) || throw (DimensionError (y, x))
161161 return $ f (ustrip (y), ustrip (x))
162162 end
@@ -186,7 +186,7 @@ for (type, base_type, _) in ABSTRACT_QUANTITY_TYPES, f in (:copysign, :flipsign,
186186 # and ignore any dimensions on y, since those will cancel out.
187187 @eval begin
188188 function Base. $f (x:: $type , y:: $type )
189- x, y = promote (x, y)
189+ x, y = promote_except_value (x, y)
190190 return new_quantity (typeof (x), $ f (ustrip (x), ustrip (y)), dimension (x))
191191 end
192192 function Base. $f (x:: $type , y:: $base_type )
0 commit comments