net.jinx.slowmath
Class ADouble

java.lang.Object
  extended by java.lang.Number
      extended by net.jinx.slowmath.ADouble
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Real

public class ADouble
extends java.lang.Number
implements Real

Implementation of Real that uses double as it's type.

API Stability: Beta.

See Also:
Serialized Form

Constructor Summary
ADouble(double val)
           
ADouble(float val)
           
ADouble(long v)
           
ADouble(java.lang.Number n)
           
ADouble(java.lang.String s)
           
 
Method Summary
 Real abs()
          Returns the absolute value of this Real.
 Real acos()
          Returns the arc cosine of this Real.
 Real add(Real v)
          Adds this and another Real together, returning the results.
 Real asin()
          Returns the arc sine of this Real.
 Real atan()
          Returns the arc tanget of this Real.
 java.math.BigDecimal bigDecimalValue()
          Type-casts to a BigDecimal.
 byte byteValue()
          Type-casts to a byte.
 int compareTo(java.lang.Object o)
          Compares this Real with o.
 int compareTo(Real v)
          Compares this Real with v.
 Real cos()
          Returns the cosine of this Real.
 Real divide(Real v)
          Divides this by another Real together, returning the results.
 double doubleValue()
          Type-casts to a double.
 Real exp()
          Returns Euler's number raised by this Real.
 float floatValue()
          Type-casts to a float.
 int intValue()
          Type-casts to an int.
 Real log()
          Returns the natural logarithm of this Real.
 long longValue()
          Type-casts to a long.
 Real max(Real v)
          Returns the maximum of this Real and another.
 Real min(Real v)
          Returns the minimum of this Real and another.
 Real multiply(Real v)
          Multiplies this and another Real together, returning the results.
 Real negate()
          Returns the negation of this Real.
 Real pow(Real v)
          Returns the power of this Real raised by another.
 short shortValue()
          Type-casts to a short.
 Real signum()
          Returns the signum of this Real.
 Real sin()
          Returns the sine of this Real.
 Real sqrt()
          Returns the square root of this Real.
 Real subtract(Real v)
          Subtracts another Real from this, returning the results.
 Real tan()
          Returns the tangent of this Real.
 java.lang.String toString()
          Type-casts to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ADouble

public ADouble(double val)

ADouble

public ADouble(float val)

ADouble

public ADouble(java.lang.String s)

ADouble

public ADouble(java.lang.Number n)

ADouble

public ADouble(long v)
Method Detail

add

public Real add(Real v)
Description copied from interface: Real
Adds this and another Real together, returning the results.

Specified by:
add in interface Real

subtract

public Real subtract(Real v)
Description copied from interface: Real
Subtracts another Real from this, returning the results.

Specified by:
subtract in interface Real

multiply

public Real multiply(Real v)
Description copied from interface: Real
Multiplies this and another Real together, returning the results.

Specified by:
multiply in interface Real

divide

public Real divide(Real v)
Description copied from interface: Real
Divides this by another Real together, returning the results.

Specified by:
divide in interface Real

abs

public Real abs()
Description copied from interface: Real
Returns the absolute value of this Real.

Specified by:
abs in interface Real

negate

public Real negate()
Description copied from interface: Real
Returns the negation of this Real.

Specified by:
negate in interface Real

signum

public Real signum()
Description copied from interface: Real
Returns the signum of this Real.

Specified by:
signum in interface Real

min

public Real min(Real v)
Description copied from interface: Real
Returns the minimum of this Real and another.

Specified by:
min in interface Real

max

public Real max(Real v)
Description copied from interface: Real
Returns the maximum of this Real and another.

Specified by:
max in interface Real

pow

public Real pow(Real v)
Description copied from interface: Real
Returns the power of this Real raised by another.

Specified by:
pow in interface Real

sqrt

public Real sqrt()
Description copied from interface: Real
Returns the square root of this Real.

Specified by:
sqrt in interface Real

log

public Real log()
Description copied from interface: Real
Returns the natural logarithm of this Real.

Specified by:
log in interface Real

exp

public Real exp()
Description copied from interface: Real
Returns Euler's number raised by this Real.

Specified by:
exp in interface Real

sin

public Real sin()
Description copied from interface: Real
Returns the sine of this Real.

Specified by:
sin in interface Real

cos

public Real cos()
Description copied from interface: Real
Returns the cosine of this Real.

Specified by:
cos in interface Real

tan

public Real tan()
Description copied from interface: Real
Returns the tangent of this Real.

Specified by:
tan in interface Real

asin

public Real asin()
Description copied from interface: Real
Returns the arc sine of this Real.

Specified by:
asin in interface Real

acos

public Real acos()
Description copied from interface: Real
Returns the arc cosine of this Real.

Specified by:
acos in interface Real

atan

public Real atan()
Description copied from interface: Real
Returns the arc tanget of this Real.

Specified by:
atan in interface Real

byteValue

public byte byteValue()
Description copied from interface: Real
Type-casts to a byte.

Specified by:
byteValue in interface Real
Overrides:
byteValue in class java.lang.Number

shortValue

public short shortValue()
Description copied from interface: Real
Type-casts to a short.

Specified by:
shortValue in interface Real
Overrides:
shortValue in class java.lang.Number

intValue

public int intValue()
Description copied from interface: Real
Type-casts to an int.

Specified by:
intValue in interface Real
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Description copied from interface: Real
Type-casts to a long.

Specified by:
longValue in interface Real
Specified by:
longValue in class java.lang.Number

floatValue

public float floatValue()
Description copied from interface: Real
Type-casts to a float.

Specified by:
floatValue in interface Real
Specified by:
floatValue in class java.lang.Number

doubleValue

public double doubleValue()
Description copied from interface: Real
Type-casts to a double.

Specified by:
doubleValue in interface Real
Specified by:
doubleValue in class java.lang.Number

bigDecimalValue

public java.math.BigDecimal bigDecimalValue()
Description copied from interface: Real
Type-casts to a BigDecimal.

Specified by:
bigDecimalValue in interface Real

toString

public java.lang.String toString()
Description copied from interface: Real
Type-casts to a String.

Specified by:
toString in interface Real
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: Real
Compares this Real with o. If o is a Real, this method behaves like compareTo(Real). Otherwise, it throws a ClassCastException, since Reals are comparable only to other Reals.

Specified by:
compareTo in interface java.lang.Comparable
Specified by:
compareTo in interface Real
Returns:
a negative number, zero, or a positive number as this Real is numerically less than, equal to, or greater than o, which must be a Real.

compareTo

public int compareTo(Real v)
Description copied from interface: Real
Compares this Real with v.

Specified by:
compareTo in interface Real
Returns:
a negative number, zero, or a positive number as this Real is numerically less than, equal to, or greater than v.