public static double ulp(double x){
  if (Double.isInfinite(x)) {
    return Double.POSITIVE_INFINITY;
  }
  return abs(x - Double.longBitsToDouble(Double.doubleToRawLongBits(x) ^ 1));
}

public static double ulp ( double x ) { if ( Double . isInfinite ( x ) ) { return Double . POSITIVE_INFINITY ; } return abs ( x - Double . longBitsToDouble ( Double . doubleToRawLongBits ( x ) ^ 1 ) ) ; }
compute least significant bit ( unit in last position ) for a number .
