Java Double Number mod mod(double a, double b)

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

Description

A modulo function suitable for our purpose.

License

Open Source License

Parameter

Parameter Description
a the dividend.
b the divisor.

Return

the remainder of integer division.

Declaration

public static long mod(double a, double b) 

Method Source Code

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

public class Main {
    /**//from   ww  w. jav a2 s  . c  o  m
     * A modulo function suitable for our purpose.
     *
     * @param a the dividend.
     * @param b the divisor.
     * @return the remainder of integer division.
     */
    public static long mod(double a, double b) {
        return (long) (a - b * Math.floor(a / b));
    }
}

Related

  1. mod(double a, double b)
  2. Mod(double arg1, double arg2)
  3. mod(double i, final double n)
  4. mod(double left, double right)