Mercurial > octave-nkf
comparison src/ls-oct-ascii.cc @ 5951:b2167e370f82
[project @ 2006-08-22 05:13:42 by jwe]
author | jwe |
---|---|
date | Tue, 22 Aug 2006 05:13:42 +0000 |
parents | 1138ced03f14 |
children | cdef72fcd206 |
comparison
equal
deleted
inserted
replaced
5950:2b2e5a937c59 | 5951:b2167e370f82 |
---|---|
66 #include "dMatrix.h" | 66 #include "dMatrix.h" |
67 | 67 |
68 #include "ls-oct-ascii.h" | 68 #include "ls-oct-ascii.h" |
69 | 69 |
70 // The number of decimal digits to use when writing ascii data. | 70 // The number of decimal digits to use when writing ascii data. |
71 static int Vsave_precision = 15; | 71 static int Vsave_precision = 16; |
72 | 72 |
73 // Functions for reading ascii data. | 73 // Functions for reading ascii data. |
74 | 74 |
75 static Matrix | 75 static Matrix |
76 strip_infnan (const Matrix& m) | 76 strip_infnan (const Matrix& m) |
355 bool strip_nan_and_inf, bool mark_as_global, | 355 bool strip_nan_and_inf, bool mark_as_global, |
356 int precision) | 356 int precision) |
357 { | 357 { |
358 bool success = true; | 358 bool success = true; |
359 | 359 |
360 if (! precision) | |
361 precision = Vsave_precision; | |
362 | |
363 if (! name.empty ()) | 360 if (! name.empty ()) |
364 os << "# name: " << name << "\n"; | 361 os << "# name: " << name << "\n"; |
365 | |
366 long old_precision = os.precision (); | |
367 os.precision (precision); | |
368 | 362 |
369 octave_value val = val_arg; | 363 octave_value val = val_arg; |
370 | 364 |
371 if (mark_as_global) | 365 if (mark_as_global) |
372 os << "# type: global " << val.type_name () << "\n"; | 366 os << "# type: global " << val.type_name () << "\n"; |
373 else | 367 else |
374 os << "# type: " << val.type_name() << "\n"; | 368 os << "# type: " << val.type_name() << "\n"; |
375 | 369 |
376 success = val . save_ascii(os, infnan_warned, strip_nan_and_inf); | 370 if (! precision) |
371 precision = Vsave_precision; | |
372 | |
373 long old_precision = os.precision (); | |
374 os.precision (precision); | |
375 | |
376 success = val . save_ascii (os, infnan_warned, strip_nan_and_inf); | |
377 | 377 |
378 os.precision (old_precision); | 378 os.precision (old_precision); |
379 | 379 |
380 return (os && success); | 380 return (os && success); |
381 } | 381 } |