\n\n\n\nFloatingPoint\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n\n\n\n
\n
\n
\n\n\n\n
\n
org.jscience.mathematics.number
\n

## Class FloatingPoint

\n
\n
\n
\n
\n
\n
\n
\n
\n
• \n\n
\n
• \n\n\n

### Field Summary

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Fields
Modifier and TypeField and Description
`static FloatingPoint``NaN`\n
The Not-a-Number instance (unique).
\n
`static FloatingPoint``ONE`\n
The floating point instance representing the multiplicative identity.
\n
`static FloatingPoint``ZERO`\n
The floating point instance representing the additive identity.
\n
\n
• \n
\n\n
\n
• \n\n\n

### Method Summary

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Methods
Modifier and TypeMethod and Description
`FloatingPoint``abs()`\n
Returns the absolute value of this floating point number.
\n
`int``compareTo(FloatingPoint that)`\n
Compares two floating point number numerically.
\n
`FloatingPoint``copy()`\n
Returns a copy of this number \n `allocated` \n by the calling thread (possibly on the stack).
\n
`FloatingPoint``divide(FloatingPoint that)`\n
Returns this floating point number divided by the one specified.
\n
`double``doubleValue()`\n
Returns the value of this floating point number as a `double`.
\n
`boolean``equals(Object that)`\n
Compares this floating point number against the specified object.
\n
`static int``getDigits()`\n
Returns the `local` number of \n digits used during calculations (default 20 digits).
\n
`int``getExponent()`\n
Returns the decimal exponent.
\n
`LargeInteger``getSignificand()`\n
Returns the significand value.
\n
`int``hashCode()`\n
Returns the hash code for this floating point number.
\n
`FloatingPoint``inverse()`\n
Returns the inverse of this floating point number.
\n
`boolean``isLargerThan(FloatingPoint that)`\n
Compares the absolute value of two FloatingPoint numbers.
\n
`boolean``isNaN()`\n
Indicates if this floating point is Not-a-Number.
\n
`boolean``isNegative()`\n
Indicates if this rational number is less than zero.
\n
`boolean``isPositive()`\n
Indicates if this floating point number is greater than zero.
\n
`boolean``isZero()`\n
Indicates if this floating point number is equal to zero.
\n
`long``longValue()`\n
Returns the value of this floating point number as a `long`.
\n
`FloatingPoint``minus(FloatingPoint that)`\n
Returns the difference between this FloatingPoint number and the one\n specified.
\n
`FloatingPoint``opposite()`\n
Returns the opposite of this floating point number.
\n
`FloatingPoint``plus(FloatingPoint that)`\n
Returns the sum of this floating point number with the one specified.
\n
`LargeInteger``round()`\n
Returns the closest integer to this floating point number.
\n
`static void``setDigits(int digits)`\n
Sets the `local` number of digits\n to be used during calculations.
\n
`FloatingPoint``sqrt()`\n
Returns the square root of this floating point number.
\n
`FloatingPoint``times(FloatingPoint that)`\n
Returns the product of this floating point number with the one specified.
\n
`FloatingPoint``times(long multiplier)`\n
Returns the product of this floating point number with the specified \n `long` multiplier.
\n
`javolution.text.Text``toText()`\n
Returns the decimal text representation of this number.
\n
`static FloatingPoint``valueOf(CharSequence chars)`\n
Returns the floating point number for the specified character sequence.
\n
`static FloatingPoint``valueOf(double doubleValue)`\n
Returns the floating point number for the specified `double`\n value (convenience method).
\n
`static FloatingPoint``valueOf(LargeInteger significand,\n int exponent)`\n
Returns the floating point number for the specified `LargeInteger` significand and power of two exponent.
\n
`static FloatingPoint``valueOf(long longValue)`\n
Returns the floating point number for the specified `long`\n value (convenience method).
\n
`static FloatingPoint``valueOf(long significand,\n int exponent)`\n
Returns the floating point number for the specified `long`\n significand and power of two exponent (convenience method).
\n
\n
\n
• \n\n\n

### Methods inherited from class org.jscience.mathematics.number.Number

\n`byteValue, floatValue, intValue, isGreaterThan, isLessThan, pow, shortValue, toString`
• \n
\n
\n
• \n\n\n

### Methods inherited from class java.lang.Object

\n`getClass, notify, notifyAll, wait, wait, wait`
• \n
\n
• \n
\n
• \n
\n
\n
\n
\n
• \n\n
\n
• \n\n\n

### Field Detail

\n\n\n\n
\n
• \n

#### ZERO

\n
`public static final FloatingPoint ZERO`
\n
The floating point instance representing the additive identity.
\n
• \n
\n\n\n\n
\n
• \n

#### ONE

\n
`public static final FloatingPoint ONE`
\n
The floating point instance representing the multiplicative identity.
\n
• \n
\n\n\n\n
\n
• \n

#### NaN

\n
`public static final FloatingPoint NaN`
\n
The Not-a-Number instance (unique).
\n
• \n
\n
• \n
\n\n
\n
• \n\n\n

### Method Detail

\n\n\n\n
\n
• \n

#### valueOf

\n
`public static FloatingPoint valueOf(LargeInteger significand,\n                    int exponent)`
\n
Returns the floating point number for the specified `LargeInteger` significand and power of two exponent.
\n
Parameters:
`significand` - the significand value.
`exponent` - the power of two exponent.
\n
Returns:
`(significand \xc2\xb7 2exponent`
\n
• \n
\n\n\n\n
\n
• \n

#### valueOf

\n
`public static FloatingPoint valueOf(long significand,\n                    int exponent)`
\n
Returns the floating point number for the specified `long`\n significand and power of two exponent (convenience method).
\n
Parameters:
`significand` - the significand value.
`exponent` - the power of two exponent.
\n
Returns:
`(significand \xc2\xb7 2exponent`
\n
• \n
\n\n\n\n
\n
• \n

#### valueOf

\n
`public static FloatingPoint valueOf(long longValue)`
\n
Returns the floating point number for the specified `long`\n value (convenience method).
\n
Parameters:
`longValue` - the `long` value.
\n
Returns:
`FloatingPoint.valueOf(longValue, 0)`
\n
• \n
\n\n\n\n
\n
• \n

#### valueOf

\n
`public static FloatingPoint valueOf(double doubleValue)`
\n
Returns the floating point number for the specified `double`\n value (convenience method).
\n
Parameters:
`doubleValue` - the `double` value.
\n
Returns:
`FloatingPoint.valueOf(longValue, 0)`
\n
• \n
\n\n\n\n
\n
• \n

#### valueOf

\n
`public static FloatingPoint valueOf(CharSequence chars)`
\n
Returns the floating point number for the specified character sequence.\n The number of digits
\n
Parameters:
`chars` - the character sequence.
\n
Returns:
the corresponding FloatingPoint number.
\n
• \n
\n\n\n\n
\n
• \n

#### getDigits

\n
`public static int getDigits()`
\n
Returns the `local` number of \n digits used during calculations (default 20 digits).
\n
Returns:
the number of digits.
\n
• \n
\n\n\n\n
\n
• \n

#### setDigits

\n
`public static void setDigits(int digits)`
\n
Sets the `local` number of digits\n to be used during calculations.
\n
Parameters:
`digits` - the number of digits.
\n
Throws:
\n
`IllegalArgumentException` - if `digits <= 0`
\n
• \n
\n\n\n\n
\n
• \n

#### getSignificand

\n
`public LargeInteger getSignificand()`
\n
Returns the significand value.
\n
Returns:
this floating point significand.
\n
• \n
\n\n\n\n
\n
• \n

#### getExponent

\n
`public int getExponent()`
\n
Returns the decimal exponent.
\n
Returns:
this floating point decimal exponent.
\n
• \n
\n\n\n\n
\n
• \n

#### round

\n
`public LargeInteger round()`
\n
Returns the closest integer to this floating point number.
\n
Returns:
this floating point rounded to the nearest integer.
\n
• \n
\n\n\n\n
\n
• \n

#### opposite

\n
`public FloatingPoint opposite()`
\n
Returns the opposite of this floating point number.
\n
\n
Specified by:
\n
`opposite` in interface `GroupAdditive<FloatingPoint>`
\n
Returns:
`-this`.
\n
• \n
\n\n\n\n
\n
• \n

#### plus

\n
`public FloatingPoint plus(FloatingPoint that)`
\n
Returns the sum of this floating point number with the one specified.
\n
\n
Specified by:
\n
`plus` in interface `GroupAdditive<FloatingPoint>`
\n
Parameters:
`that` - the floating point number to be added.
\n
Returns:
`this + that`.
\n
• \n
\n\n\n\n
\n
• \n

#### minus

\n
`public FloatingPoint minus(FloatingPoint that)`
\n
Returns the difference between this FloatingPoint number and the one\n specified.
\n
\n
Overrides:
\n
`minus` in class `Number<FloatingPoint>`
\n
Parameters:
`that` - the floating point number to be subtracted.
\n
Returns:
`this - that`.
\n
• \n
\n\n\n\n
\n
• \n

#### times

\n
`public FloatingPoint times(long multiplier)`
\n
Returns the product of this floating point number with the specified \n `long` multiplier.
\n
Parameters:
`multiplier` - the `long` multiplier.
\n
Returns:
`this \xc2\xb7 multiplier`.
\n
• \n
\n\n\n\n
\n
• \n

#### times

\n
`public FloatingPoint times(FloatingPoint that)`
\n
Returns the product of this floating point number with the one specified.
\n
\n
Specified by:
\n
`times` in interface `GroupMultiplicative<FloatingPoint>`
\n
Specified by:
\n
`times` in interface `Ring<FloatingPoint>`
\n
Parameters:
`that` - the floating point number multiplier.
\n
Returns:
`this \xc2\xb7 that`.
\n
• \n
\n\n\n\n
\n
• \n

#### inverse

