List of utility methods to do Double to Long
Object | doubleToLong(Double aVal) if the double can safely be converted to a Long then do it. if (Double.compare(aVal, Math.ceil(aVal)) == 0) { return aVal.longValue(); } else return aVal; |
Long | doubleToLong(double d) double To Long if (d >= Long.MIN_VALUE && d <= Long.MAX_VALUE) { return (long) d; return null; |
long[] | doubleToLong(double[] values) double To Long if (values == null) { return null; long[] results = new long[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (long) values[i]; return results; ... |
long | doubleToLong(final double d) double To Long if (d > Long.MAX_VALUE || d < Long.MIN_VALUE) throw new IllegalArgumentException("floating point value is too large to be converted to a Long."); double x = ((Double) d).longValue(); if (x != d && d < 0.0) --x; return (long) x; |
long | DoubleToLong_With_Little_Endian(double dd) Double To Lon Wit Littl Endian return Long.reverseBytes(Double.doubleToLongBits(dd));
|
long[] | doubleToLongArray(final double value) double To Long Array final double d = (value == 0.0) ? 0.0 : value; final long[] array = { Double.doubleToLongBits(d) }; return array; |
long | doubleToLongBits(double val) double To Long Bits String dbl = String.valueOf(val); int decimpoints = dbl.indexOf(".") > -1 ? dbl.split("\\.")[1].length() : 1; long factor = (long) Math.pow(10, decimpoints); val = val * factor; return Math.round(val); |
long | doubleToLongBits(double value) double To Long Bits return Double.doubleToLongBits(value);
|
long | doubleToLongBits(final double d) Returns the representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, after first mapping -0.0 to 0.0. return ((d == 0.0d) ? 0l : Double.doubleToLongBits(d));
|
long | doubleToLongBits(final double v) double To Long Bits if (Double.isNaN(v)) { return 0x0FFFL << 51; long sign = (v < 0 ? 0x1L << 63 : 0); long exponent = 0; double absV = Math.abs(v); if (Double.isInfinite(v)) { exponent = 0x07FFL << 52; ... |