Comment #1 on issue 2886 by [email protected]: Float precision
http://code.google.com/p/sympy/issues/detail?id=2886

If we adhere to the behavior of the mpmath 'from_str':

http://mpmath.googlecode.com/svn/trunk/doc/build/general.html#mpmathify-convert
(except that we do not use global default values).

Then the declaration of this function in mpmath.libmp.libmpf is: 'def from_str(x, prec, rnd=round_fast)'

And in this code the prec of the float is not based on the length of the source string.

I don't know the reasons of this behavior exactly, but I think that from usage:

Float("1.2")*Float("3.14159")

I expect to result "3.769908" rather then "3.8".

So I tend that we must adhere to the behavior of the mpmath as it is.


Regarding the issue 2878:

Why does the 0.6, which should be exactly 6/10 return a different result?

I think that it is correct when 0.6 and 6/10 return a different result, as 0.6 is a float representation (therefore all subsequent calculations of the expression based on the float machine representation while n() or evalf() is called).

May be we need to add the additional parameter to 'S("0.6", dps=100)' if we want to define the precision of this further calculation process, or 'S("0.6", rational=True)' if we want to work with the Rational further. And, yes, in the comments of 2878 it is resolved correctly, that one can use Rational("0.6").

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to