[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 test4.cc
#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);
std::cout
<< "z1: " << z1 << std::endl
<< "z2: " << z2 << std::endl
<< "z3: " << z3 << std::endl;
return 0;
}
address@hidden divzero]$ g++ -Wall -o test4 test4.cc
test4.cc: In function `int main()':
test4.cc:6: warning: division by zero in `1.0e+0 / 0.'
test4.cc:6: 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
jwe
Dmitri.
--
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- sqrt function, NaN and complex number, Samir Sharshar, 2004/12/10
- Re: sqrt function, NaN and complex number, Per Persson, 2004/12/10
- Re: sqrt function, NaN and complex number, Dmitri A. Sergatskov, 2004/12/10
- Re: sqrt function, NaN and complex number, John W. Eaton, 2004/12/10
- Re: sqrt function, NaN and complex number,
Dmitri A. Sergatskov <=
- Re: sqrt function, NaN and complex number, Dmitri A. Sergatskov, 2004/12/10
- Re: sqrt function, NaN and complex number, John W. Eaton, 2004/12/10
- Re: sqrt function, NaN and complex number, Dmitri A. Sergatskov, 2004/12/10