How can I let the python mpmath.nstr
function keep all the trailing zeros for mpmath.mpf('0')
? It looks that the strip_zeros
optional argument does not work for mpmath.mpf('0')
as seen in the following example:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpmath
>>> mpmath.dps=30
>>> mpmath.nstr(mpmath.mpf('0'), 10, strip_zeros=False)
'0.0'
>>> mpmath.nstr(mpmath.mpf('1'), 10, strip_zeros=False)
'1.000000000'
>>>