[Numpy-discussion] numpy and roundoff(?)
Lisandro Dalcin
dalcinl at gmail.com
Sat Mar 1 17:19:37 EST 2008
On 3/1/08, Charles R Harris <charlesr.harris at gmail.com> wrote:
> So they differ in the least significant bit. Not surprising, I expect the
> Fortran compiler might well perform operations in different order,
> accumulate in different places, etc. It might also accumulate in higher
> precision registers or round differently depending on hardware and various
> flags.
Of course, but a completely unrelated but equivalent C implementation
of this problem, as you can check in line 313 at this link
http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex5.c.html
behaves almost the same that my F90 implemented residual. Perhaps
Fortran compiler (gfortran) will generate the same code as the C one,
but I'm not sure, Fortran compilers can be smarter that C compilers
for this kind of looping.
> The exp functions in Fortran and C might also return slightly
> different results.
I believe this is not the source of the problem, I've tried commenting
that term, and differences are still there.
> I don't think the differences are significant, but if you
> really want to compare results you will need a higher precision solution to
> compare against.
I agree, the differences are not significant, but they end up having a
noticeable impact. I'm still surprised!.
Let's stop all this now. I'll be back as soon as I can produce some
self-contained code to show and reproducing the problem.
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
More information about the NumPy-Discussion
mailing list