Sunday, September 29, 2013

Re: Decimals acting wierd : 5.3 * 3 = 15.899999999999999

That's because numbers are floating-points numbers; you'll find this in all languages/platforms whose types follow IEEE 754 Floating-points Arithmetics (Java/JVM, JS, C, .NET, etc.) that is, almost everywhere.
Java has BigDecimal if you need precision; it's emulated in GWT but performs much slower than doubles, which just map to JS numbers.

On Sunday, September 29, 2013 12:20:36 PM UTC+2, Martones wrote:
Hey guys,

I had this problem hounting me since quite a while. I'm using double types in the equation above and I have this wierd precision result : 
5.3 * 3 = 15.899999999999999

This is not the first time at all and I already saw this with floats / without multiplication and so on. Before I spend few hours figuring out some test cases, can anyone give me any directions of where and what to search ? :)

Many thanks everyone !

Ludovit

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment