Here you can find the source of mod(double a, double b)
Parameter | Description |
---|---|
a | the dividend. |
b | the divisor. |
public static long mod(double a, double b)
//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)); } }