Property definitions

core $ Numeric :: defaultinit
# A numeric value supporting mathematical operations
interface Numeric
	super Comparable

	redef type OTHER: Numeric

	# Addition of `self` with `i`
	fun +(i: OTHER): OTHER is abstract

	# Substraction of `i` from `self`
	fun -(i: OTHER): OTHER is abstract

	# Inverse of `self`
	fun -: OTHER is abstract

	# Multiplication of `self` with `i`
	fun *(i: OTHER): OTHER is abstract

	# Division of `self` with `i`
	fun /(i: OTHER): OTHER is abstract

	# The integer part of `self`.
	#
	#     assert (0.0).to_i      == 0
	#     assert (0.9).to_i      == 0
	#     assert (-0.9).to_i     == 0
	#     assert (9.9).to_i      == 9
	#     assert (-9.9).to_i     == -9
	fun to_i: Int is abstract

	# The float equivalent of `self`
	#
	#     assert 5.to_f         == 5.0
	#     assert 5.to_f         != 5 # Float and Int are not equals
	fun to_f: Float is abstract

	# The byte equivalent of `self`
	#
	#     assert (-1).to_b == 0xFF.to_b
	#     assert (1.9).to_b == 1.to_b
	fun to_b: Byte is abstract

	# Is this the value of zero in its domain?
	fun is_zero: Bool do return self == zero

	# The value of zero in the domain of `self`
	fun zero: OTHER is abstract

	# The value of `val` in the domain of `self`
	#
	#     assert 1.0.value_of(2) == 2.0
	#     assert 1.0.value_of(2.0) == 2.0
	#     assert 1.value_of(2) == 2
	#     assert 1.value_of(2.0) == 2
	fun value_of(val: Numeric): OTHER is abstract
end
lib/core/kernel.nit:431,1--486,3