On Sun, Dec 21, 2008 at 1:44 PM, M. Yurko <myu...@gmail.com> wrote: > > I have recently been experimenting with converting some simple python > functions that I have made into cython. I have been quite impressed by > how simple it is for the massive speed increases that I have seen. > However, one thing that is mildly annoying at times is the limitation > to double precision computation. Is there any simple way to do > arbitrary precision floating-point arithmetic in cython? I tried using > importing mpfr, but I gave up after I saw the sheer number of > different things that seemed to need to be individually imported.
I don't understand. Can't you just do, e.g., from sage.all import RealNumber a = RealNumber('1.2939498029384028342983084203482093840283490823094829') # Now do stuff with a... Or do you want to completely avoid the Sage sage.rings.real_mpfr.RealNumber datatype and *directly* use the mpfr C library? If so, you might want to look at SAGE_ROOT/devel/sage/sage/rings/real_mpfr.pyx to see how sage.rings.real_mpfr.RealNumber is implemented. You could also do from sage.rings.real_mpfr cimport RealNumber import sage.all cdef RealNumber a = sage.all.RealNumber('1.29394980293840283429') Then in your code, a.value is a cdef's attribute of type mpfr_t. -- william --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---