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

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

Description

mod

License

Apache License

Declaration

public static double mod(double value, double mod) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double mod(double value, double mod) {
        if (value < 0 || mod <= 0)
            throw new IllegalArgumentException("value must be >= 0");
        int index = (int) (value / mod);
        value -= mod * index;/*w ww  . j av a2  s  .  c o  m*/
        if (value < 0)
            return 0;
        else if (value >= mod)
            return 0;
        else
            return value;
    }
}

Related

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