From bug-octave-request at bevo dot che dot wisc dot edu Fri Dec 19 08:35:49 2003 Subject: (-1).^.5 == NaN From: Paul Kienzle To: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 19 Dec 2003 09:35:37 -0500 Debian octave-2.1.52 octave:9> (-1).^.5 ans = NaN IRIX octave-2.1.40 octave:9> (-1).^.5 ans = NaN This is arguably a libm problem rather than an Octave problem, as the following code demonstrates: #include #include #include int main(int argc, char *argv[]) { std::cout << "real^real=" << std::pow(-1.,0.5) << std::endl; std::cout << "real^cplx=" << std::pow(-1.,std::complex(0.5,0)) << std::endl; std::cout << "cplx^real=" << std::pow(std::complex(-1.,0),0.5) << std::endl; std::cout << "cplx^cplx=" << std::pow(std::complex(-1.,0),std::complex(0.5,0)) << std::endl; return 0; } Debian libm: real^real=nan real^cplx=(nan,nan) cplx^real=(nan,0) cplx^cplx=(6.12303e-17,1) IRIX libm: real^real=nan real^cplx=(nan,nan) cplx^real=(6.12323e-17,1) cplx^cplx=(6.12323e-17,1) Paul Kienzle pkienzle at users dot sf dot net ------------------------------------------------------------- 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 -------------------------------------------------------------