I’m trying to print a small double number like 6.67e-11, but using Double.toString() returns 0. What can I do to make it print 6.67e-11 (or something similar) instead?
I’m trying to print a small double number like 6.67e-11 , but using Double.toString()
Share
Unable to reproduce:
IIRC,
Double.toString()always returns a string which allows the exact value to be round-tripped usingDouble.parseDouble().My guess is that you don’t actually have a small value – that you have 0, due to some rounding errors in other operations.