Forum: Building VoltDB Applications

Post: NaN and Infinities as SQL values

NaN and Infinities as SQL values
henning
Apr 25, 2010
From the Wire Protocol doc:

"Positive and negative infinity, as well as NaN, are supported on the wire, but not guaranteed to work as SQL values."

But they could?

Thanks,
Henning
Hi Henning, There are some
aweisberg
Apr 26, 2010
Hi Henning,

There are some compatibility issues with floating point numbers between Java and C++. Java uses a specific bit pattern to represent NaN while C++ uses several different patterns. We don't have test cases that cover usage of these values so we can't say if/when they will work as expected. I created a ticket for this issue, but it will probably not be scheduled until after V1 unless there is demand. Certainly in the future we will flesh out the details and ensure that floating point arithmetic works normally.

-Ariel
P.S. If you haven't seen this yet. Disclaimer, the views presented in this pdf are not necessarily the views of the VoltDB team.www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
Good news!
aweisberg
May 7, 2010
Repost from http://forum.voltdb.com/showthread.php?323-Official-Java-Bit-Patterns-for-Nan-and-Infinities&highlight=Official+Java+Patterns+Infinities

Hi Henning,

I have done some code snooping in Java's ByteBuffer class and it turns out that it takes care of the conversion from Java floats to IEEE 754 floats. If you try and send a Java float to us on the wire it might get mangled when ByteBuffer attempts to decode it as an IEEE 754 float. We still need better test coverage of floating point expressions involving NaN and +-Inf, but there is no reason to think they wouldn't behave as expected.

-Ariel