Hello. When creating (converting) a BigDecimal object with 32 characters, I get a value of type 1.0E-30

BigDecimal delta = new BigDecimal("0.000000000000000000000000000001", mc); или так: BigDecimal delta = new BigDecimal(0.000000000000000000000000000001d, mc); BigDecimal delta = BigDecimal.valueOf(0.000000000000000000000000000001d); 

In general, the result is one Output: DELTA: 1.0E-30

How can I get a normal result with 30 characters (but this is not the limit)? I use JavaHome = jdk1.8_131 although at 1.8_51 the same thing Thanks in advance for the answer!

  • You can do this: BigDecimal.valueOf(0.000000000000000000000000000001d).toPlainString() - MrFylypenko
  • Yes, thank you very much - it works. But for my case here, I still need to BigDecimal.valueOf(0.000000000000000000000000000001d).toPlai‌​nString().substring(0, 32) in this case, it will really take 30 decimal places + I have solved this problem with String.format("%.30f", d) - Alex

0