<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Is there any "pattern" to what combination of numbers produce an erroneous result or is it down to JVM, i.e. why did it happen in one case and not in the other above?
quote: Is there any "pattern" to what combination of numbers produce an erroneous result or is it down to JVM, i.e. why did it happen in one case and not in the other above?
And as a side note, this has nothing to do with the JVM, or even Java. Java supports the IEEE standard for floating point numbers. This is the same standard that is supported by most of the modern day processors today, and hence, supported by most modern day computer languages.
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
is that the problem seems to only appear when deployed in Websphere running Linux, I cannot see it in Tomcat running on windows...but that doesnt make sense based on Henry's comment above...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
as another note, you should not use floating point math for monetary calculations. you should use some kind of integer, and adjust to the atomic unit - in the U.S., you would do all computation in pennies, then re-format as needed.
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
Originally posted by Michael Johnson, CO:
BigDecimal's asDouble() method
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
A teeny tiny vulgar attempt to get you to buy our stuff
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|