Mercurial > hg > octave-lyh
changeset 7199:cd6ceb8cbf09
[project @ 2007-11-27 03:29:57 by jwe]
author | jwe |
---|---|
date | Tue, 27 Nov 2007 03:29:57 +0000 |
parents | 4555c116b420 |
children | 12a12ef1f1bc |
files | src/ChangeLog src/oct-stream.cc |
diffstat | 2 files changed, 14 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2007-11-26 John W. Eaton <jwe@octave.org> + * oct-stream.cc (DO_DOUBLE_CONV): Always use long. + * oct-stream.cc (do_write): Call float_value and double_value on octave_int<T> objects instead of relying on conversion operators.
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2491,39 +2491,22 @@ #define DO_DOUBLE_CONV(TQUAL) \ do \ { \ - if (elt->modifier == 'l') \ + if (val > std::numeric_limits<TQUAL long>::max () \ + || val < std::numeric_limits<TQUAL long>::min ()) \ { \ - if (val > std::numeric_limits<TQUAL long>::max () \ - || val < std::numeric_limits<TQUAL long>::min ()) \ - { \ - std::string tfmt = fmt; \ + std::string tfmt = fmt; \ \ - tfmt.replace (tfmt.rfind (elt->type), 1, ".f"); \ - tfmt.replace (tfmt.rfind (elt->modifier), 1, ""); \ + tfmt.replace (tfmt.rfind (elt->type), 1, ".f"); \ \ - retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, \ - val, who); \ - } \ - else \ - retval += do_printf_conv (os, fmt, nsa, sa_1, sa_2, \ - static_cast<TQUAL long> (val), who); \ + if (elt->modifier == 'l') \ + tfmt.replace (tfmt.rfind (elt->modifier), 1, ""); \ + \ + retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, \ + val, who); \ } \ else \ - { \ - if (val > std::numeric_limits<TQUAL int>::max () \ - || val < std::numeric_limits<TQUAL int>::min ()) \ - { \ - std::string tfmt = fmt; \ - \ - tfmt.replace (tfmt.rfind (elt->type), 1, ".f"); \ - \ - retval += do_printf_conv (os, tfmt.c_str (), nsa, sa_1, sa_2, \ - val, who); \ - } \ - else \ - retval += do_printf_conv (os, fmt, nsa, sa_1, sa_2, \ - static_cast<TQUAL int> (val), who); \ - } \ + retval += do_printf_conv (os, fmt, nsa, sa_1, sa_2, \ + static_cast<TQUAL long> (val), who); \ } \ while (0) @@ -2635,7 +2618,7 @@ switch (type) { case 'd': case 'i': case 'c': - DO_DOUBLE_CONV ( ); + DO_DOUBLE_CONV (); break; case 'o': case 'x': case 'X': case 'u':