core :: Numeric :: mul
*
Numeric
assert 2.mul(4) == 8 assert 11.mul(0.1) == 1.1 assert 11.1.mul(0.1) == 1.11 assert 1.1.mul(4) == 4.4
# Universal `*` with any `Numeric` # # ~~~~ # assert 2.mul(4) == 8 # assert 11.mul(0.1) == 1.1 # assert 11.1.mul(0.1) == 1.11 # assert 1.1.mul(4) == 4.4 # ~~~~ fun mul(other: Numeric): Numeric is abstract
redef fun mul(other) do return self * other.to_f
redef fun mul(other) do if other isa Float then return to_f * other else return self * other.as(Int) end end