public class Ratio
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
Ratio |
add(Ratio r) |
static Ratio |
create(double number) |
static Ratio |
create(java.lang.String s)
parse aaa.bbbbEcc into Ratio.
|
Ratio |
divide(Ratio r) |
double |
doubleValue()
return the double value closest to this.
|
boolean |
equals(java.lang.Object o) |
static long |
gcd(long a,
long d)
return the Greatest Common Divisor (GCD) of the two numbers.
|
int |
hashCode() |
boolean |
isOne() |
boolean |
isZero() |
static void |
main(java.lang.String[] args) |
Ratio |
multiply(Ratio r) |
Ratio |
pow(Ratio r) |
Ratio |
sqrt() |
Ratio |
subtract(Ratio r) |
java.lang.String |
toString() |
public static long gcd(long a, long d)
a
- the first numberd
- the second number, slightly more efficient if this is smaller.public static Ratio create(java.lang.String s)
s
- public static Ratio create(double number)
public Ratio sqrt()
public boolean isZero()
public boolean isOne()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public double doubleValue()
public static void main(java.lang.String[] args)