List of utility methods to do Fraction Create
double | frac(double number) Gets the decimal portion of the given double. return number - Math.floor(number);
|
double | Frac(double value) Frac return (value - Int(value));
|
double | frac(double value) frac return value - Math.floor(value);
|
double | Frac(double x) Fractional part of a number (y=x-|x|) return x - Math.floor(x);
|
int | frac(double x) Returns the fractional part of x, that is, the part behind the decimal dot. return Integer.parseInt(String.valueOf(x).replaceAll("^.*\\.", "")); |
float | frac(float x) frac return x - trunc(x);
|
int | frac(int f) frac return (f < 0 ? -f : f) & 0xFFFF;
|
String | fraction(double decimal, double tolerance) Converts a decimal to a fraction using continued fractions. int sign = (decimal < 0.0) ? -1 : 1; decimal = Math.abs(decimal); if (decimal == (int) decimal) { return (sign * (int) decimal + ""); double res = decimal, num = 0.0, denom = 1.0, lastdenom = 0.0, temp; do { res = 1.0 / (res - (int) res); ... |
double | fraction(double number) fraction double value = Math.IEEEremainder(Math.abs(number), 1); if (value < 0) value += 1; return value; |
String | fraction(int denominator) fraction switch (denominator) { case 2: return "half"; case 3: return "third"; case 4: return "quarter"; case 8: ... |