JSci.maths
Class MathDouble

java.lang.Object
  extended byjava.lang.Number
      extended byJSci.maths.MathDouble
All Implemented Interfaces:
AbelianGroup.Member, java.lang.Comparable, Field.Member, Member, Ring.Member, java.io.Serializable

public final class MathDouble
extends java.lang.Number
implements java.lang.Comparable, Field.Member

The MathDouble class encapsulates double numbers.

See Also:
RealField, Serialized Form

Constructor Summary
MathDouble(double num)
          Constructs a double number.
MathDouble(java.lang.String s)
          Constructs the double number represented by a string.
 
Method Summary
static MathDouble acos(MathDouble x)
          Returns the arc cosine of a number.
static MathDouble acosh(MathDouble x)
          Returns the arc hyperbolic cosine of a number.
 AbelianGroup.Member add(AbelianGroup.Member n)
          Returns the addition of this number and another.
 MathDouble add(MathDouble n)
          Returns the addition of this double number and another.
static MathDouble asin(MathDouble x)
          Returns the arc sine of a number.
static MathDouble asinh(MathDouble x)
          Returns the arc hyperbolic sine of a number.
static MathDouble atan(MathDouble x)
          Returns the arc tangent of a number.
static MathDouble atanh(MathDouble x)
          Returns the arc hyperbolic tangent of a number.
 int compareTo(java.lang.Object obj)
          Compares two double numbers.
static MathDouble cos(MathDouble x)
          Returns the trigonometric cosine of an angle.
static MathDouble cosh(MathDouble x)
          Returns the hyperbolic cosine of a number.
 Field.Member divide(Field.Member n)
          Returns the division of this number and another.
 MathDouble divide(MathDouble n)
          Returns the division of this double number and another.
 double doubleValue()
           
 boolean equals(java.lang.Object obj)
          Compares two double numbers for equality.
static MathDouble exp(MathDouble x)
          Returns the exponential number e(2.718...) raised to the power of a number.
 float floatValue()
           
 int intValue()
           
 Field.Member inverse()
          Returns the inverse of this number.
 boolean isInfinite()
          Returns true if this number is infinite.
 boolean isNaN()
          Returns true if this number is NaN.
static boolean isZero(double x)
          Returns true if the number is within the zero tolerance.
static MathDouble log(MathDouble x)
          Returns the natural logarithm (base e) of a number.
 long longValue()
           
 MathDouble multiply(MathDouble n)
          Returns the multiplication of this double number and another.
 Ring.Member multiply(Ring.Member n)
          Returns the multiplication of this number and another.
 AbelianGroup.Member negate()
          Returns the negative of this number.
static MathDouble sin(MathDouble x)
          Returns the trigonometric sine of an angle.
static MathDouble sinh(MathDouble x)
          Returns the hyperbolic sine of a number.
 AbelianGroup.Member subtract(AbelianGroup.Member n)
          Returns the subtraction of this number and another.
 MathDouble subtract(MathDouble n)
          Returns the subtraction of this double number and another.
static MathDouble tan(MathDouble x)
          Returns the trigonometric tangent of an angle.
static MathDouble tanh(MathDouble x)
          Returns the hyperbolic tangent of a number.
 java.lang.String toString()
          Returns a string representing the value of this double number.
 double value()
          Returns the double value.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MathDouble

public MathDouble(double num)
Constructs a double number.


MathDouble

public MathDouble(java.lang.String s)
           throws java.lang.NumberFormatException
Constructs the double number represented by a string.

Parameters:
s - a string representing a double number.
Throws:
java.lang.NumberFormatException - if the string does not contain a parsable number.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two double numbers for equality.

Parameters:
obj - a double number.

compareTo

public int compareTo(java.lang.Object obj)
              throws java.lang.IllegalArgumentException
Compares two double numbers.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - a double number.
Returns:
a negative value if this<obj, zero if this==obj, and a positive value if this>obj.
Throws:
java.lang.IllegalArgumentException

toString

public java.lang.String toString()
Returns a string representing the value of this double number.


value

public double value()
Returns the double value.


intValue

public int intValue()

longValue

public long longValue()

floatValue

public float floatValue()

doubleValue

public double doubleValue()

isZero

public static boolean isZero(double x)
Returns true if the number is within the zero tolerance.


isNaN

public boolean isNaN()
Returns true if this number is NaN.


isInfinite

public boolean isInfinite()
Returns true if this number is infinite.


negate

public AbelianGroup.Member negate()
Returns the negative of this number.

Specified by:
negate in interface AbelianGroup.Member

inverse

public Field.Member inverse()
Returns the inverse of this number.

Specified by:
inverse in interface Field.Member

add

public AbelianGroup.Member add(AbelianGroup.Member n)
Returns the addition of this number and another.

Specified by:
add in interface AbelianGroup.Member
Parameters:
n - a group member

add

public MathDouble add(MathDouble n)
Returns the addition of this double number and another.


subtract

public AbelianGroup.Member subtract(AbelianGroup.Member n)
Returns the subtraction of this number and another.

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
n - a group member

subtract

public MathDouble subtract(MathDouble n)
Returns the subtraction of this double number and another.


multiply

public Ring.Member multiply(Ring.Member n)
Returns the multiplication of this number and another.

Specified by:
multiply in interface Ring.Member
Parameters:
n - a ring member

multiply

public MathDouble multiply(MathDouble n)
Returns the multiplication of this double number and another.


divide

public Field.Member divide(Field.Member n)
Returns the division of this number and another.

Specified by:
divide in interface Field.Member
Parameters:
n - a field member

divide

public MathDouble divide(MathDouble n)
Returns the division of this double number and another.


exp

public static MathDouble exp(MathDouble x)
Returns the exponential number e(2.718...) raised to the power of a number.


log

public static MathDouble log(MathDouble x)
Returns the natural logarithm (base e) of a number.


sin

public static MathDouble sin(MathDouble x)
Returns the trigonometric sine of an angle.

Parameters:
x - an angle that is measured in radians

cos

public static MathDouble cos(MathDouble x)
Returns the trigonometric cosine of an angle.

Parameters:
x - an angle that is measured in radians

tan

public static MathDouble tan(MathDouble x)
Returns the trigonometric tangent of an angle.

Parameters:
x - an angle that is measured in radians

sinh

public static MathDouble sinh(MathDouble x)
Returns the hyperbolic sine of a number.


cosh

public static MathDouble cosh(MathDouble x)
Returns the hyperbolic cosine of a number.


tanh

public static MathDouble tanh(MathDouble x)
Returns the hyperbolic tangent of a number.


asin

public static MathDouble asin(MathDouble x)
Returns the arc sine of a number.


acos

public static MathDouble acos(MathDouble x)
Returns the arc cosine of a number.


atan

public static MathDouble atan(MathDouble x)
Returns the arc tangent of a number.


asinh

public static MathDouble asinh(MathDouble x)
Returns the arc hyperbolic sine of a number.


acosh

public static MathDouble acosh(MathDouble x)
Returns the arc hyperbolic cosine of a number.


atanh

public static MathDouble atanh(MathDouble x)
Returns the arc hyperbolic tangent of a number.