Home » Java BigDecimal doubleValue() method with Examples

Java BigDecimal doubleValue() method with Examples

by Online Tutorials Library

Java BigDecimal doubleValue() method

The doubleValue() method of Java BigDecimal class is used to convert the BigDecimal value into a double type. If BigDecimal has very big value represented as a double, it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate. While conversion, we can lose information about the precision of the BigDecimal value.

Syntax:

Parameter:

No

Exception:

No

Returns:

It returns double value converted from BigDecimal.

Example 1

Test it Now

Output:

BigDecimal 123 value converted into double is =123.0  

Example 2

Test it Now

Output:

BigDecimal 113367 value converted in to double is =113367.0  

Example 3

Test it Now

Output:

BigDecimal -1120 value converted in to double is = -1120.0  

Next TopicJava BigDecimal

You may also like