To print a floating point number without exponential form, we can write like this:
print('%f' % (10**-8))
But this generally displays zeroes due to precision error. Instead, we can use Decimal.decimal(float)
to print a floating point number precisely. But that prints the number in exponential format i.e. 10e-10
. And I cannot seem to combine them as I don't know how to format a Decimal
like the way I used '%f'
to format floats.
So my question is, how to get this thing done the way I want?
Note: The power -8 used here is just an example. The power could be variable. Also, I was wondering if I could print the differences of two numbers with high precision.