List of utility methods to do Float Number Mod
double | fmod(double a, double b) fmod double mod = a % b; if (mod < 0) { mod += b; return mod; |
double | fmod(double a, double b) Computes the floating-point remainder of a/b. int result = (int) Math.floor(a / b); return a - result * b; |
double | FMod(double x, double y) C fmod function. return x - Math.floor(x / y) * y;
|
float | fmodf(Float float1, float float2) fmodf return float1 % float2; |
double | fmodulo(double v1, double v2) Returns the remainder of the division v1/v2 . if (v1 >= 0) return (v1 < v2) ? v1 : v1 % v2; double tmp = v1 % v2 + v2; return (tmp == v2) ? 0. : tmp; |
float | mod(final float a, final float b) mod int n = (int) (a / b); float aa = a - n * b; if (aa < 0) { aa += b; return aa; |
float | mod(final float a, final float mod) An equivalent to % for float final float b = a - mod * (int) (a / mod); if (b >= 0) return b; else return b + mod; |
float | mod(float a, float b) Calculates x modulo y. if (a < 0) { return a + (float) Math.ceil(-a / b) * b; } else if (a >= b) { return a - (float) Math.floor(a / b) * b; } else { return a; |
float | mod(float a, float b) Return a mod b. int n = (int) (a / b); a -= n * b; if (a < 0) return a + b; return a; |
float | mod(float a, float b) Calculates a mod b in a way that respects negative values (for example, mod(-1, 5) == 4 , rather than -1 ). return (a % b + b) % b;
|