\n
`public FloatingPoint inverse()`
\n
Returns the inverse of this floating point number.
\n
\n
Specified by:
\n
`inverse` in interface `GroupMultiplicative<FloatingPoint>`
\n
Returns:
`1 / this`.
\n
Throws:
\n
`ArithmeticException` - if `dividend.isZero()`
\n
• \n
\n\n\n\n
\n
• \n

#### divide

\n
`public FloatingPoint divide(FloatingPoint that)`
\n
Returns this floating point number divided by the one specified.
\n
Parameters:
`that` - the FloatingPoint number divisor.
\n
Returns:
`this / that`.
\n
Throws:
\n
`ArithmeticException` - if `that.equals(ZERO)`
\n
• \n
\n\n\n\n
\n
• \n

#### abs

\n
`public FloatingPoint abs()`
\n
Returns the absolute value of this floating point number.
\n
Returns:
`|this|`.
\n
• \n
\n\n\n\n
\n
• \n

#### sqrt

\n
`public FloatingPoint sqrt()`
\n
Returns the square root of this floating point number.
\n
Returns:
the positive square root of this floating point number.
\n
• \n
\n\n\n\n
\n
• \n

#### isZero

\n
`public boolean isZero()`
\n
Indicates if this floating point number is equal to zero.
\n
Returns:
`this == 0`
\n
• \n
\n\n\n\n
\n
• \n

#### isPositive

\n
`public boolean isPositive()`
\n
Indicates if this floating point number is greater than zero.
\n
Returns:
`this > 0`
\n
• \n
\n\n\n\n
\n
• \n

#### isNegative

\n
`public boolean isNegative()`
\n
Indicates if this rational number is less than zero.
\n
Returns:
`this < 0`
\n
• \n
\n\n\n\n
\n
• \n

#### isNaN

\n
`public boolean isNaN()`
\n
Indicates if this floating point is Not-a-Number.
\n
Returns:
`true` if this number has unbounded value;\n `false` otherwise.
\n
• \n
\n\n\n\n
\n
• \n

#### isLargerThan

\n
`public boolean isLargerThan(FloatingPoint that)`
\n
Compares the absolute value of two FloatingPoint numbers.
\n
\n
Specified by:
\n
`isLargerThan` in class `Number<FloatingPoint>`
\n
Parameters:
`that` - the FloatingPoint number to be compared with.
\n
Returns:
`|this| > |that|`
\n
• \n
\n\n\n\n
\n
• \n

#### toText

\n
`public javolution.text.Text toText()`
\n
Returns the decimal text representation of this number.
\n
\n
Specified by:
\n
`toText` in interface `javolution.lang.Realtime`
\n
Specified by:
\n
`toText` in class `Number<FloatingPoint>`
\n
Returns:
the text representation of this number.
\n
• \n
\n\n\n\n
\n
• \n

#### equals

\n
`public boolean equals(Object that)`
\n
Compares this floating point number against the specified object.
\n
\n
Specified by:
\n
`equals` in class `Number<FloatingPoint>`
\n
Parameters:
`that` - the object to compare with.
\n
Returns:
`true` if the objects are the same;\n `false` otherwise.
\n
• \n
\n\n\n\n
\n
• \n

#### hashCode

\n
`public int hashCode()`
\n
Returns the hash code for this floating point number.
\n
\n
Specified by:
\n
`hashCode` in class `Number<FloatingPoint>`
\n
Returns:
the hash code value.
\n
• \n
\n\n\n\n
\n
• \n

#### longValue

\n
`public long longValue()`
\n
Returns the value of this floating point number as a `long`.
\n
\n
Specified by:
\n
`longValue` in class `Number<FloatingPoint>`
\n
Returns:
the numeric value represented by this floating point \n after conversion to type `long`.
\n
• \n
\n\n\n\n
\n
• \n

#### doubleValue

\n
`public double doubleValue()`
\n
Returns the value of this floating point number as a `double`.
\n
\n
Specified by:
\n
`doubleValue` in class `Number<FloatingPoint>`
\n
Returns:
the numeric value represented by this FloatingPoint after conversion\n to type `double`.
\n
• \n
\n\n\n\n
\n
• \n

#### compareTo

\n
`public int compareTo(FloatingPoint that)`
\n
Compares two floating point number numerically.
\n
\n
Specified by:
\n
`compareTo` in interface `Comparable<FloatingPoint>`
\n
Specified by:
\n
`compareTo` in class `Number<FloatingPoint>`
\n
Parameters:
`that` - the floating point number to compare with.
\n
Returns:
-1, 0 or 1 as this FloatingPoint number is numerically less than, \n equal to, or greater than `that`.
\n
• \n
\n\n\n\n
\n
• \n

#### copy

\n
`public FloatingPoint copy()`
\n
Description copied from class: `Number`
\n
Returns a copy of this number \n `allocated` \n by the calling thread (possibly on the stack).
\n
\n
Specified by:
\n
`copy` in interface `javolution.lang.ValueType`
\n
Specified by:
\n
`copy` in class `Number<FloatingPoint>`
\n
Returns:
an identical and independant copy of this number.
\n
• \n
\n
• \n
\n
• \n
\n
\n
\n\n\n
\n\n\n\n\n
\n
\n
\n\n\n