octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sparse + complex arithmetic inconsistency


From: Michael Goffioul
Subject: Re: Sparse + complex arithmetic inconsistency
Date: Fri, 30 Mar 2007 13:24:49 +0200

On 3/30/07, David Bateman <address@hidden> wrote:
Or a slightly modification

#include <math.h>
#include <complex.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
 complex double b=1,c=I*1,d = 1+I*1,z = 0.;
 // This should produce (inf,0), not (nan,nan).
 printf("(%f,%f) / (%f,%f) -> (%f,%f)\n",
        creal(b),cimag(b),creal(z),cimag(z),creal(b/z),cimag(b/z));
 // This should produce (0,inf), not (nan,nan).
 printf("(%f,%f) / (%f,%f) -> (%f,%f)\n",
        creal(c),cimag(c),creal(z),cimag(z),creal(c/z),cimag(c/z));
 // This should produce (inf,inf), not (nan,nan).
 printf("(%f,%f) / (%f,%f) -> (%f,%f)\n",
        creal(d),cimag(d),creal(z),cimag(z),creal(d/z),cimag(d/z));
 return 0;
}

that all return (nan,nan) for me.

I already reported this kind of problem some months ago. This is
due to the complex arthmetic implementation and it also appears
under MSVC. See
http://www.nabble.com/Sparse-matrix-problem-tf2844890.html#a8149128

You can even illustrate the problem without the use of sparse
matrices, like:

[1+i 1+i] ./ [0 i]

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]