Java Double Number mod mod(double x, double y)

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

Description

Returns the given number modulo the second number (mod for floats).

License

Open Source License

Declaration

public static double mod(double x, double y) 

Method Source Code

//package com.java2s;

public class Main {
    /**/* www .  ja v a  2  s  .co  m*/
     * Returns the given number modulo the second number (mod for floats).
     */
    public static double mod(double x, double y) {
        return x - y * Math.floor(x / y);
    }

    /**
     * Truncate x down to the nearest y.
     */
    public static double floor(double x, double y) {
        return y * Math.floor((x + .00001) / y);
    }
}

Related

  1. mod(double n, double d)
  2. mod(double number, double mod)
  3. mod(double value, double mod)
  4. mod(double x, double m)
  5. mod(double x, double y)
  6. mod(double x, double y)
  7. mod(final double a, final double b)
  8. mod2pi(double vin)
  9. mod2pi_pos(double vin)