[Top][All Lists]

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

Re: sqrt function, NaN and complex number

From: Dmitri A. Sergatskov
Subject: Re: sqrt function, NaN and complex number
Date: Fri, 10 Dec 2004 12:54:25 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041127)

John W. Eaton wrote:

In any case, I don't think it is really a bug in Octave.

What happens if you try a simple C++ program to test sqrt(NaN+NaN*i)?

That does seems to work OK:

address@hidden divzero]$ cat
#include <complex>
#include <iostream>

int main()
  std::complex<double> z1(1.0/0.0,1.0/0.0);
  std::complex<double> z2 = std::sqrt(z1);
  std::complex<double> z3 = std::sqrt(z2);

        << "z1: " << z1 << std::endl
        << "z2: " << z2 << std::endl
        << "z3: " << z3 << std::endl;
  return 0;

address@hidden divzero]$ g++ -Wall -o test4 In function `int main()': warning: division by zero in `1.0e+0 / 0.' warning: division by zero in `1.0e+0 / 0.'
address@hidden divzero]$ ./test4
z1: (inf,inf)
z2: (nan,nan)
z3: (nan,nan)

Using gcc 3.4.2



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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