Modifier and Type | Field and Description |
---|---|
static Fraction |
Fraction.ONE
A fraction representing "1".
|
static Fraction |
Fraction.ZERO
A fraction representing "0".
|
Modifier and Type | Method and Description |
---|---|
Fraction |
Fraction.abs()
Returns the absolute value of this fraction.
|
Fraction |
Fraction.add(Fraction fraction)
Adds the value of this fraction to another, returning the result
in reduced form.
|
Fraction |
Fraction.add(int i)
Adds an integer to the fraction.
|
Fraction |
Fraction.divide(Fraction fraction)
Divides the value of this fraction by another.
|
Fraction |
Fraction.divide(int i)
Divides the fraction by an integer.
|
static Fraction |
Fraction.from(double value)
Creates an instance.
|
static Fraction |
Fraction.from(double value,
double epsilon,
int maxIterations)
Create a fraction given the double value and maximum error allowed.
|
static Fraction |
Fraction.from(double value,
int maxDenominator)
Creates an instance.
|
Fraction |
Fraction.multiply(Fraction fraction)
Multiplies the value of this fraction by another, returning the
result in reduced form.
|
Fraction |
Fraction.multiply(int i)
Multiplies the fraction by an integer.
|
Fraction |
Fraction.negate()
Computes the additive inverse of this fraction.
|
static Fraction |
Fraction.of(int num)
Creates an instance.
|
static Fraction |
Fraction.of(int num,
int den)
Return a fraction given the numerator and denominator.
|
Fraction |
Fraction.one() |
static Fraction |
Fraction.parse(String s)
Parses a string that would be produced by
toString()
and instantiates the corresponding object. |
Fraction |
Fraction.pow(int n) |
Fraction |
Fraction.reciprocal()
Computes the multiplicative inverse of this fraction.
|
Fraction |
Fraction.subtract(Fraction fraction)
Subtracts the value of another fraction from the value of this one,
returning the result in reduced form.
|
Fraction |
Fraction.subtract(int i)
Subtracts an integer from this fraction.
|
Fraction |
Fraction.zero() |
Modifier and Type | Method and Description |
---|---|
Fraction |
Fraction.add(Fraction fraction)
Adds the value of this fraction to another, returning the result
in reduced form.
|
int |
Fraction.compareTo(Fraction other)
Compares this object to another based on size.
|
Fraction |
Fraction.divide(Fraction fraction)
Divides the value of this fraction by another.
|
Fraction |
Fraction.multiply(Fraction fraction)
Multiplies the value of this fraction by another, returning the
result in reduced form.
|
Fraction |
Fraction.subtract(Fraction fraction)
Subtracts the value of another fraction from the value of this one,
returning the result in reduced form.
|
Copyright © 2017–2020 The Apache Software Foundation. All rights reserved.