Hi to all.
I understand that "prec" as reported in Float internal representation is just not a measure of the "true" error but at most an upper bound on it.
But, as explained here [1], in sympy "If inexact, low-precision numbers are involved in a calculation with with higher precision values, the evalf engine will increase the precision of the low precision values and inexact results will be obtained."
Example:
>>> srepr(Float('1/3',30)+Float('2/3',20))
Float('1.00000000000000000000028234431569', prec=30)
>>> srepr(Float('3/5',30)*Float('5/3',20))
Float('0.999999999999999999999661186821177', prec=30)
A user mixing precisions and looking at the precision of the result would have the false impression that the final precision is 30, while here it is at most 20.
So, to be "fool-proof", here I would have expected to have as results Floats of precision 20.
May be I'm missing something: what is the point of this weird behavior in numerical evaluation?
Thanks for any insight
ric
[1]
http://docs.sympy.org/latest/gotchas.html?highlight=precision#evaluating-expressions-with-floats-and-rationals