I've checked in the following changes to CVS. I think it should
handle most of what we need. I don't think we should worry about how
printf/scanf handle reading and writing these values, at least not
yet. If you care about that, then you may have to do more work (i.e.,
do your own output conversions, and for input, read the file as text
and scan it for the special values).
I don't think the way I'm reading Inf, NaN, and NA is perfect, but it
should handle well-formed files created by save. Improvements welcome.
* load-save.cc (read_ascii_data): Use octave_read_double and
octave_read_complex so that we handle Inf, NaN, and NA.
(save_ascii_data): Use octave_write_double and octave_write_complex.
RCS file: /usr/local/cvsroot/octave/liboctave/CMatrix.cc,v
retrieving revision 1.85
diff -u -r1.85 CMatrix.cc
--- liboctave/CMatrix.cc 26 Sep 2002 22:10:06 -0000 1.85
+++ liboctave/CMatrix.cc 28 Oct 2002 20:52:26 -0000
@@ -2726,11 +2726,13 @@
operator << (std::ostream& os, const ComplexMatrix& a)
-// int field_width = os.precision () + 7;
for (int i = 0; i < a.rows (); i++)
for (int j = 0; j < a.cols (); j++)
- os << " " /* setw (field_width) */ << a.elem (i, j);
+ os << " ";
+ octave_write_complex (os, a.elem (i, j));
os << "\n";
@@ -2750,7 +2752,7 @@
for (int i = 0; i < nr; i++)
for (int j = 0; j < nc; j++)
- is >> tmp;
+ tmp = octave_read_complex (is);
a.elem (i, j) = tmp;
2002-10-25 John W. Eaton <[hidden email]>