bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22744] ByteBuffer.putDouble should use Double.doubleToRaw


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22744] ByteBuffer.putDouble should use Double.doubleToRawLongBits
Date: 16 Oct 2005 01:26:57 -0000

When converting a double to a series of bytes before writing it to a buffer,
the Double.doubleToRawLongBits method should be used, and not the
Double.doubleToLongBits method. That way the bit pattern of the double is
exactly preserved. Using doubleToLongBits writes all NaNs out with the same bit
pattern. So if you write the Nan Double.longBitsToDouble(0x7ff800000000000CL)
to a buffer then read it back in, you get
Double.longBitsToDouble(0x7ff8000000000000L)


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-05-27 
06:29 -------
Do you have a testcase that triggers this problem ? In java.io.DataInputStream
and java.io.DataOutputStream the spec explicitely says to use not the "raw"
versions. Unfortunately this is not specified so hard for java.nio.


------- Comment #2 from from-classpath at savannah dot gnu dot org  2004-05-27 
06:59 -------
Attatched a test case that passes under Sun JDK1.4. Don't believe that it will
pass when using Classpath.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22744





reply via email to

[Prev in Thread] Current Thread [Next in Thread]