On Sunday, 5 February 2012 21:03:46 UTC+8, Snark wrote: > > Hi, > > this thread is getting... long. Let me try to refocus it on more > constructive grounds. > > Let's list the problematic expressions: > 1. gamma(float(6)) > 2. SR(10.0r).gamma() > 3. float(maxima("1.7e17")) > 4. binomial(0.5r,5) > > The following is known : > (a) 1,3 and 4 give test-passing results with "#tol rel", so even if > wrong, they're not dead-wrong ; > > (b) 1, 2 and 4 are all the same bug in various disguise : the libc > lgammal function isn't good enough ; > more precisely, the (e)glibc gamma function is not good. (lgammal isn't too good either, but it's a different story). Let me post your link to a good implementation of gamma(), in netbsd's libc: http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libm/noieee_src/n_gamma.c?rev=1.7&content-type=text/plain&only_with_tag=MAIN (and it states the error bounds, by the way!)
> this is explicit in 1 and 2, and > implicit in 4 where for floats the computation is by a quotient of gamma > calls [aside: that is probably a wrong way to do things]. > I'm sure there is research done on how to do this numerically in a proper way... > (c) 3 is a different problem, and although "#tol rel" makes it pass the > tests, the fact that it needs it to pass is bad. > > So my proposition is the following: > > (1) I'll try to fix the implementation of lgammal upstream ; > gammal, and gamma, the first thing, perhaps. Not sure if lgammal can be fixed easily, actually. > (2) I'll try to investigate the maxima string-to-float conversion ; > > (3) the sage developpers should still decide and make public some > statement as to what they consider a correct numerical approximation, > because that thread only made obvious that there's a need for a > reference document. > This is a very good idea. The link to netbsd's implementation show that's it's doable... > Does that look like a good plan? > > Snark > Dima -- 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