RingJavafor Ring

java.math

4 classes of the module java.base.

Load them with:

using {
	"java.math"
}

All packages

BigDecimal#

class · extends Number · java.math.BigDecimal

Implements: Comparable

Constructors

new BigDecimal(BigInteger val)
new BigDecimal(long val)
new BigDecimal(int val)
new BigDecimal(char[] in)
new BigDecimal(double val)
new BigDecimal(String val)
new BigDecimal(BigInteger unscaledVal, int scale)
new BigDecimal(BigInteger val, MathContext mc)
new BigDecimal(long val, MathContext mc)
new BigDecimal(double val, MathContext mc)
new BigDecimal(int val, MathContext mc)
new BigDecimal(String val, MathContext mc)
new BigDecimal(char[] in, MathContext mc)
new BigDecimal(BigInteger unscaledVal, int scale, MathContext mc)
new BigDecimal(char[] in, int offset, int len)
new BigDecimal(char[] in, int offset, int len, MathContext mc)

Ring: new BigDecimal(args) uses the constructor with the fewest parameters (at least one); new BigDecimal makes the object with the constructor without parameters; the others: (new BigDecimal).@New([ :param = value ]) or .@New([v1,v2]).

Fields

NameTypeAccessIn Ring
ZEROBigDecimalconstant · statico.ZERO
ONEBigDecimalconstant · statico.ONE
TWOBigDecimalconstant · statico.TWO
TENBigDecimalconstant · statico.TEN
ROUND_UPintconstant · statico.ROUND_UP
ROUND_DOWNintconstant · statico.ROUND_DOWN
ROUND_CEILINGintconstant · statico.ROUND_CEILING
ROUND_FLOORintconstant · statico.ROUND_FLOOR
ROUND_HALF_UPintconstant · statico.ROUND_HALF_UP
ROUND_HALF_DOWNintconstant · statico.ROUND_HALF_DOWN
ROUND_HALF_EVENintconstant · statico.ROUND_HALF_EVEN
ROUND_UNNECESSARYintconstant · statico.ROUND_UNNECESSARY

Methods

