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 c399558 commit 047adf1Copy full SHA for 047adf1
base/promotion.jl
@@ -243,10 +243,22 @@ function sametype_error(input...)
243
" failed to change any input types")
244
end
245
246
-+(x::Number, y::Number) = +(promote(x,y)...)
247
-*(x::Number, y::Number) = *(promote(x,y)...)
248
--(x::Number, y::Number) = -(promote(x,y)...)
249
-/(x::Number, y::Number) = /(promote(x,y)...)
+function +(x::Number, y::Number)
+ T = promote_type(typeof(x), typeof(y))
+ convert(T, x) + convert(T, y)
+end
250
+function *(x::Number, y::Number)
251
252
+ convert(T, x) * convert(T, y)
253
254
+function -(x::Number, y::Number)
255
256
+ convert(T, x) - convert(T, y)
257
258
+function /(x::Number, y::Number)
259
260
+ convert(T, x) / convert(T, y)
261
262
263
"""
264
^(x, y)
0 commit comments