I doubt that this will be resolved since all numbers in JavaScript are
treated as doubles. I'm not really sure what the correct translation of
floats in client side Java code should be, but just treating them as
doubles seems like a reasonable solution.

Also, the serializer has no way of knowing what precision you require on
your values. Note that of your example values, the only one precisely
representable in base 2 is 28.5. All others just happen to be rounded
back to representations with a single digit after the decimal point in
the decimal -> float -> decimal conversion, but not in the decimal ->
float -> double -> decimal conversion.

For example:
28.4 = 0x1C.666666 (6 repeating, cut to 32 bits) =
28.39999997615814208984375

-----Original Message-----
From: Google-Web-Toolkit@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Alex Epshteyn
Sent: Wednesday, September 17, 2008 20:32
To: Google Web Toolkit
Subject: Warning about using float fields with RPC (shocking bug)


Amazing but true: only a hanful of all possible float values will be
serialized correctly on the server end of GWT RPC.

Examples:

28.4 => 28.399999618530273
28.5 => 28.5
28.6 => 28.600000381469727
28.7 => 28.700000762939453
28.9 => 28.899999618530273

Fortunately this should be easy to fix.

See my bug report for more info:

http://code.google.com/p/google-web-toolkit/issues/detail?id=2897


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to