Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

double vs. BigDecimal

807606Feb 5 2007 — edited Feb 7 2007
In our project we used double all the time. Recently we discoverd some problems with this data format. It returns sometimes wrong results. I suppose you know the examles when this happens so that I don't need to mention them.

One solution would be to replace the doubles everythere with BigDecimal. To m, this seems to exagerrated because double values trouble us only sometimes. However, these bugs are hard to avoid and hard to find when they occur.

Is there no other "no-risk" solution than replace all doubles with BigDecimal? Maybe there is or will be a VM parameter to order Java to calculate correctly even with double values?

Maybe you had these problems too and can tell us a suggestion?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2007
Added on Feb 5 2007
9 comments
991 views