public class DfpDec extends Dfp
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.ERR_SCALE, exp, FINITE, INFINITE, mant, MAX_EXP, MIN_EXP, nans, QNAN, RADIX, sign, SNAN
DEG_TO_RAD, RAD_TO_DEG
Modifier | Constructor and Description |
---|---|
|
DfpDec(Dfp d)
Copy constructor.
|
protected |
DfpDec(DfpField factory)
Makes an instance with a value of zero.
|
protected |
DfpDec(DfpField factory,
byte x)
Create an instance from a byte value.
|
protected |
DfpDec(DfpField factory,
byte sign,
byte nans)
Creates an instance with a non-finite value.
|
protected |
DfpDec(DfpField factory,
double x)
Create an instance from a double value.
|
protected |
DfpDec(DfpField factory,
int x)
Create an instance from an int value.
|
protected |
DfpDec(DfpField factory,
long x)
Create an instance from a long value.
|
protected |
DfpDec(DfpField factory,
String s)
Create an instance from a String representation.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getDecimalDigits()
Get the number of decimal digits this class is going to represent.
|
Dfp |
newInstance()
Create an instance with a value of 0.
|
Dfp |
newInstance(byte x)
Create an instance from a byte value.
|
Dfp |
newInstance(byte sign,
byte nans)
Creates an instance with a non-finite value.
|
Dfp |
newInstance(Dfp d)
Create an instance by copying an existing one.
|
Dfp |
newInstance(double x)
Create an instance corresponding to a constant real value.
|
Dfp |
newInstance(int x)
Create an instance from an int value.
|
Dfp |
newInstance(long x)
Create an instance from a long value.
|
Dfp |
newInstance(String s)
Create an instance from a String representation.
|
Dfp |
nextAfter(Dfp x)
Returns the next number greater than this one in the direction of x.
|
protected int |
round(int in)
Round this given the next digit n using the current rounding mode.
|
abs, acos, acosh, add, add, align, asin, asinh, atan, atan2, atanh, cbrt, ceil, classify, complement, copySign, copysign, copySign, cos, cosh, dfp2sci, dfp2string, divide, divide, divide, dotrap, equals, exp, expm1, floor, getExponent, getField, getOne, getRadixDigits, getReal, getTwo, getZero, greaterThan, hashCode, hypot, intLog10, intValue, isInfinite, isNaN, isZero, lessThan, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, linearCombination, log, log10, log10K, log1p, multiply, multiply, multiply, negate, negativeOrNull, newInstance, positiveOrNull, pow, pow, pow, power10, power10K, reciprocal, remainder, remainder, rint, rootN, scalb, shiftLeft, shiftRight, signum, sin, sinh, sqrt, strictlyNegative, strictlyPositive, subtract, subtract, tan, tanh, toDegrees, toDouble, toRadians, toSplitDouble, toString, trap, trunc, unequal
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
round
sinCos
protected DfpDec(DfpField factory)
factory
- factory linked to this instanceprotected DfpDec(DfpField factory, byte x)
factory
- factory linked to this instancex
- value to convert to an instanceprotected DfpDec(DfpField factory, int x)
factory
- factory linked to this instancex
- value to convert to an instanceprotected DfpDec(DfpField factory, long x)
factory
- factory linked to this instancex
- value to convert to an instanceprotected DfpDec(DfpField factory, double x)
factory
- factory linked to this instancex
- value to convert to an instancepublic DfpDec(Dfp d)
d
- instance to copyprotected DfpDec(DfpField factory, String s)
factory
- factory linked to this instances
- string representation of the instanceprotected DfpDec(DfpField factory, byte sign, byte nans)
factory
- factory linked to this instancesign
- sign of the Dfp to createnans
- code of the value, must be one of Dfp.INFINITE
,
Dfp.SNAN
, Dfp.QNAN
public Dfp newInstance()
newInstance
in class Dfp
public Dfp newInstance(byte x)
newInstance
in class Dfp
x
- value to convert to an instancepublic Dfp newInstance(int x)
newInstance
in class Dfp
x
- value to convert to an instancepublic Dfp newInstance(long x)
newInstance
in class Dfp
x
- value to convert to an instancepublic Dfp newInstance(double x)
The default implementation creates the instance by adding
the value to getField().getZero()
. This is not optimal
and does not work when called with a negative zero as the
sign of zero is lost with the addition. The default implementation
should therefore be overridden in concrete classes. The default
implementation will be removed at the next major version.
newInstance
in interface CalculusFieldElement<Dfp>
newInstance
in class Dfp
x
- constant real valuepublic Dfp newInstance(Dfp d)
newInstance
in class Dfp
d
- instance to copypublic Dfp newInstance(String s)
newInstance
in class Dfp
s
- string representation of the instancepublic Dfp newInstance(byte sign, byte nans)
newInstance
in class Dfp
sign
- sign of the Dfp to createnans
- code of the value, must be one of Dfp.INFINITE
,
Dfp.SNAN
, Dfp.QNAN
protected int getDecimalDigits()
Dfp.getRadixDigits()
*4-3. Subclasses can
override this to return something less.protected int round(int in)
Copyright © 2016–2020 Hipparchus.org. All rights reserved.