MethodRing callJava overloads
@abs@abs(mc)BigDecimal abs(MathContext mc)
@negate@negate(mc)BigDecimal negate(MathContext mc)
@plus@plus(mc)BigDecimal plus(MathContext mc)
absabs()BigDecimal abs()
addadd(augend)
add([augend,mc])
add([ :augend = v, :mc = v ])
BigDecimal add(BigDecimal augend)
BigDecimal add(BigDecimal augend, MathContext mc)
byteValueExactbyteValueExact()byte byteValueExact()
compareTocompareTo(val)int compareTo(BigDecimal val)
dividedivide(divisor)
divide([divisor,roundingMode])
divide([ :divisor = v, :roundingMode = v ])
divide([divisor,scale,roundingMode])
divide([ :divisor = v, :scale = v, :roundingMode = v ])
BigDecimal divide(BigDecimal divisor)
BigDecimal divide(BigDecimal divisor, RoundingMode roundingMode)
BigDecimal divide(BigDecimal divisor, int roundingMode)
BigDecimal divide(BigDecimal divisor, MathContext mc)
BigDecimal divide(BigDecimal divisor, int scale, RoundingMode roundingMode)
BigDecimal divide(BigDecimal divisor, int scale, int roundingMode)
divideAndRemainderdivideAndRemainder(divisor)
divideAndRemainder([divisor,mc])
divideAndRemainder([ :divisor = v, :mc = v ])
BigDecimal[] divideAndRemainder(BigDecimal divisor)
BigDecimal[] divideAndRemainder(BigDecimal divisor, MathContext mc)
divideToIntegralValuedivideToIntegralValue(divisor)
divideToIntegralValue([divisor,mc])
divideToIntegralValue([ :divisor = v, :mc = v ])
BigDecimal divideToIntegralValue(BigDecimal divisor)
BigDecimal divideToIntegralValue(BigDecimal divisor, MathContext mc)
intValueExactintValueExact()int intValueExact()
longValueExactlongValueExact()long longValueExact()
maxmax(val)BigDecimal max(BigDecimal val)
minmin(val)BigDecimal min(BigDecimal val)
movePointLeftmovePointLeft(n)BigDecimal movePointLeft(int n)
movePointRightmovePointRight(n)BigDecimal movePointRight(int n)
multiplymultiply(multiplicand)
multiply([multiplicand,mc])
multiply([ :multiplicand = v, :mc = v ])
BigDecimal multiply(BigDecimal multiplicand)
BigDecimal multiply(BigDecimal multiplicand, MathContext mc)
negatenegate()BigDecimal negate()
plusplus()BigDecimal plus()
powpow(n)
pow([n,mc])
pow([ :n = v, :mc = v ])
BigDecimal pow(int n)
BigDecimal pow(int n, MathContext mc)
precisionprecision()int precision()
remainderremainder(divisor)
remainder([divisor,mc])
remainder([ :divisor = v, :mc = v ])
BigDecimal remainder(BigDecimal divisor)
BigDecimal remainder(BigDecimal divisor, MathContext mc)
roundround(mc)BigDecimal round(MathContext mc)
scalescale()int scale()
scaleByPowerOfTenscaleByPowerOfTen(n)BigDecimal scaleByPowerOfTen(int n)
setScalesetScale(newScale)
setScale([newScale,roundingMode])
setScale([ :newScale = v, :roundingMode = v ])
BigDecimal setScale(int newScale)
BigDecimal setScale(int newScale, RoundingMode roundingMode)
BigDecimal setScale(int newScale, int roundingMode)
shortValueExactshortValueExact()short shortValueExact()
signumsignum()int signum()
sqrtsqrt(mc)BigDecimal sqrt(MathContext mc)
stripTrailingZerosstripTrailingZeros()BigDecimal stripTrailingZeros()
subtractsubtract(subtrahend)
subtract([subtrahend,mc])
subtract([ :subtrahend = v, :mc = v ])
BigDecimal subtract(BigDecimal subtrahend)
BigDecimal subtract(BigDecimal subtrahend, MathContext mc)
toBigIntegertoBigInteger()BigInteger toBigInteger()
toBigIntegerExacttoBigIntegerExact()BigInteger toBigIntegerExact()
toEngineeringStringtoEngineeringString()String toEngineeringString()
toPlainStringtoPlainString()String toPlainString()
ulpulp()BigDecimal ulp()
unscaledValueunscaledValue()BigInteger unscaledValue()
valueOfvalueOf(val)
valueOf([unscaledVal,scale])
valueOf([ :unscaledVal = v, :scale = v ])
static BigDecimal valueOf(long val)
static BigDecimal valueOf(double val)
static BigDecimal valueOf(long unscaledVal, int scale)

The methods and fields of Number are inherited.

BigInteger#

class · extends Number · java.math.BigInteger

Implements: Comparable

Constructors

new BigInteger(String val)
new BigInteger(byte[] val)
new BigInteger(int numBits, Random rnd)
new BigInteger(String val, int radix)
new BigInteger(int signum, byte[] magnitude)
new BigInteger(int bitLength, int certainty, Random rnd)
new BigInteger(byte[] val, int off, int len)
new BigInteger(int signum, byte[] magnitude, int off, int len)

Ring: new BigInteger(args) uses the constructor with the fewest parameters (at least one); new BigInteger makes the object with the constructor without parameters; the others: (new BigInteger).@New([ :param = value ]) or .@New([v1,v2]).

Fields

NameTypeAccessIn Ring
ZEROBigIntegerconstant · statico.ZERO
ONEBigIntegerconstant · statico.ONE
TWOBigIntegerconstant · statico.TWO
TENBigIntegerconstant · statico.TEN

Methods

