Mercurial > hg > octave-lojdl
diff src/oct-stream.cc @ 4305:98e65d1728a1
[project @ 2003-01-23 16:48:11 by jwe]
author | jwe |
---|---|
date | Thu, 23 Jan 2003 16:48:11 +0000 |
parents | e15a96673976 |
children | 1b3804420b1b |
line wrap: on
line diff
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2299,23 +2299,34 @@ if (val_cache) { if ((xisnan (val) || xisinf (val) - && (elt->type == 'd' - || elt->type == 'i' - || elt->type == 'c' - || elt->type == 'o' - || elt->type == 'x' - || elt->type == 'X' - || elt->type == 'u'))) + || val > INT_MAX || val < INT_MIN) + && (elt->type == 'd' + || elt->type == 'i' + || elt->type == 'c' + || elt->type == 'o' + || elt->type == 'x' + || elt->type == 'X' + || elt->type == 'u')) { std::string tfmt = fmt; - tfmt.replace (tfmt.rfind (elt->type), 1, 1, 's'); - - const char *tval = xisinf (val) - ? (val < 0 ? "-Inf" : "Inf") : "NaN"; - - retval += do_printf_conv (os, tfmt.c_str (), - nsa, sa_1, sa_2, tval); + if (xisnan (val) || xisinf (val)) + { + tfmt.replace (tfmt.rfind (elt->type), 1, 1, 's'); + + const char *tval = xisinf (val) + ? (val < 0 ? "-Inf" : "Inf") : "NaN"; + + retval += do_printf_conv (os, tfmt.c_str (), + nsa, sa_1, sa_2, tval); + } + else + { + tfmt.replace (tfmt.rfind (elt->type), 1, ".f"); + + retval += do_printf_conv (os, tfmt.c_str (), + nsa, sa_1, sa_2, val); + } } else {