The server does not natively support doubles, so the client sends the double as a 64 bit integer to the server. This is much more efficient than sending as a java serialized blob (old way) and more portable too. No bit conversion is made, so there is no loss of precision. This approach does require that:
The client must use “record.getDouble()” to retrieve the value. getDouble() interprets the 64 bits as a double instead of a long.
User defined functions on the server should not manipulate the value because it will appear as a long.
If these constraints are not acceptable, you can always convert the double to a byte and write as a blob.
We are scheduling native double support for the server for soon delivery.
As an aside, doubles have many properties that most programmers are unaware of - such as 0.1 + 0.2 is not 0.3 , and you can’t compare doubles using ‘=’ . I find most programmers really want forms of fixed point, and are best served by string representation instead of trying to use integers. Then, one often uses a fixed-point-string library.
For these reasons, floating point isn’t used for currency.
Here’s a guide I find useful:
Programmers often want base-10 floating point instead of base-2 floating point. There is a new standard proposed as a part of IEEE 754 called “decimal64” floating point which does exactly what most programmers want. It’ll take a long, long time for that format to get implemented in chips, then languages. I look forward to that day.
There are valid use cases for binary (base-2) floating point ( like scoring in recommendation engines, where sin() is used ), and if you’ve got a valid use, I’m sorry you’ll have to live with a workaround for a while.