Universal / with any Numeric

assert 8.div(2) == 4
assert 4.div(0.5) == 8.0
assert 1.1.div(0.1) == 11.0
assert 2.2.div(2) == 1.1

Property definitions

core :: numeric $ Numeric :: div
	# Universal `/` with any `Numeric`
	#
	# ~~~~
	# assert 8.div(2) == 4
	# assert 4.div(0.5) == 8.0
	# assert 1.1.div(0.1) == 11.0
	# assert 2.2.div(2) == 1.1
	# ~~~~
	fun div(other: Numeric): Numeric is abstract
lib/core/numeric.nit:64,2--72,45

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

core :: numeric $ Int :: div
	redef fun div(other)
	do
		if other isa Float then
			return to_f / other
		else if other isa Int then
			if other == 0 then return self.to_f / 0.0
			return self / other
		else abort
	end
lib/core/numeric.nit:113,2--121,4