Example usage for Java org.apache.commons.lang.math Fraction fields, constructors, methods, implement or subclass
The text is from its open source code.
Fraction | TWO_THIRDSFraction representation of 2/3. |
Fraction | divideBy(Fraction fraction) Divide the value of this fraction by another. |
double | doubleValue() Gets the fraction as a |
boolean | equals(Object obj) Compares this fraction to another object to test if they are equal. . |
int | getDenominator() Gets the denominator part of the fraction. |
Fraction | getFraction(int whole, int numerator, int denominator) Creates a The negative sign must be passed in on the whole number part. |
Fraction | getFraction(int numerator, int denominator) Creates a Any negative signs are resolved to be on the numerator. |
Fraction | getFraction(double value) Creates a This method uses the continued fraction algorithm, computing a maximum of 25 convergents and bounding the denominator by 10,000. |
Fraction | getFraction(String str) Creates a Fraction from a The formats accepted are:
|
int | getNumerator() Gets the numerator part of the fraction. This method may return a value greater than the denominator, an improper fraction, such as the seven in 7/4. |
Fraction | multiplyBy(Fraction fraction) Multiplies the value of this fraction by another, returning the result in reduced form. |
Fraction | reduce() Reduce the fraction to the smallest values for the numerator and denominator, returning the result. For example, if this fraction represents 2/4, then the result will be 1/2. |