# HG changeset patch # User jwe # Date 1189016790 0 # Node ID c40c71200c65ec16547a8d0ddbf67b29c30b466a # Parent ab9a0ffee27f68e5e970a30b34039855dd9d3bf5 [project @ 2007-09-05 18:26:30 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2007-09-05 Michael Goffioul + + * 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 * DLD-FUNCTIONS/sort.cc (mx_sort_sparse, mx_sort_sparse_indexed): diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- 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")