From bug-octave-request at bevo dot che dot wisc dot edu Tue Jan 22 14:09:19 2002 Subject: arg(double) patch From: Paul Kienzle To: bug-octave at bevo dot che dot wisc dot edu Date: Tue, 22 Jan 2002 15:09:16 -0500 John, I'm including a patch to lo-mappers so that Y=arg(X) will match for i=1:length(x) Y(i)=arg(X(i)); end even if X contains signed zeros. Test with: x=[0+0i, 0-0i, -0+0i, -0-0i, 1i, NaN+0i, NaN-0i,NaN*1i]; y=x; for i=1:length(y), y(i)=arg(y(i)); end [x;y;arg(x)].' Note that there is a separate problem in the octave print routines in that they are not showing signed zeros, but that will be in a later patch. Paul Kienzle pkienzle at users dot sf dot net Index: lo-mappers.cc =================================================================== RCS file: /cvs/octave/liboctave/lo-mappers.cc,v retrieving revision 1.19 diff -c -p -r1.19 lo-mappers.cc *** lo-mappers.cc 2001/02/06 15:57:23 1.19 --- lo-mappers.cc 2002/01/22 19:58:49 *************** Software Foundation, 59 Temple Place - S *** 62,75 **** double arg (double x) { ! if (x < 0.0) ! return M_PI; ! else ! #if defined (HAVE_ISNAN) ! return xisnan (x) ? octave_NaN : 0.0; ! #else ! return 0.0; ! #endif } double --- 62,68 ---- double arg (double x) { ! return atan2(0.0,x); } double ------------------------------------------------------------- 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 -------------------------------------------------------------