should Float allow high precision output from a low precision input?
In some discussion regarding changes to Float that are part of pull #
998 ( https://github.com/sympy/sympy/pull/998 ), the question of
whether to allow a high precision Float to be made from a low
precision float has arisen.
e.g. in my branch, Float(.3, 20) is disallowed since at face value one
might expect this to produce 0.30000000000000000000, but it doesn't.
It produced (in master) the 20 decimal digits that represent the
floating point approximation of 3/10: 0.29999999999999998890. So, like
Decimal (see below), I would prefer to disallow creation of high-
precision floats from low-precision input. In this case, an error
would be raised in my branch:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sympy\core\numbers.py", line 529, in __new__
raise ValueError('float has insufficient precision; send as
' % (num, dps))
ValueError: float has insufficient precision; send as Float("0.3",
In order to obtain that high precision value of the *floating point
representation* of 0.3, evalf would have to be used: Float(.
3).evalf(20). To obtain a high-precision value of 0.3 one would send
(as suggested by the error message) the 0.3 in a string: Float("0.3",
20) will give a 0.3 followed by 19 zeros.
In practice, here are 3 different ways one might try to get 21 digits