Modifier and Type | Field and Description |
---|---|
static Fraction |
Fraction.ONE
A fraction representing "1".
|
static Fraction |
Fraction.ZERO
A fraction representing "0".
|
Modifier and Type | Method and Description |
---|---|
Fraction |
Fraction.abs()
Returns the absolute value of this fraction.
|
Fraction |
Fraction.add(Fraction value)
Adds the specified
value to this fraction, returning
the result in reduced form. |
Fraction |
Fraction.add(int value)
Adds the specified
value to this fraction, returning
the result in reduced form. |
Fraction |
Fraction.divide(Fraction value)
Divide this fraction by the passed
value , returning
the result in reduced form. |
Fraction |
Fraction.divide(int value)
Divide this fraction by the passed
value , returning
the result in reduced form. |
static Fraction |
Fraction.from(double value)
Create a fraction given the double value.
|
static Fraction |
Fraction.from(double value,
double epsilon,
int maxIterations)
Create a fraction given the double value and maximum error allowed.
|
static Fraction |
Fraction.from(double value,
int maxDenominator)
Create a fraction given the double value and maximum denominator.
|
Fraction |
Fraction.multiply(Fraction value)
Multiply this fraction by the passed
value , returning
the result in reduced form. |
Fraction |
Fraction.multiply(int value)
Multiply this fraction by the passed
value , returning
the result in reduced form. |
Fraction |
Fraction.negate() |
static Fraction |
Fraction.of(int num)
Create a fraction given the numerator.
|
static Fraction |
Fraction.of(int num,
int den)
Create a fraction given the numerator and denominator.
|
Fraction |
Fraction.one() |
static Fraction |
Fraction.parse(String s)
Returns a
Fraction instance representing the specified string s . |
Fraction |
Fraction.pow(int exponent)
Returns a
Fraction whose value is
thisexponent , returning the result in reduced form. |
Fraction |
Fraction.reciprocal() |
Fraction |
Fraction.subtract(Fraction value)
Subtracts the specified
value from this fraction, returning
the result in reduced form. |
Fraction |
Fraction.subtract(int value)
Subtracts the specified
value from this fraction, returning
the result in reduced form. |
Fraction |
Fraction.zero() |
Modifier and Type | Method and Description |
---|---|
Fraction |
Fraction.add(Fraction value)
Adds the specified
value to this fraction, returning
the result in reduced form. |
int |
Fraction.compareTo(Fraction other)
Compares this object with the specified object for order using the signed magnitude.
|
Fraction |
Fraction.divide(Fraction value)
Divide this fraction by the passed
value , returning
the result in reduced form. |
Fraction |
Fraction.multiply(Fraction value)
Multiply this fraction by the passed
value , returning
the result in reduced form. |
Fraction |
Fraction.subtract(Fraction value)
Subtracts the specified
value from this fraction, returning
the result in reduced form. |
Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.