I'm working with Python Decimal types, up to 8 decimal places, and for very small numbers, by default, they are displayed using exponential notation. I would prefer them to be displayed in non exponential notation. Example follows:
>>> from decimal import Decimal
>>> d1 = Decimal('0.00000100')
>>> d1
Decimal('0.00000100')
>>> str(d1)
0.00000100
In this case, d1 does just what I'd like. But if I use another with a slightly smaller number, I get exponent notation:
>>> d2 = Decimal('0.00000001')
>>> d2
Decimal('1E-8')
>>> str(d2)
'1E-8'
I realise that I can format this using format(d2, 'f')
but there are lots of places where these values are passed directly to the front end of my app using an API so I'd rather not if possible.
I'm curious to know if this is something I can change?
Thanks!