On 10/25/06, Bill Hart <[EMAIL PROTECTED]> wrote: > > When asked 61/3.0, SAGE returns: > > 20.333333333333332 > > Now I understand that floating point numbers are often rounded down to > prevent floating point drift. But I was wondering if rounding it down > in the manner above is quite necessary. Perhaps that last 2 should be a > 3.
This is how mpfr behaves. What you want to do is sage: RR = RealField(rnd='RNDU') ; RR(61/3.0) 20.333333333333333 When you execute '61/3.0', it's executed as sage: preparse('61/3.0') "Integer(61)/RealNumber('3.0')" which is slightly wrong. Hope that helps. BTW, there is a tiny bug in rings/real_mpfr.pyx. In the documentation, it says that the default precision is RNDU (round to + \inf), but it's actually set to RNDN... didier > > Bill. > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---