Abstraction of numeric types with a natural
total order, including the built-in numeric
types Integer and Float.
A Number has a well-defined magnitude together with a
sign of type Integer, defined for any instance x
as follows:
x==0 then x.sign==0 and x.magnitude==0,x>0 then x.sign==1 and x.magnitude==x, orx<0 then x.sign==-1 and x.magnitude==-x,where 0 is the additive identity of the numeric type.
Not every value commonly considered to be a “number” is
a Number. For example, complex numbers aren't Numbers
since they don't have a total order.
no type hierarchy
| Attributes | |
absolute | See magnitude |
fractionalPart | Source Codeshared formal Other fractionalPartThe fractional part of this number, after truncation of
the integral part. For |
magnitude | Source Codeshared default Other magnitudeThe magnitude of this number, defined for any instance
where
Aliases: absolute |
negative | Source Codeshared formal Boolean negativeDetermine if the number is strictly negative, that is,
if |
positive | Source Codeshared formal Boolean positiveDetermine if the number is strictly positive, that is,
if |
sign | Source Codeshared default Integer sign |
wholePart | Source Codeshared formal Other wholePartThe integral value of the number after truncation of
the fractional part. For |
| Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Invertible<Other> |
| Methods | |
plusInteger | Source Codeshared formal Other plusInteger(Integer integer)The result of adding this number to the given
|
powerOfInteger | Source Codeshared formal Other powerOfInteger(Integer integer)The result of raising this number to the given
non-negative Throws
|
timesInteger | Source Codeshared formal Other timesInteger(Integer integer)The result of multiplying this number by the given
|
| Inherited Methods |
Methods inherited from: Object |
Methods inherited from: Comparable<Other> |
Methods inherited from: Invertible<Other> |
Methods inherited from: Numeric<Other> |
Methods inherited from: Summable<Other> |