Package org.apache.commons.math.dfp
Class DfpDec
java.lang.Object
org.apache.commons.math.dfp.Dfp
org.apache.commons.math.dfp.DfpDec
- All Implemented Interfaces:
FieldElement<Dfp>
Subclass of
Dfp which hides the radix-10000 artifacts of the superclass.
This should give outward appearances of being a decimal number with DIGITS*4-3
decimal digits. This class can be subclassed to appear to be an arbitrary number
of decimal digits less than DIGITS*4-3.- Since:
- 2.2
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate an instance with a value of 0.newInstance(byte x) Create an instance from a byte value.newInstance(byte sign, byte nans) Creates an instance with a non-finite value.newInstance(double x) Create an instance from a double value.newInstance(int x) Create an instance from an int value.newInstance(long x) Create an instance from a long value.Create an instance from a String representation.newInstance(Dfp d) Create an instance by copying an existing one.Returns the next number greater than this one in the direction of x.Methods inherited from class org.apache.commons.math.dfp.Dfp
add, ceil, classify, copysign, divide, divide, dotrap, equals, floor, getField, getOne, getRadixDigits, getTwo, getZero, greaterThan, hashCode, intValue, isInfinite, isNaN, lessThan, log10, log10K, multiply, multiply, negate, power10, power10K, remainder, rint, sqrt, subtract, toDouble, toSplitDouble, toString, unequal
-
Constructor Details
-
DfpDec
Copy constructor.- Parameters:
d- instance to copy
-
-
Method Details
-
newInstance
Create an instance with a value of 0. Use this internally in preference to constructors to facilitate subclasses- Overrides:
newInstancein classDfp- Returns:
- a new instance with a value of 0
-
newInstance
Create an instance from a byte value.- Overrides:
newInstancein classDfp- Parameters:
x- value to convert to an instance- Returns:
- a new instance with value x
-
newInstance
Create an instance from an int value.- Overrides:
newInstancein classDfp- Parameters:
x- value to convert to an instance- Returns:
- a new instance with value x
-
newInstance
Create an instance from a long value.- Overrides:
newInstancein classDfp- Parameters:
x- value to convert to an instance- Returns:
- a new instance with value x
-
newInstance
Create an instance from a double value.- Overrides:
newInstancein classDfp- Parameters:
x- value to convert to an instance- Returns:
- a new instance with value x
-
newInstance
Create an instance by copying an existing one. Use this internally in preference to constructors to facilitate subclasses.- Overrides:
newInstancein classDfp- Parameters:
d- instance to copy- Returns:
- a new instance with the same value as d
-
newInstance
Create an instance from a String representation. Use this internally in preference to constructors to facilitate subclasses.- Overrides:
newInstancein classDfp- Parameters:
s- string representation of the instance- Returns:
- a new instance parsed from specified string
-
newInstance
Creates an instance with a non-finite value.- Overrides:
newInstancein classDfp- Parameters:
sign- sign of the Dfp to createnans- code of the value, must be one ofDfp.INFINITE,Dfp.SNAN,Dfp.QNAN- Returns:
- a new instance with a non-finite value
-
nextAfter
Returns the next number greater than this one in the direction of x. If this==x then simply returns this.
-