PriyanshuG
PriyanshuG

Reputation: 145

How can we do calculation on values exceeding the range of double data type in java?

Since the double data type has the longest range in Java, yet there could be a few cases when the value of data can exceed its range. So, How can we do calculation on values exceeding the double data type and prevent any error in java?

Upvotes: 0

Views: 223

Answers (1)

Chethan Bhateja
Chethan Bhateja

Reputation: 101

I believe BigDecimal is usually used in this case. It can handle very large doubles and is quite precise. Here's a tutorial I found on using BigDecimal.

Upvotes: 1

Related Questions