On 13 March 2011 15:34, Julien PUYDT <julien.pu...@laposte.net> wrote: > Hi, > > among the few failing tests with my ARM built, two are because of accuracy > reasons : > > File "/home/jpuydt/sage-4.6.2/devel/sage/sage/functions/other.py", line 497: > sage: gamma1(float(6)) > Expected: > 120.0 > Got: > 119.99999999999997
This is a bit of a pain, as the number you get is less than expected. I don't believe there's anything magic about using the number 6 - virtually any positive integer would work. I'd try to find one such the number is either exact, or *above* the nearest integer. Gamma(n) should be factorial (n-1) - at least for positive integers. (See the next example for how to fix it if you get one where the result is just over an integer value). > File "/home/jpuydt/sage-4.6.2/devel/sage/sage/symbolic/expression.pyx", line > 6067: > sage: SR(10.0r).gamma() > Expected: > 362880.0 > Got: > 362880.00000000047 That's easy to change. If the test was changed to look for 362880.000000000... then it would pass since it will ignore the "47". The "..." means to ignore anything beyond there. We can verify that the result is very likely correct with Wolfram|Alpha http://www.wolframalpha.com/input/?i=Gamma%2810%29 (We could use pen and paper too, as this is trivial, but IMHO its worth justifying the result in the doctest. As you will see from another thread, I don't like results which are not justified.) > I tried to get more information about it, and was told that on armel, long > double is the same type as double... and hence the computations are correct. > > Can can those tests be made fuzzier, since checking for equality on floats > isn't a good idea? I think that's reasonable. Just it would make life a lot easier if you could find an integer 'n' such that gamma(n) returns an integer value, or a little over an integer. > Snark on #sage-devel If you can create trac tickets for these, I'm happy to review these. The only issue is these will need to be checked on other processors and operating systems, as you want to avoid making a test pass on ARM, but it then fails on another CPU. Dave -- 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