On Dec 23, 1:53 am, Paul Zimmermann <paul.zimmerm...@loria.fr> wrote:
>        Hi,
>
> as a followup on the "Arbitrary precision in cython" thread, I'd like to
> mention that one can directly use mpfr's implementation from within Sage:
>
> sage: RealField(150)(10).eint()
> 2492.2289762418777591384401439985248489896471
>
> It only works for real numbers, but has the advantage to guarantee correct
> rounding (for the 150-bit binary result; if you are using the decimal
> result above, you have to take into account the binary->decimal conversion
> error, which is at most 1/2 ulp).

Actually, Sage doesn't print the entire value for floating-point
numbers by default; it leaves a few digits off the end, so the
potential binary->decimal conversion error above is a lot more than
1/2 ulp.  To get the entire within-1/2-ulp decimal value, you can use:

sage: RealField(150)(10).eint().str(truncate=False)
'2492.2289762418777591384401439985248489896471010'

Carl
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to