Java Double Number mod mod(double number, double mod)

Here you can find the source of mod(double number, double mod)

Description

mod

License

Open Source License

Declaration

public static double mod(double number, double mod) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double mod(double number, double mod) {
        if (Math.abs(mod) <= Double.MIN_NORMAL) {
            return 0;
        }//from  ww w  .  ja  va 2  s  . c  om
        if (number < 0) {
            return mod(number + mod, mod);
        } else if (number >= mod) {
            return mod(number - mod, mod);
        } else {
            return number;
        }
    }

    public static int mod(int number, int mod) {
        if (mod <= 0) {
            return 0;
        }
        if (number < 0) {
            return mod(number + mod, mod);
        } else if (number >= mod) {
            return mod(number - mod, mod);
        } else {
            return number;
        }
    }
}

Related

  1. Mod(double arg1, double arg2)
  2. mod(double i, final double n)
  3. mod(double left, double right)
  4. mod(double m, double n)
  5. mod(double n, double d)
  6. mod(double value, double mod)
  7. mod(double x, double m)
  8. mod(double x, double y)
  9. mod(double x, double y)