Minh Nguyen wrote:
Hi Robert,

On Sun, Feb 21, 2010 at 5:18 AM, ma...@mendelu.cz <ma...@mendelu.cz> wrote:

<SNIP>

This solves the problem with dostests, but I see another problem: we
have two different answers. One of them is wrong. Which one? And why?

And is it O.K. to change doctest instead of fix a bug?

The function call h.n() results in a numerical appoximation, which is
I think machine dependent. One gets different answers on different
machines, as the doctest reports on the 32-bit Suse and 64-bit Itanium
machines show. So I think it's not even a 32- vs. 64-bit issue. So I
think it's architecture dependent.


That's almost certainly true. In fact, the result printed by the "failure" is more accurate than the expected value! I tried this in Mathematica:


In[1]:= Integrate[ Sin[x]/x^2,{x,1,Pi/2}]

        -2                                Pi
Out[1]= -- - CosIntegral[1] + CosIntegral[--] + Sin[1]
        Pi                                2

In[2]:= N[%,100]

Out[2]= 0.3394479409789156796919271718652186179944769882691752577491475103140\

>    509215988087842006743201412102786

One just has to live with these numerical issues. There was a discussion on gcc-help the other day by someone who got different answers from two different Intel chips. So you can't even assume it's an Intel/AMD/SPARC/Itanium issue.


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

Reply via email to