Here you can find the source of abs_fractional(double number)
public static double abs_fractional(double number)
//package com.java2s; //License from project: Open Source License public class Main { public static double abs_fractional(double number) { double fr = fractional(number); if (fr >= 0.0) return fr; fr += 1.0;//from w w w . ja v a2s .com if (fr >= 1.0) //can happen due to epsilon errors return 0.0; return fr; } public static double fractional(double number) { int decimal = (int) number; return (number - decimal); } }