Mercurial > hg > octave-lyh
diff liboctave/dMatrix.cc @ 4431:c4bde1d5eb98
[project @ 2003-06-18 15:47:09 by jwe]
author | jwe |
---|---|
date | Wed, 18 Jun 2003 15:47:10 +0000 |
parents | f1fcc371e5ef |
children | 53ee020af847 |
line wrap: on
line diff
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -1984,15 +1984,25 @@ } bool -Matrix::any_element_is_negative (void) const +Matrix::any_element_is_negative (bool neg_zero) const { int nr = rows (); int nc = cols (); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) - if (elem (i, j) < 0.0) - return true; + if (neg_zero) + { + for (int j = 0; j < nc; j++) + for (int i = 0; i < nr; i++) + if (lo_ieee_signbit (elem (i, j))) + return true; + } + else + { + for (int j = 0; j < nc; j++) + for (int i = 0; i < nr; i++) + if (elem (i, j) < 0) + return true; + } return false; }