Le 15/03/2011 22:47, Francois Bissey a écrit :
> On 14 March 2011 16:40, Julien PUYDT <julien.pu...@laposte.net> wrote:
> > Le 14/03/2011 14:12, David Kirkby a écrit :
> >> Perhaps you can find value of n, such that gamma(n) gives an exact
> >> integer result. If that happens on other CPUs too, then I suggest the
> >> argument to the doctest is changed.
> >
> > The solution of finding a "good" integer is fragile : it will break
> > anytime wind will change direction.
> >
> > Snark on #sage-devel
>
> I take your point it is "fragile". But it might well be the simplest
> solution. IMHO, it is probably the best solution.
>
Julien said that according to IEEE 15 (or 16) digits should be precise
enough.
Why not test n(gamma1(float(6)),15)? Since we are looking at numerical
results
with a limited precision it makes sense to limit the test to the
precision we
are sure of.
So Julien what would be the result for the above expression?
Let's see :
sage: gamma(6)
120
sage: gamma1(float(6))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/jpuydt/sage-4.6.2/<ipython console> in <module>()
NameError: name 'gamma1' is not defined
sage: gamma(float(6))
119.99999999999997
sage: n(gamma(float(6)),15)
120.0
sage: gamma(6.0)
120.000000000000
Things don't look that bad...
The root of the matter is really that the test is wrong : it tests for a
strict equality while it should only test for appropriate closeness.
Even the idea of checking n(gamma(float(6)),15) is wrong : on my
netbook, that is correct, because the result of the computation has 15
correct digits ; but on my laptop, gamma(float(6)) has a much better
precision, so checking only the 15 first digits is insufficient.
It would be more sensible to check that gamma(float(6))-120.0 is smaller
than the right number of digits (minus the digits of the integer
part...) ; isn't such information available?
Snark on #sage-devel
--
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