- getFraction
Creates a Fraction from a String.
The formats accepted are:
1. double String containing a dot
2.
- equals
Compares this fraction to another object to test if they are equal.
.To be equal, both values must
- getDenominator
Gets the denominator part of the fraction.
- getNumerator
Gets the numerator part of the fraction.
This method may return a value greater than the denominato
- <init>
Constructs a Fraction instance with the 2 parts of a fraction Y/Z.
- addAndCheck
Add two integers, checking for overflow.
- addSub
Implement add and subtract using algorithm described in Knuth 4.5.1.
- getProperWhole
Gets the proper whole part of the fraction.
An improper fraction 7/4 can be resolved into a proper
- getReducedFraction
Creates a reduced Fraction instance with the 2 parts of a fraction Y/Z.
For example, if the input p
- greatestCommonDivisor
Gets the greatest common divisor of the absolute value of two numbers, using the
"binary gcd" method
- invert
Gets a fraction that is the inverse (1/fraction) of this one.
The returned fraction is not reduced.
- mulAndCheck
Multiply two integers, checking for overflow.