| Modifier and Type | Field and Description |
|---|---|
| private final int | denominator
The denominator. |
| private final int | numerator
The numerator. |
| Access | Constructor and Description |
|---|---|
| public | SimpleFraction(int
the numerator numerator, int maxDenominator The maximum allowed value for denominator denominator)Create a fraction given a numerator and denominator. |
| Modifier and Type | Method and Description |
|---|---|
| public static SimpleFraction | Returns: a SimpleFraction with the given values set.double value of fraction val, int the exact denominator exactDenom)Create a fraction given a double value and a denominator. |
| public static SimpleFraction | buildFractionMaxDenominator(double
the double value to convert to a fraction. value, int maximum denominator value allowed. maxDenominator)Create a fraction given the double value and either the maximum error allowed or the maximum number of denominator digits. |
| private static SimpleFraction | buildFractionMaxDenominator(double
the double value to convert to a fraction. value, double maximum error allowed. The resulting fraction is within
epsilon, int epsilon of value, in absolute terms.maximum denominator value allowed. maxDenominator, int maximum number of convergents maxIterations)Create a fraction given the double value and either the maximum error allowed or the maximum number of denominator digits. |
| public int | |
| public int |
| denominator | back to summary |
|---|---|
| private final int denominator The denominator. | |
| numerator | back to summary |
|---|---|
| private final int numerator The numerator. | |
| SimpleFraction | back to summary |
|---|---|
| public SimpleFraction(int numerator, int denominator) Create a fraction given a numerator and denominator.
| |
| buildFractionExactDenominator | back to summary |
|---|---|
| public static SimpleFraction buildFractionExactDenominator(double val, int exactDenom) Create a fraction given a double value and a denominator.
| |
| buildFractionMaxDenominator | back to summary |
|---|---|
| public static SimpleFraction buildFractionMaxDenominator(double value, int maxDenominator) Create a fraction given the double value and either the maximum error allowed or the maximum number of denominator digits.
| |
| buildFractionMaxDenominator | back to summary |
|---|---|
| private static SimpleFraction buildFractionMaxDenominator(double value, double epsilon, int maxDenominator, int maxIterations) Create a fraction given the double value and either the maximum error allowed or the maximum number of denominator digits. References:
| |
| getDenominator | back to summary |
|---|---|
| public int getDenominator() Access the denominator.
| |
| getNumerator | back to summary |
|---|---|
| public int getNumerator() Access the numerator.
| |