# HG changeset patch # User jwe # Date 1126798586 0 # Node ID 6b42c78c77d3a408ed8c4c2a5f76987042c683ec # Parent 7332a98b6de754e7f24fb4ef10e643c74a758064 [project @ 2005-09-15 15:36:26 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2005-09-14 John W. Eaton + + * ov-complex.cc (octave_complex::try_narrowing_conversion): + Don't drop -0i. + * ov-cx-mat.cc (octave_complex_matrix::try_narrowing_conversion): + Likewise. + 2005-09-14 Daniel * DLD-FUNCTIONS/besselj.cc, DLD-FUNCTIONS/chol.cc, diff --git a/src/ov-complex.cc b/src/ov-complex.cc --- a/src/ov-complex.cc +++ b/src/ov-complex.cc @@ -56,7 +56,9 @@ { octave_value *retval = 0; - if (imag (scalar) == 0.0) + double im = std::imag (scalar); + + if (im == 0.0 && ! lo_ieee_signbit (im)) retval = new octave_scalar (real (scalar)); return retval; diff --git a/src/ov-cx-mat.cc b/src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -74,7 +74,9 @@ { Complex c = matrix (0, 0); - if (std::imag (c) == 0.0) + double im = std::imag (c); + + if (im == 0.0 && ! lo_ieee_signbit (im)) retval = new octave_scalar (std::real (c)); else retval = new octave_complex (c);