Maven module :un.api : api-math :
Class : un.impl.number.LargeDecimal
Extends/Implements : un.impl.number.un.api.number.Number
Subclasses : -

/* REQUIRED OPERATIONS:
Arithmetic operations (add, subtract, multiply, divide, square root, fused multiply–add, remainder...)
add(LargeDecimal) [x]
subtract(LargeDecimal) [x]
multiply(LargeDecimal) [x]
divide(LargeDecimal) [x]
sqrt() [x]
fma(LargeDecimal, LargeDecimal) [x]
mod(LargeDecimal) [x]
pow(int) [x]

Conversions (between formats, to and from strings, etc.)
toString() [x]

Scaling
Scale: decimal position? [x]

Copying and manipulating the sign (abs, negate, etc.)
abs() [x]
negate() [x]

Comparisons and total ordering
compare() [x]
equals() [x]
getSign() [x]

Classification and testing for NaNs, etc.
NaN, Infinity, Sign [x]

Testing and setting flags... [x]

Miscellaneous/Optional operations.
ceil() [x]
floor() [x]
round() [x]
... [?] TODO: Add more optional operations

roundingMode() [x]

SheNaNigans
Deal with operations by 0, [x]
infinities, or NaN


Variables : NEGATIVE, POSITIVE, ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_UNNECESSARY, ROUND_UP, NEGATIVE_ONE, ZERO, ONE, TEN, ONE_TENTH, INFINITY, NEGATIVE_INFINITY, NAN
Functions : LargeDecimal, setDecimalSeparator, setThousandsSeparator, setUseThousandsSeparator, flipSeparators, setPrecision, setThrowExceptionOnNaN, setThrowExceptionOnDivisionByZero, setUseInfinityOnDivisionByZero, zero, isZero, one, isOne, abs, negate, fma, add, mult, subtract, divide, ceil, round, round, floor, mod, mod, pow, powNaN, sqrt, root, toInteger, toLong, toFloat, toDouble, equals, compare, toString


public boolean NEGATIVE

public boolean POSITIVE


Rounding mode to round towards positive infinity.
public int ROUND_CEILING


Rounding mode to round towards zero.
public int ROUND_DOWN


Rounding mode to round towards negative infinity.
public int ROUND_FLOOR


Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
in which case round down.
public int ROUND_HALF_DOWN


Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
in which case, round towards the even neighbor.
public int ROUND_HALF_EVEN


Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
in which case round up.
public int ROUND_HALF_UP


Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
public int ROUND_UNNECESSARY


Rounding mode to round away from zero.
public int ROUND_UP



public LargeDecimal NEGATIVE_ONE

public LargeDecimal ZERO

public LargeDecimal ONE

public LargeDecimal TEN

public LargeDecimal ONE_TENTH

public LargeDecimal INFINITY

public LargeDecimal NEGATIVE_INFINITY

public LargeDecimal NAN



Creates a LargeDecimal representation of a decimal number.

@param decimal The String representation of a decimal number. Example: "3.14159"
public void LargeDecimal (String decimal)


Sets the decimal separator character to be used for String conversions.

@param decimalSeparator The new character to be used as a decimal separator. (Default: '.')
@throws IllegalAccessException if decimalSeparator == thousandsSeparator
public void setDecimalSeparator (char decimalSeparator)


Sets the thousands separator character to be used for String conversions.

@param thousandsSeparator The new character to be used as a thousands separator. (Default: ',')
@throws IllegalAccessException if thousandsSeparator == decimalSeparator
public void setThousandsSeparator (char thousandsSeparator)


Determines whether or not the thousands separator is used in the String output.
see  LargeDecimal#toString()
public void setUseThousandsSeparator (boolean b)


Switches the use of the thousands and decimal separators.
Switches the use of the thousands and decimal separators so that
the thousands separator becomes the decimal separator
and the decimal separator becomes the thousands separator.
public void flipSeparators ()


Sets the precision of LargeDecimals. (Default: 128)
param  precision The precision of LargeDecimals beyond the decimal point
public void setPrecision (int precision)


Determines whether or not to throw an exception when NaN is used in calculations.
public void setThrowExceptionOnNaN (boolean b)


Determines whether or not to throw an exception when dividing by zero.
public void setThrowExceptionOnDivisionByZero (boolean b)


Determines whether division by zero yields Infinity or NaN if division by zero does not throw an exception.
see  LargeDecimal#setThrowExceptionOnDivisionByZero(boolean b)
public void setUseInfinityOnDivisionByZero (boolean b)

public Arithmetic zero ()

public boolean isZero ()

public Arithmetic one ()

public boolean isOne ()


Returns the absolute value of this LargeDecimal
return  a new LargeDecimal with the value of |this|
public LargeDecimal abs ()


Negates this LargeDecimal
If this LargeDecimal is positive, it becomes negative.
If this LargeDecimal is negative, it becomes positive.
return  a new LargeDecimal with the value of -(this).
public LargeDecimal negate ()


Multiplies this LargeDecimal by the multiplicand, then adds the addend.
param  multiplicand The value to multiply by.
param  addend The value to add.
return  a new LargeDecimal with the value of (this * multiplicand) + addend
public LargeDecimal fma (LargeDecimal multiplicand, LargeDecimal addend)


Adds this by the addend.
param  add The value to add.
return  a new LargeDecimal with the value of this + addend.
public LargeDecimal add (Arithmetic add)


Multiplies this LargeDecimal by the multiplicand.
param  mul The value to multiply by.
return  a new LargeDecimal with the value of this * multiplicand.
public LargeDecimal mult (Arithmetic mul)


Subtracts this by the subtrahend.
param  sub The value to subtract by.
return  a new LargeDecimal with the value of this - subtrahend.
public LargeDecimal subtract (Arithmetic sub)


Divides this by the divisor.
param  div The value to divide by.
return  a new LargeDecimal with the value of this/divisor.
public LargeDecimal divide (Arithmetic div)


Rounds a LargeDecimal towards +infinity at a certain decimal digit.
param  precision The precision beyond the decimal point
return  a new LargeDecimal with the value of this.round(precision, ROUND_CEILING)
public LargeDecimal ceil (int precision)


Rounds a LargeDecimal using the default/preset roundingMode.
param  precision The precision beyond the decimal point
return  a new LargeDecimal with the value of this.round(precision, roundingMode)
public LargeDecimal round (int precision)


Rounds a LargeDecimal using the specified roundingMode.
param  precision The precision beyond the decimal point
param  roundingMode The rounding mode to be used for this calculation.
return  a new LargeDecimal with the value of this.round(precision, roundingMode)
see  LargeDecimal#ROUND_CEILING
see  LargeDecimal#ROUND_FLOOR
see  LargeDecimal#ROUND_DOWN
see  LargeDecimal#ROUND_UP
see  LargeDecimal#ROUND_HALF_UP
see  LargeDecimal#ROUND_HALF_EVEN
see  LargeDecimal#ROUND_HALF_DOWN
public LargeDecimal round (int precision, int roundingMode)


Rounds a LargeDecimal towards -infinity at a certain decimal digit.
param  precision The precision beyond the decimal point
return  a new LargeDecimal with the value of this.round(precision, ROUND_FLOOR)
public LargeDecimal floor (int precision)


Returns the LargeDecimal integer value of this % divisor using the specified rounding mode.
param  divisor The LargeDecimal to divide by.
param  roundingMode The rounding mode to be used for this calculation.
return  a new LargeDecimal with the value of this % divisor
public LargeDecimal mod (LargeDecimal divisor, int roundingMode)


Returns the LargeDecimal integer value of this % divisor using ROUND_DOWN as the rounding mode.
param  divisor The LargeDecimal to divide by.
return  a new LargeDecimal with the value of this % divisor
public LargeDecimal mod (LargeDecimal divisor)



public LargeDecimal pow (int n)


Calculates this to the power of n, where n is an integer value.
param  n
return  a new LargeDecimal with the value of this^(n)
Returns NAN when performing ±∞^0 or 0^0
public LargeDecimal powNaN (int n)


Calculates the square root of a LargeDecimal
return  a new LargeDecimal with the value of the square root of the original.
public LargeDecimal sqrt ()


Calculates the nth root of a LargeDecimal where n is a natural number
return  a new LargeDecimal with the value of the nth root of the original.
public LargeDecimal root (int n)

public int toInteger ()

public long toLong ()

public float toFloat ()

public double toDouble ()


Determines whether this LargeDecimal is equal to the secondary LargeDecimal
param  secondary The LargeDecimal to compare against.
return  a boolean if this is equal to secondary.
public boolean equals (LargeDecimal secondary)


Returns an integer value between -1 and 1 to specify the comparison between this LargeDecimal and the comparator LargeDecimal

@param comparator The LargeDecimal to compare against.
@return an integer with the value of...
1 if: this > comparator
0 if: this == comparator
-1 if: this < comparator
public int compare (LargeDecimal comparator)

public String toString ()