Here you can find the source of mod2pi_pos(double vin)
static private double mod2pi_pos(double vin)
//package com.java2s; public class Main { static double twopi_inv = 0.5 / Math.PI; static double twopi = 2.0 * Math.PI; static private double mod2pi_pos(double vin) { double q = vin * twopi_inv + 0.5; int qi = (int) q; return vin - qi * twopi; }/*from www .j a va2 s . c o m*/ }