Abstraction of numeric types with the usual binary operations:
x + y,x - y,x * y, andx / y, along with-x.A concrete class which implements this interface should be a mathematical ring. That is:
+, and multiplication, *, should be
associative and commutative,0 and 1 respectively, satisfying x+0 == x
and x*1 == x,x should have an additive inverse -x,
satisfying x + -x == 0, andx*(y+z) == x*y + x*z.It is preferred, but not required, that the class be a mathematical field. That is, in addition to the above:
x such that x!=0 should have a
multiplicative inverse 1/x, satisfying x * 1/x == 1.For numeric types which are not fields, for example,
Integer, there is still a division operation, which is
understood to produce a remainder.
The division operation should satisfy:
x*y / y == xfor any instance y other than 0.
For numeric types which are fields, division never produces a remainder, and division should additionally satisfy:
x/y * y == xfor any instance y other than 0.
Some numeric types, for example complex numbers, do not
have a total order. Numeric types with a
total order also satisfy Number.
Numberno type hierarchy
| Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Invertible<Other> |
| Methods | |
divided | Source Codeshared formal Other divided(Other other)The quotient obtained by dividing this number by the given number. For integral numeric types, this operation results in a remainder. When the given number is See also Integral.remainder(), infinity |
times | Source Codeshared formal Other times(Other other)The product of this number and the given number. |
| Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Invertible<Other> |
Methods inherited from: Summable<Other> |