Here you can find the source of clamp_doubleback(double a, double x, double y)
public static double clamp_doubleback(double a, double x, double y)
//package com.java2s; public class Main { /**/*from w w w. j a v a2 s .c om*/ * Returns the given double clamped between the two values. */ public static double clamp_doubleback(double a, double x, double y) { double newA = Math.abs(Math.IEEEremainder(a, 2 * (y - x))); if (newA > y) newA = 2 * y - newA; return newA; } }