Mercurial > hg > octave-nkf
changeset 6865:c40c71200c65
[project @ 2007-09-05 18:26:30 by jwe]
author | jwe |
---|---|
date | Wed, 05 Sep 2007 18:26:30 +0000 |
parents | ab9a0ffee27f |
children | f7bc1c20800e |
files | src/ChangeLog src/oct-stream.cc |
diffstat | 2 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2007-09-05 Michael Goffioul <michael.goffioul@gmail.com> + + * oct-stream.cc (octave_base_stream::do_printf): Ignore precision + portion of format string if printing Inf, NaN, or NA values. + 2007-09-05 David Bateman <dbateman@free.fr> * DLD-FUNCTIONS/sort.cc (mx_sort_sparse, mx_sort_sparse_indexed):
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2618,8 +2618,17 @@ if (lo_ieee_isnan (val) || xisinf (val)) { std::string tfmt = fmt; - - tfmt.replace (tfmt.rfind (elt->type), 1, 1, 's'); + std::string::size_type i1, i2; + + tfmt.replace ((i1 = tfmt.rfind (elt->type)), + 1, 1, 's'); + + if ((i2 = tfmt.rfind ('.')) != NPOS && i2 < i1) + { + tfmt.erase (i2, i1-i2); + if (elt->prec < 0) + nsa--; + } const char *tval = xisinf (val) ? (val < 0 ? "-Inf" : "Inf")