On Sat, Feb 4, 2012 at 2:11 PM, Robert Bradshaw <
rober...@math.washington.edu> wrote:

>
> Note that what is broken[1] here is ARM's libc, if one types
> "gamma(6.0)" one gets "120.000000000000" on all systems. It's a
> question about gamma(float(6.0)) which is explicitly requesting the
> (presumably faster but potentially less accurate) system
> implementation. The question is should we
>
> 1) Weaken this doctest to support this broken platform.
> 2) Provide a workaround for this platform (e.g. using gsl or similar)
> to avoid the broken implementation of gamma.
> 3) Mark this test as broken (not tested?) on ARM, and ARM only.
>
> I think options 2 & 3 are far superior to 1.
>
> - Robert
>
>
Despite everything else I've said, I really don't have a strong opinion on
which option is the best, but I do feel that 2 and 3 are superior to 1.

Actually, given the current state of things, the whole discussion of
whether gamma(6.0r) should be possibly faster but less accurate than
gamma(6.0) is somewhat funny, because it is both slower and less accurate.

sage: timeit('gamma(6.0r)')
625 loops, best of 3: 15.9 µs per loop
sage: timeit('gamma(6.0)')
625 loops, best of 3: 11.7 µs per loop
sage: timeit('gamma(6)')
625 loops, best of 3: 4.85 µs per loop
sage: timeit('RR(6).gamma()')
625 loops, best of 3: 6.53 µs per loop
sage: timeit('float(gamma(6.0))')
625 loops, best of 3: 11.9 µs per loop

So an implementation which quickly converted the float to
a sage.rings.real_mpfr.RealNumber and used that would be better than the
current implementation. (As far as I can tell, gamma(float(6)) takes so
long because sage tries some things which don't work and then it falls back
on creating a pynac object, which it then evaluates. Ginac then does some
things to decide that it does not know how to directly evaluate it, and it
turns the float back into a python object and calls some function which
calls some function which eventually calls tgammal().)

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to