Here you can find the source of trunc(double value, double threshold)
public static double trunc(double value, double threshold)
//package com.java2s; //License from project: Open Source License public class Main { public static double trunc(double value, double threshold) { return Math.max(Math.min(value, threshold), -threshold); }//from w w w . ja va 2 s. co m }