Mercurial > hg > octave-lyh
changeset 5945:76cfea89e4e7
[project @ 2006-08-18 22:19:24 by jwe]
author | jwe |
---|---|
date | Fri, 18 Aug 2006 22:19:25 +0000 |
parents | d20c596b9b10 |
children | 4b433225128d |
files | src/ChangeLog src/pr-output.cc |
diffstat | 2 files changed, 57 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2006-08-18 John W. Eaton <jwe@octave.org> + * pr-output.cc (set_real_matrix_format): Also always include space + for sign if values are int, inf, or nan. + (set_complex_format, set_complex_matrix_format): Always include + space for sign in real format, but never in imaginary format. + * gripes.cc (gripe_logical_conversion): New function. * gripes.h: Provide decl. * ov.h (octave_value::bool_value, octave_value::bool_matrix_value,
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -440,7 +440,7 @@ else if (int_or_inf_or_nan) { int digits = x_max > x_min ? x_max : x_min; - fw = digits <= 0 ? 1 : digits; + fw = digits <= 0 ? 2 : digits + 1; if (inf_or_nan && fw < 4) fw = 4; rd = fw; @@ -588,9 +588,13 @@ else if (inf_or_nan || int_only) { int digits = x_max > x_min ? x_max : x_min; - i_fw = r_fw = digits <= 0 ? 1 : digits; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = digits <= 0 ? 1 : digits; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } rd = r_fw; } else @@ -626,9 +630,13 @@ ld = ld_max > ld_min ? ld_max : ld_min; rd = rd_max > rd_min ? rd_max : rd_min; - i_fw = r_fw = 1 + ld + 1 + rd; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = ld + 1 + rd; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } } if (! (bank_format || hex_format || bit_format) @@ -645,9 +653,13 @@ if (x_max > 100 || x_min > 100) exp_field++; - i_fw = r_fw = 1 + prec + exp_field; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = prec + exp_field; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } r_fmt = float_format (r_fw, prec - 1, std::ios::scientific); i_fmt = float_format (i_fw, prec - 1, std::ios::scientific); @@ -742,8 +754,8 @@ int digits = r_x_max > r_x_min ? r_x_max : r_x_min; i_fw = 0; r_fw = digits <= 0 ? 4 : digits + 3; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + if (inf_or_nan && r_fw < 4) + r_fw = 4; rd = 2; } else if (hex_format) @@ -761,16 +773,24 @@ else if (Vfixed_point_format && ! print_g) { rd = prec; - i_fw = r_fw = rd + 2; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = rd + 1; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } } else if (int_or_inf_or_nan) { int digits = x_max > x_min ? x_max : x_min; - i_fw = r_fw = digits <= 0 ? 1 : digits; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = digits <= 0 ? 1 : digits; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } rd = r_fw; } else @@ -806,9 +826,13 @@ ld = ld_max > ld_min ? ld_max : ld_min; rd = rd_max > rd_min ? rd_max : rd_min; - i_fw = r_fw = 1 + ld + 1 + rd; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = ld + 1 + rd; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } } if (! (bank_format || hex_format || bit_format) @@ -827,9 +851,13 @@ if (x_max > 100 || x_min > 100) exp_field++; - i_fw = r_fw = 1 + prec + exp_field; - if (inf_or_nan && i_fw < 4) - i_fw = r_fw = 4; + i_fw = prec + exp_field; + r_fw = i_fw + 1; + if (inf_or_nan && i_fw < 3) + { + i_fw = 3; + r_fw = 4; + } r_fmt = float_format (r_fw, prec - 1, std::ios::scientific); i_fmt = float_format (i_fw, prec - 1, std::ios::scientific);