Hi,
I use SymPy in a learning system so the exact way expressions are printed
is important.
In a nutshell, the expression 1+x is always printed as x+1. Without jumping
through hoops, is there a way to preserve the order of terms that
corresponds to the way the expression was entered/built?
should 'rational with prec+4' be `prec+5'? It would take at most 5 binary
digits to get you to the next decimal digit, wouldn't it?
On Friday, March 30, 2018 at 1:37:57 AM UTC-5, Chris Smith wrote:
>
> Is this expected behavior for evaluating Rationals:
>
> Rational of a string produces the
Part of it is a bug and part of it is a feature.
First the bug, https://github.com/sympy/sympy/blob/7524499458cf114b32e
3aa6e8acdb77e846111f9/sympy/core/evalf.py#L1264 needs to be changed. It
should be changed from from_rational(x.p, x.q, prec) to from_rational(x.p,
x.q, prec, rnd). Otherwise
Is this expected behavior for evaluating Rationals:
Rational of a string produces the exact decimal as a fraction:
>>> Rational('.975159')
975159/100
evaluation is going to be affected by rounding
>>> Rational('.975158').n(2)
0.97
>>> Rational('.975159').n(2)
0.98
But why is the digit