Java org.apache.commons.math3.fraction BigFraction fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.math3.fraction BigFraction fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.math3.fraction BigFraction.

The text is from its open source code.

Field

BigFractionTWO
A fraction representing "2 / 1".
BigFractionONE
A fraction representing "1".
BigFractionZERO
A fraction representing "0".
BigFractionMINUS_ONE
A fraction representing "-1 / 1".
BigFractionONE_HALF
A fraction representing "1/2".
BigFractionONE_THIRD
A fraction representing "1/3".

Constructor

BigFraction(final BigInteger num)

Create a BigFraction equivalent to the passed BigInteger, ie "num / 1".

BigFraction(final double value)
Create a fraction given the double value.
BigFraction(final int num)

Create a BigFraction equivalent to the passed int, ie "num / 1".

BigFraction(final long num)

Create a BigFraction equivalent to the passed long, ie "num / 1".

BigFraction(BigInteger num, BigInteger den)
Create a BigFraction given the numerator and denominator as BigInteger .
BigFraction(final double value, final int maxDenominator)
Create a fraction given the double value and maximum denominator.
BigFraction(final int num, final int den)

Create a BigFraction given the numerator and denominator as simple int.

BigFraction(final long num, final long den)

Create a BigFraction given the numerator and denominator as simple long.

BigFraction(final double value, final double epsilon, final int maxIterations)
Create a fraction given the double value and maximum error allowed.

Method

BigFractionadd(final BigInteger bg)

Adds the value of this fraction to the passed BigInteger , returning the result in reduced form.

BigFractionadd(final int i)

Adds the value of this fraction to the passed integer, returning the result in reduced form.

BigFractionadd(final long l)

Adds the value of this fraction to the passed long, returning the result in reduced form.

BigFractionadd(final BigFraction fraction)

Adds the value of this fraction to another, returning the result in reduced form.

BigDecimalbigDecimalValue(final int scale, final int roundingMode)

Gets the fraction as a BigDecimal following the passed scale and rounding mode.

intcompareTo(final BigFraction object)

Compares this object to another based on size.

BigFractiondivide(final BigInteger bg)

Divide the value of this fraction by the passed BigInteger , ie this * 1 / bg , returning the result in reduced form.

BigFractiondivide(final int i)

Divide the value of this fraction by the passed int , ie this * 1 / i , returning the result in reduced form.

BigFractiondivide(final long l)

Divide the value of this fraction by the passed long , ie this * 1 / l , returning the result in reduced form.

BigFractiondivide(final BigFraction fraction)

Divide the value of this fraction by another, returning the result in reduced form.

doubledoubleValue()

Gets the fraction as a double.

booleanequals(final Object other)

Test for the equality of two fractions.

intgetDenominatorAsInt()

Access the denominator as a int.

longgetDenominatorAsLong()

Access the denominator as a long.

BigIntegergetNumerator()

Access the numerator as a BigInteger.

longgetNumeratorAsLong()

Access the numerator as a long.

BigFractionmultiply(final BigInteger bg)

Multiplies the value of this fraction by the passed BigInteger, returning the result in reduced form.

BigFractionmultiply(final int i)

Multiply the value of this fraction by the passed int, returning the result in reduced form.

BigFractionmultiply(final long l)

Multiply the value of this fraction by the passed long, returning the result in reduced form.

BigFractionmultiply(final BigFraction fraction)

Multiplies the value of this fraction by another, returning the result in reduced form.

BigFractionnegate()

Return the additive inverse of this fraction, returning the result in reduced form.

doublepercentageValue()

Gets the fraction percentage as a double.

BigFractionpow(final int exponent)

Returns a BigFraction whose value is (thisexponent) , returning the result in reduced form.

BigFractionpow(final long exponent)

Returns a BigFraction whose value is (thisexponent), returning the result in reduced form.

BigFractionpow(final BigInteger exponent)

Returns a BigFraction whose value is (thisexponent), returning the result in reduced form.

doublepow(final double exponent)

Returns a double whose value is (thisexponent), returning the result in reduced form.

BigFractionreduce()

Reduce this BigFraction to its lowest terms.

BigFractionsubtract(final BigInteger bg)

Subtracts the value of an BigInteger from the value of this BigFraction , returning the result in reduced form.

BigFractionsubtract(final int i)

Subtracts the value of an integer from the value of this BigFraction , returning the result in reduced form.

BigFractionsubtract(final long l)

Subtracts the value of a long from the value of this BigFraction , returning the result in reduced form.

BigFractionsubtract(final BigFraction fraction)

Subtracts the value of another fraction from the value of this one, returning the result in reduced form.

StringtoString()

Returns the String representing this fraction, ie "num / dem" or just "num" if the denominator is one.