Here you can find the source of Modulo(double x, double y)
public static double Modulo(double x, double y)
//package com.java2s; public class Main { /** Modulo function/*from w w w. j a v a 2 s. co m*/ * @return the Modulo */ public static double Modulo(double x, double y) { return y * Frac(x / y); } /** Fractional part of a number (y=x-[x]) * @return fractional part of a number */ public static double Frac(double x) { return x - Math.floor(x); } }