MethodRing callJava overloads
@and@and(val)BigInteger and(BigInteger val)
@not@not()BigInteger not()
@or@or(val)BigInteger or(BigInteger val)
@toString@toString(radix)String toString(int radix)
absabs()BigInteger abs()
addadd(val)BigInteger add(BigInteger val)
andNotandNot(val)BigInteger andNot(BigInteger val)
bitCountbitCount()int bitCount()
bitLengthbitLength()int bitLength()
byteValueExactbyteValueExact()byte byteValueExact()
clearBitclearBit(n)BigInteger clearBit(int n)
compareTocompareTo(val)int compareTo(BigInteger val)
dividedivide(val)BigInteger divide(BigInteger val)
divideAndRemainderdivideAndRemainder(val)BigInteger[] divideAndRemainder(BigInteger val)
flipBitflipBit(n)BigInteger flipBit(int n)
gcdgcd(val)BigInteger gcd(BigInteger val)
getLowestSetBitgetLowestSetBit()int getLowestSetBit()
intValueExactintValueExact()int intValueExact()
isProbablePrimeisProbablePrime(certainty)boolean isProbablePrime(int certainty)
longValueExactlongValueExact()long longValueExact()
maxmax(val)BigInteger max(BigInteger val)
minmin(val)BigInteger min(BigInteger val)
modmod(m)BigInteger mod(BigInteger m)
modInversemodInverse(m)BigInteger modInverse(BigInteger m)
modPowmodPow(exponent,m)BigInteger modPow(BigInteger exponent, BigInteger m)
multiplymultiply(val)BigInteger multiply(BigInteger val)
negatenegate()BigInteger negate()
nextProbablePrimenextProbablePrime()BigInteger nextProbablePrime()
parallelMultiplyparallelMultiply(val)BigInteger parallelMultiply(BigInteger val)
powpow(exponent)BigInteger pow(int exponent)
probablePrimeprobablePrime(bitLength,rnd)static BigInteger probablePrime(int bitLength, Random rnd)
remainderremainder(val)BigInteger remainder(BigInteger val)
setBitsetBit(n)BigInteger setBit(int n)
shiftLeftshiftLeft(n)BigInteger shiftLeft(int n)
shiftRightshiftRight(n)BigInteger shiftRight(int n)
shortValueExactshortValueExact()short shortValueExact()
signumsignum()int signum()
sqrtsqrt()BigInteger sqrt()
sqrtAndRemaindersqrtAndRemainder()BigInteger[] sqrtAndRemainder()
subtractsubtract(val)BigInteger subtract(BigInteger val)
testBittestBit(n)boolean testBit(int n)
toByteArraytoByteArray()byte[] toByteArray()
valueOfvalueOf(val)static BigInteger valueOf(long val)
xorxor(val)BigInteger xor(BigInteger val)

The methods and fields of Number are inherited.

MathContext#

class final · extends Object · java.math.MathContext

Implements: Serializable

Constructors

new MathContext(String val)
new MathContext(int setPrecision)
new MathContext(int setPrecision, RoundingMode setRoundingMode)

Ring: new MathContext(args) uses the constructor with the fewest parameters (at least one); new MathContext makes the object with the constructor without parameters; the others: (new MathContext).@New([ :param = value ]) or .@New([v1,v2]).

Fields

NameTypeAccessIn Ring
UNLIMITEDMathContextconstant · statico.UNLIMITED
DECIMAL32MathContextconstant · statico.DECIMAL32
DECIMAL64MathContextconstant · statico.DECIMAL64
DECIMAL128MathContextconstant · statico.DECIMAL128

Methods

MethodRing callJava overloads
getPrecisiongetPrecision()int getPrecision()
getRoundingModegetRoundingMode()RoundingMode getRoundingMode()

The methods and fields of Object are inherited.

RoundingMode#

enum · extends Enum · java.math.RoundingMode

Fields

NameTypeAccessIn Ring
UPRoundingModeconstant · statico.UP
DOWNRoundingModeconstant · statico.DOWN
CEILINGRoundingModeconstant · statico.CEILING
FLOORRoundingModeconstant · statico.FLOOR
HALF_UPRoundingModeconstant · statico.HALF_UP
HALF_DOWNRoundingModeconstant · statico.HALF_DOWN
HALF_EVENRoundingModeconstant · statico.HALF_EVEN
UNNECESSARYRoundingModeconstant · statico.UNNECESSARY

Methods

MethodRing callJava overloads
valueOfvalueOf(rm)
valueOf([enumClass,name])
valueOf([ :enumClass = v, :name = v ])
static RoundingMode valueOf(String rm)
static RoundingMode valueOf(int rm)
static Enum valueOf(Class enumClass, String name)
valuesvalues()static RoundingMode[] values()

The methods and fields of Enum are inherited.

RingJava - use Java classes and methods from Ring programs.