Kaleido
Kaleido

Reputation: 21

Can the range for double in Java be extended?

The data type double covers a range from 4.94065645841246544e-324d to 1.79769313486231570e+308d. If I have to deal with numbers less than 4.94065645841246544e-324d, is there a data type I can use?

Upvotes: 2

Views: 131

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201419

Is there a data type I can use?

Yes1. You might use BigDecimal. The linked Javadoc says (in part) that it provides immutable, arbitrary-precision signed decimal numbers.

1BigDecimal is not a primtive type (and the range of primtive types is mandated by the specification).

Upvotes: 7

Related Questions