Example usage for Java org.apache.commons.math3.fraction Fraction fields, constructors, methods, implement or subclass
The text is from its open source code.
Fraction(double value, int maxDenominator) Create a fraction given the double value and maximum denominator. | |
Fraction(int num, int den) Create a fraction given the numerator and denominator. | |
Fraction(double value) Create a fraction given the double value. | |
Fraction(int num) Create a fraction from an int. |
Fraction | abs() Returns the absolute value of this fraction. |
Fraction | add(Fraction fraction) Adds the value of this fraction to another, returning the result in reduced form. |
Fraction | add(final int i) Add an integer to the fraction. |
Fraction | divide(Fraction fraction) Divide the value of this fraction by another. |
Fraction | divide(final int i) Divide the fraction by an integer. |
double | doubleValue() Gets the fraction as a double. |
int | getDenominator() Access the denominator. |
int | getNumerator() Access the numerator. |
int | intValue() Gets the fraction as an int. |
Fraction | multiply(Fraction fraction) Multiplies the value of this fraction by another, returning the result in reduced form. |
Fraction | multiply(final int i) Multiply the fraction by an integer. |
Fraction | negate() Return the additive inverse of this fraction. |
double | percentageValue() Gets the fraction percentage as a double. |
Fraction | subtract(Fraction fraction) Subtracts the value of another fraction from the value of this one, returning the result in reduced form. |
Fraction | subtract(final int i) Subtract an integer from the fraction. |
String | toString() Returns the String representing this fraction, ie "num / dem" or just "num" if the denominator is one. |