Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with accuracy with double

Status
Not open for further replies.

VenkatRastapuram

Programmer
Oct 24, 2003
46
IN
Hi,

I am unable get the accurate values using double. I know that I can get accurate using BigDecimal. But now I can not convert the datatype from double to BigDecimal in my classes as they are used in many places. I am able to get the correct value if I make the calculations in BigDecimal and after converting it into double but I am storing that value in the database. When we retrieve the data from the database then I am facing the same problem. Pls solve my problem. Pls let me know any workaround for this problem.

Thanking You

Best Regards,
R.Venkatesh
Ocimum Biosolutions
 
If the double precision is not enough for your calculation, I'm afraid you have to use the BigDecimal for all the calculations where the double is not enough.

Furthermore, you'll have to store the values in the database with BigDecimal precision, not double.

Cheers,

Dian

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top