Assume to have this number:
p=0.00001
Now, if we print this variable we get 1e-05
(i.e., that number in scientific notation). How can I print exactly 0.00001
(i.e., in decimal notation)? Ok, I know I can use format(p, '.5f')
, but the fact is that I don't know in advance the number of decimal digits (e.g., I may have 0.01
or 0.0000001
, etc.). Therefore, I could count the number of decimal digits and use that in the format
function. In doing so, I have a related problem... is there any way to count the decimal digits of a decimal number without using Decimal
?