List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:Main.java
/** * Converts a double value to a byte[8]. * * @param d the double to be converted./* w ww . jav a 2 s.co m*/ * @return a byte[8]. */ public static final byte[] doubleToRegisters(double d) { return longToRegisters(Double.doubleToLongBits(d)); }
From source file:Main.java
/** * Converts a "double" value between endian systems. * @param value value to convert//from w w w . ja va 2 s .c o m * @return the converted value */ public static double swapDouble(double value) { return Double.longBitsToDouble(swapLong(Double.doubleToLongBits(value))); }
From source file:StringUtils.java
public static String toBitString(final double d) { final char[] bit = new char[64]; final long dd = Double.doubleToLongBits(d); long mask = 1L; for (int i = 0; i < 64; i++) { final long bitval = dd & mask; if (bitval == 0) { bit[63 - i] = '0'; } else {/*from ww w . j a v a 2 s . c om*/ bit[63 - i] = '1'; } mask <<= 1; } return String.valueOf(bit); }
From source file:Main.java
/** * Returns an integer hash code representing the given double value. * /*from ww w. j av a2 s . co m*/ * @param value the value to be hashed * @return the hash code */ public static int hash(double value) { long bits = Double.doubleToLongBits(value); return (int) (bits ^ (bits >>> 32)); }
From source file:Main.java
public static byte[] getBytes(double data) { long intBits = Double.doubleToLongBits(data); return getBytes(intBits); }
From source file:Main.java
static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, long[] la, Object[] oa) { int type = typeCode.kind().value(); long l = 0;//from www . jav a 2 s . com Object o = oa[0]; switch (type) { case TCKind._tk_null: case TCKind._tk_void: case TCKind._tk_native: // Nothing to read break; case TCKind._tk_short: l = s.read_short() & 0xFFFFL; break; case TCKind._tk_ushort: l = s.read_ushort() & 0xFFFFL; break; case TCKind._tk_enum: case TCKind._tk_long: l = s.read_long() & 0xFFFFFFFFL; break; case TCKind._tk_ulong: l = s.read_ulong() & 0xFFFFFFFFL; break; case TCKind._tk_float: l = Float.floatToIntBits(s.read_float()) & 0xFFFFFFFFL; break; case TCKind._tk_double: l = Double.doubleToLongBits(s.read_double()); break; case TCKind._tk_char: l = s.read_char() & 0xFFFFL; break; case TCKind._tk_octet: l = s.read_octet() & 0xFFL; break; case TCKind._tk_boolean: if (s.read_boolean()) l = 1; else l = 0; break; case TCKind._tk_any: o = s.read_any(); break; case TCKind._tk_TypeCode: o = s.read_TypeCode(); break; case TCKind._tk_Principal: o = s.read_Principal(); break; case TCKind._tk_objref: if (o instanceof Streamable) ((Streamable) o)._read(s); else o = s.read_Object(); break; case TCKind._tk_longlong: l = s.read_longlong(); break; case TCKind._tk_ulonglong: l = s.read_ulonglong(); break; case TCKind._tk_wchar: l = s.read_wchar() & 0xFFFFL; break; case TCKind._tk_string: o = s.read_string(); break; case TCKind._tk_wstring: o = s.read_wstring(); break; case TCKind._tk_value: case TCKind._tk_value_box: o = ((org.omg.CORBA_2_3.portable.InputStream) s).read_value(); break; case TCKind._tk_fixed: try { // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to // InputStream, this check will be unnecessary if (s instanceof CDRInputStream) { o = ((CDRInputStream) s).read_fixed(typeCode.fixed_digits(), typeCode.fixed_scale()); } else { BigDecimal bigDecimal = s.read_fixed(); o = bigDecimal.movePointLeft((int) typeCode.fixed_scale()); } } catch (BadKind badKind) { // impossible } break; case TCKind._tk_struct: case TCKind._tk_union: case TCKind._tk_sequence: case TCKind._tk_array: case TCKind._tk_alias: case TCKind._tk_except: ((Streamable) o)._read(s); break; case TCKind._tk_abstract_interface: o = ((org.omg.CORBA_2_3.portable.InputStream) s).read_abstract_interface(); break; case TCKind._tk_longdouble: // Unspecified for Java default: ORBUtilSystemException wrapper = ORBUtilSystemException.get((com.sun.corba.se.spi.orb.ORB) s.orb(), CORBALogDomains.RPC_PRESENTATION); throw wrapper.typecodeNotSupported(); } oa[0] = o; la[0] = l; }
From source file:com.opengamma.analytics.financial.trade.OptionTradeData.java
@Override public int hashCode() { final int prime = 31; int result = 1; long temp;/*from w ww .j a v a 2s . co m*/ temp = Double.doubleToLongBits(_numberOfContracts); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_pointValue); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:Main.java
public static byte[] doubleToBytesLE(double d, byte[] bytes, int off) { return longToBytesLE(Double.doubleToLongBits(d), bytes, off); }
From source file:Main.java
public static byte[] double2bytesLE(double val, byte[] b, int off) { return long2bytesLE(Double.doubleToLongBits(val), b, off); }
From source file:Main.java
public static byte[] double2bytesBE(double val, byte[] b, int off) { return long2bytesBE(Double.doubleToLongBits(val), b, off); }