BigDecimal from Double incorrect value?
I am trying to make a BigDecimal from a string. Don't ask me why, I just need it! This is my code: Double theDouble = new Double(".3"); System.out.println("The Double: " + theDouble.toString()); BigDecimal theBigDecimal = new BigDecimal(theDouble); System.out.println("The Big: " + theBigDecimal.toString()); This is the output I get? The Double: 0.3 The Big: 0.299999999999999988897769753748434595763683319091796875 Any ideas? When you create a double, the value 0.3 cannot be represented exactly. You can create a BigDecimal from a string without the intermediate double, as in new BigDecimal("0.3"