Class BigFloat.SpecialBigFloat
- java.lang.Object
-
- ch.obermuhlner.math.big.BigFloat
-
- ch.obermuhlner.math.big.BigFloat.SpecialBigFloat
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BigFloat.SpecialBigFloat.Type
-
Nested classes/interfaces inherited from class ch.obermuhlner.math.big.BigFloat
BigFloat.Context
-
-
Field Summary
Fields Modifier and Type Field Description private static BigFloat.Context
DUMMY_CONTEXT
private BigFloat.SpecialBigFloat.Type
type
-
Fields inherited from class ch.obermuhlner.math.big.BigFloat
NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY
-
-
Constructor Summary
Constructors Modifier Constructor Description private
SpecialBigFloat(BigFloat.SpecialBigFloat.Type type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigFloat
add(BigFloat x)
Returns theBigFloat
that isthis + x
.int
compareTo(BigFloat other)
BigFloat
divide(BigFloat x)
Returns theBigFloat
that isthis / x
.boolean
equals(java.lang.Object obj)
BigFloat.Context
getContext()
Returns theBigFloat.Context
ofthis
value.BigFloat
getExponent()
Returns the exponent ofthis
value written as mantissa * 10exponent.BigFloat
getFractionalPart()
Returns the fractional part ofthis
value (right of the decimal point).BigFloat
getIntegralPart()
Returns the integral part ofthis
value (left of the decimal point).BigFloat
getMantissa()
Returns the mantissa ofthis
value written as mantissa * 10exponent.int
hashCode()
boolean
isDoubleValue()
Returns whetherthis
specifiedBigDecimal
value can be represented asdouble
.boolean
isIntValue()
Returns whetherthis
value can be represented asint
.boolean
isNegative()
Returns whether thisBigFloat
is negative.boolean
isPositive()
Returns whether thisBigFloat
is positive.protected boolean
isSpecial()
boolean
isZero()
Returns whether thisBigFloat
is 0.BigFloat
multiply(BigFloat x)
Returns theBigFloat
that isthis * x
.BigFloat
pow(BigFloat y)
BigFloat
remainder(BigFloat x)
BigFloat
root(BigFloat y)
int
signum()
Returns the signum function of thisBigFloat
.BigFloat
subtract(BigFloat x)
Returns theBigFloat
that isthis - x
.BigFloat
subtract(java.math.BigDecimal x)
Returns theBigFloat
that isthis - x
.java.math.BigDecimal
toBigDecimal()
Returnsthis
value as aBigDecimal
value.double
toDouble()
Returnsthis
value as adouble
value.int
toInt()
Returnsthis
value as aint
value.long
toLong()
Returnsthis
value as along
value.java.lang.String
toString()
protected BigFloat.SpecialBigFloat.Type
type()
return special type of a value-
Methods inherited from class ch.obermuhlner.math.big.BigFloat
abs, acos, acosh, acot, acoth, add, add, add, add, asin, asinh, atan, atanh, context, context, cos, cosh, cot, coth, divide, divide, divide, divide, exp, isBetween, isEqual, isGreaterThan, isGreaterThanOrEqual, isInfinity, isLessThan, isLessThanOrEqual, isNaN, log, log10, log2, max, max, min, min, multiply, multiply, multiply, multiply, negate, pow, pow, pow, pow, pow, remainder, remainder, remainder, remainder, root, root, root, root, root, sin, sinh, sqrt, subtract, subtract, subtract, tan, tanh
-
-
-
-
Field Detail
-
DUMMY_CONTEXT
private static final BigFloat.Context DUMMY_CONTEXT
-
type
private final BigFloat.SpecialBigFloat.Type type
-
-
Constructor Detail
-
SpecialBigFloat
private SpecialBigFloat(BigFloat.SpecialBigFloat.Type type)
-
-
Method Detail
-
type
protected BigFloat.SpecialBigFloat.Type type()
Description copied from class:BigFloat
return special type of a value- Overrides:
type
in classBigFloat
- Returns:
BigFloat.SpecialBigFloat.Type
-
add
public BigFloat add(BigFloat x)
Description copied from class:BigFloat
Returns theBigFloat
that isthis + x
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.
-
subtract
public BigFloat subtract(BigFloat x)
Description copied from class:BigFloat
Returns theBigFloat
that isthis - x
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.
-
subtract
public BigFloat subtract(java.math.BigDecimal x)
Description copied from class:BigFloat
Returns theBigFloat
that isthis - x
.
-
multiply
public BigFloat multiply(BigFloat x)
Description copied from class:BigFloat
Returns theBigFloat
that isthis * x
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.
-
divide
public BigFloat divide(BigFloat x)
Description copied from class:BigFloat
Returns theBigFloat
that isthis / x
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.
-
remainder
public BigFloat remainder(BigFloat x)
Description copied from class:BigFloat
Returns theBigFloat
that is the remainder when dividingthis
byx
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.
-
pow
public BigFloat pow(BigFloat y)
Description copied from class:BigFloat
Returns theBigFloat
that isthis
to the power ofy
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.- Overrides:
pow
in classBigFloat
- Parameters:
y
- the value of the power- Returns:
- the resulting
BigFloat
- See Also:
BigDecimalMath.pow(BigDecimal, BigDecimal, MathContext)
-
root
public BigFloat root(BigFloat y)
Description copied from class:BigFloat
Returns theBigFloat
that is they
th root ofthis
.If the two values do not have the same
BigFloat.Context
, the result will contain theBigFloat.Context
with the larger precision.- Overrides:
root
in classBigFloat
- Parameters:
y
- the value of the root- Returns:
- the resulting
BigFloat
- See Also:
BigDecimalMath.root(BigDecimal, BigDecimal, MathContext)
-
signum
public int signum()
Description copied from class:BigFloat
Returns the signum function of thisBigFloat
.
-
isNegative
public boolean isNegative()
Description copied from class:BigFloat
Returns whether thisBigFloat
is negative.- Overrides:
isNegative
in classBigFloat
- Returns:
true
if negative,false
if 0 or positive
-
isZero
public boolean isZero()
Description copied from class:BigFloat
Returns whether thisBigFloat
is 0.
-
isPositive
public boolean isPositive()
Description copied from class:BigFloat
Returns whether thisBigFloat
is positive.- Overrides:
isPositive
in classBigFloat
- Returns:
true
if positive,false
if 0 or negative
-
compareTo
public int compareTo(BigFloat other)
-
isIntValue
public boolean isIntValue()
Description copied from class:BigFloat
Returns whetherthis
value can be represented asint
.- Overrides:
isIntValue
in classBigFloat
- Returns:
true
if the value can be represented asint
value- See Also:
BigDecimalMath.isIntValue(BigDecimal)
-
isDoubleValue
public boolean isDoubleValue()
Description copied from class:BigFloat
Returns whetherthis
specifiedBigDecimal
value can be represented asdouble
.- Overrides:
isDoubleValue
in classBigFloat
- Returns:
true
if the value can be represented asdouble
value- See Also:
BigDecimalMath.isDoubleValue(BigDecimal)
-
getMantissa
public BigFloat getMantissa()
Description copied from class:BigFloat
Returns the mantissa ofthis
value written as mantissa * 10exponent.The mantissa is defined as having exactly 1 digit before the decimal point.
- Overrides:
getMantissa
in classBigFloat
- Returns:
- the mantissa
- See Also:
BigFloat.getExponent()
,BigDecimalMath.mantissa(BigDecimal)
-
getExponent
public BigFloat getExponent()
Description copied from class:BigFloat
Returns the exponent ofthis
value written as mantissa * 10exponent.The mantissa is defined as having exactly 1 digit before the decimal point.
- Overrides:
getExponent
in classBigFloat
- Returns:
- the exponent
- See Also:
BigFloat.getMantissa()
,BigDecimalMath.exponent(BigDecimal)
-
getIntegralPart
public BigFloat getIntegralPart()
Description copied from class:BigFloat
Returns the integral part ofthis
value (left of the decimal point).- Overrides:
getIntegralPart
in classBigFloat
- Returns:
- the integral part
- See Also:
BigFloat.getFractionalPart()
,BigDecimalMath.fractionalPart(BigDecimal)
-
getFractionalPart
public BigFloat getFractionalPart()
Description copied from class:BigFloat
Returns the fractional part ofthis
value (right of the decimal point).- Overrides:
getFractionalPart
in classBigFloat
- Returns:
- the fractional part
- See Also:
BigFloat.getIntegralPart()
,BigDecimalMath.fractionalPart(BigDecimal)
-
getContext
public BigFloat.Context getContext()
Description copied from class:BigFloat
Returns theBigFloat.Context
ofthis
value.- Overrides:
getContext
in classBigFloat
- Returns:
- the
BigFloat.Context
-
toBigDecimal
public java.math.BigDecimal toBigDecimal()
Description copied from class:BigFloat
Returnsthis
value as aBigDecimal
value.- Overrides:
toBigDecimal
in classBigFloat
- Returns:
- the
BigDecimal
value
-
toDouble
public double toDouble()
Description copied from class:BigFloat
Returnsthis
value as adouble
value.
-
toLong
public long toLong()
Description copied from class:BigFloat
Returnsthis
value as along
value.
-
toInt
public int toInt()
Description copied from class:BigFloat
Returnsthis
value as aint
value.
-
-