Mercurial > hg > octave-lyh
changeset 16339:0c340bf413d7
allow exponent in output to always have 3 digits
* pr-output.cc (set_real_format): Always allow 3 digits for exponent.
Increase field width by 1 for engineering and scientific formats.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 19 Mar 2013 20:51:27 -0400 |
parents | 8aeb5d5c3747 |
children | 045ce3896e3f |
files | libinterp/interpfcn/pr-output.cc |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interpfcn/pr-output.cc +++ b/libinterp/interpfcn/pr-output.cc @@ -605,23 +605,24 @@ fmt = float_format (); else { - int ex = 4; - if (digits > 100) - ex++; + // e+ddd + int ex = 5; if (print_eng) { - fw = 4 + prec + ex; + // -ddd. + fw = 5 + prec + ex; if (inf_or_nan && fw < 6) fw = 6; fmt = float_format (fw, ex, prec - 1, std::ios::fixed); } else { - fw = 2 + prec + ex; + // -d. + fw = 3 + prec + ex; if (inf_or_nan && fw < 4) fw = 4; - fmt = float_format (fw, prec - 1, std::ios::scientific); + fmt = float_format (fw, ex, prec - 1, std::ios::scientific); } }