Mercurial > hg > octave-nkf
changeset 4349:a6c22c2c9b09
[project @ 2003-02-21 18:59:07 by jwe]
author | jwe |
---|---|
date | Fri, 21 Feb 2003 18:59:07 +0000 |
parents | 05415e529cef |
children | b4661459eff7 |
files | ChangeLog configure.in liboctave/CMatrix.cc liboctave/ChangeLog liboctave/lo-ieee.h src/pr-output.cc |
diffstat | 6 files changed, 39 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-02-21 John W. Eaton <jwe@bevo.che.wisc.edu> + + * configure.in: Check for copysign and signbit. + 2003-02-18 John W. Eaton <jwe@bevo.che.wisc.edu> * emacs/Makefile.in (DISTFILES): Add otags.1 to the list.
--- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ ### 02111-1307, USA. AC_INIT -AC_REVISION($Revision: 1.413 $) +AC_REVISION($Revision: 1.414 $) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1101,7 +1101,7 @@ AC_DEFINE(HAVE_ISNAN, 1, [Define if you have isnan().]) ;; *) - AC_CHECK_FUNCS(finite isnan isinf) + AC_CHECK_FUNCS(finite isnan isinf copysign signbit) ;; esac
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -2487,9 +2487,15 @@ int nc = cols (); for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - if (imag (elem (i, j)) != 0.0) - return false; + { + for (int i = 0; i < nr; i++) + { + double ip = imag (elem (i, j)); + + if (ip != 0.0 || lo_ieee_signbit (ip)) + return false; + } + } return true; }
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,10 @@ +2003-02-21 John W. Eaton <jwe@bevo.che.wisc.edu> + + * CMatrix.cc (ComplexMatrix::all_elements_are_real): Don't lose -0 + imaginary parts. + + * lo-ieee.h (lo_ieee_signbit): New macro. + 2003-02-18 David Bateman <dbateman@free.fr> * dMatrix.cc (Matrix::inverse, Matrix::determinant, Matrix::solve):
--- a/liboctave/lo-ieee.h +++ b/liboctave/lo-ieee.h @@ -66,6 +66,22 @@ extern double lo_ieee_na_value (void); extern double lo_ieee_nan_value (void); +// In the following definitions, only check x < 0 explicitly to avoid +// a function call when it looks like signbit or copysign are actually +// functions. + +#if defined (signbit) +#define lo_ieee_signbit(x) signbit (x) +#elif defined (HAVE_SIGNBIT) +#define lo_ieee_signbit(x) (x < 0 || signbit (x)) +#elif defined (copysign) +#define lo_ieee_signbit(x) (copysign (1.0, x) < 0) +#elif defined (HAVE_COPYSIGN) +#define lo_ieee_signbit(x) (x < 0 || copysign (1.0, x) < 0) +#else +#define lo_ieee_signbit(x) 0 +#endif + #ifdef __cplusplus } #endif