Package net.imglib2.util
Class Fraction
java.lang.Object
net.imglib2.util.Fraction
Implements the concept of fractions
- Author:
- Stephan Preibisch
-
Constructor Details
-
Fraction
public Fraction(long numerator, long denominator) Creates a new fraction with the respective values- Parameters:
numerator
- (above fraction bar)denominator
- (below fraction bar)
-
Fraction
public Fraction()Instantiate aFraction
with a value of 1
-
-
Method Details
-
getNumerator
public long getNumerator()- Returns:
- - the numerator (above the fraction bar)
-
getDenominator
public long getDenominator()- Returns:
- - the denominator (below the fraction bar)
-
getRatio
public double getRatio()- Returns:
- - an estimate of the ratio in double, i.e. numerator/denominator
-
invert
public void invert()Inverts this fraction by exchanging numerator and denominator -
mul
-
div
-
mulCeil
public long mulCeil(long value) Multiply the value with this fraction. Return the ceiled value (e.g. 10.2 = 11) if the result is a fraction.- Parameters:
value
-- Returns:
-
clone
-