This has been discussed in some recent issues (which I can't seem to
find at the moment). We definitely should change the float operations
to use the minimum precision, not the maximum.

Aaron Meurer

On Fri, Sep 22, 2017 at 3:03 PM,  <[email protected]> wrote:
> 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
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/3223608.D5bRag6ZZt%40ipht-ia-004976.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6Kdg-3DF%2BdebD0OOt5YOMg5DVkNBwHujcev6JWyXNBQCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to