Universal - with any Numeric

assert 2.sub(1) == 1
assert 1.sub(0.1) == 0.9
assert 1.1.sub(0.1) == 1.0
assert 2.1.sub(1) == 1.1

Property definitions

core :: numeric $ Numeric :: sub
	# Universal `-` with any `Numeric`
	#
	# ~~~~
	# assert 2.sub(1) == 1
	# assert 1.sub(0.1) == 0.9
	# assert 1.1.sub(0.1) == 1.0
	# assert 2.1.sub(1) == 1.1
	# ~~~~
	fun sub(other: Numeric): Numeric is abstract
lib/core/numeric.nit:54,2--62,45

core :: numeric $ Float :: sub
	redef fun sub(other) do return self - other.to_f
lib/core/numeric.nit:126,2--49

core :: numeric $ Int :: sub
	redef fun sub(other)
	do
		if other isa Float then
			return to_f - other
		else
			return self - other.as(Int)
		end
	end
lib/core/numeric.nit:95,2--102,4