Here you can find the source of frac(double number)
public static double frac(double number)
//package com.java2s; //License from project: LGPL public class Main { /**/*from w w w .j a va 2 s. com*/ * Gets the decimal portion of the given double. For instance, {@code frac(5.5)} returns {@code .5}. */ public static double frac(double number) { return number - Math.floor(number); } /** * Returns the greatest integer less than or equal to the float argument */ public static int floor(float value) { int i = (int) value; return value < (float) i ? i - 1 : i; } /** * Returns the greatest integer less than or equal to the double argument */ public static int floor(double value) { int i = (int) value; return value < (double) i ? i - 1 : i; } }