Here you can find the source of trunc(double x)
public static double trunc(double x)
//package com.java2s; //License from project: Open Source License public class Main { public static double trunc(double x) { return x - x % 1; }/*w ww . java 2s .c o m*/ }