|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Real
Representation of a real number a∈R.
Of course, the machine prevents us from handling real numbers at all.
This class provides rational decimal numbers up to machine precision, instead.
In fact, the class Real
is limited to decimals and does not even feel that any
irrational numbers could possibly exist as well.
But for we are patient humans, we wisely nod and satisfy ourselfes with decimal numbers.
ValueFactory.valueOf(double)
,
ValueFactory.valueOf(float)
,
ValueFactory.valueOf(java.math.BigDecimal)
Field Summary | |
---|---|
static Predicate |
hasType
Checks whether the given number is in the set of reals and not a subset. |
static Predicate |
isa
Checks whether the given number is in the set of reals. |
Fields inherited from interface orbital.math.Arithmetic |
---|
numerical |
Method Summary | |
---|---|
Real |
add(Real b)
|
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
Real |
divide(Real b)
|
double |
doubleValue()
Returns the value of the specified real as a double . |
float |
floatValue()
Returns the value of the specified real as a float . |
Real |
multiply(Real b)
|
Real |
power(Real b)
Return ab. |
Real |
subtract(Real b)
|
Methods inherited from interface orbital.math.Complex |
---|
add, arg, conjugate, divide, equals, hashCode, im, isInfinite, isNaN, multiply, norm, power, re, subtract |
Methods inherited from interface orbital.math.Arithmetic |
---|
add, divide, equals, inverse, isOne, isZero, minus, multiply, one, power, scale, subtract, toString, valueFactory, zero |
Field Detail |
---|
static final Predicate isa
static final Predicate hasType
To be precise, for all numbers with machine precision can only be rational.
Nevertheless, we model the difference between (machine precision) reals
and explicit fractional numbers as Rational
s with numerator and denominator.
Method Detail |
---|
int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
java.lang.ClassCastException
- if the specified object's type prevents it from being compared to this Object.Comparable.compareTo(Object)
float floatValue()
float
. This may involve rounding.
Similar to the double-to-float narrowing primitive conversion as defined in
The Java Language Specification:
if this real has too great a magnitude to represent as a float
,
it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate.
float
.double doubleValue()
double
. This may involve rounding.
Similar to the double-to-float narrowing primitive conversion as defined in
The Java Language Specification:
if this real has too great a magnitude to represent as a double
,
it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate.
double
.Real add(Real b)
Real subtract(Real b)
Real multiply(Real b)
Real divide(Real b)
Real power(Real b)
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |