Here you can find the source of mod(double n, double d)
public static final double mod(double n, double d)
//package com.java2s; //License from project: Apache License public class Main { public static final double mod(double n, double d) { return n - d * Math.floor(n / d); }/* ww w . j a v a2s . c o m*/ }