Here you can find the source of abs(double x)
public static double abs(double x)
//package com.java2s; public class Main { private static final long MASK_NON_SIGN_LONG = 0x7fffffffffffffffL; public static double abs(double x) { return Double.longBitsToDouble(MASK_NON_SIGN_LONG & Double.doubleToRawLongBits(x)); }//from w w w .j a v a 2 s.co m }