Mercurial > octave
changeset 27429:e0134184c1fd
Fix regression with display of "format g" (bug #55919).
* pr-output.cc (make_real_format, make_real_matrix_format, make_complex_format,
make_complex_matrix_format, make_range_format): When print_g is true, call
float_format constructor with width and precision arguments rather than using
constructor defaults.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 20 Sep 2019 11:44:44 -0700 |
parents | e94868c1369f |
children | ba3fc70ba996 |
files | libinterp/corefcn/pr-output.cc |
diffstat | 1 files changed, 20 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc Thu Jun 13 08:00:41 2019 -0600 +++ b/libinterp/corefcn/pr-output.cc Fri Sep 20 11:44:44 2019 -0700 @@ -418,7 +418,10 @@ || fw > pr_output_traits<T>::max_field_width)) { if (print_g) - fmt = float_format (); + { + int prec = output_precision (); + fmt = float_format (prec+5, prec); + } else { // e+ddd @@ -582,7 +585,10 @@ || fw > pr_output_traits<T>::max_field_width)))) { if (print_g) - fmt = float_format (); + { + int prec = output_precision (); + fmt = float_format (prec+5, prec); + } else { int ex = 4; @@ -757,8 +763,10 @@ { if (print_g) { - r_fmt = float_format (); - i_fmt = float_format (); + int prec = output_precision (); + int width = prec + 5; + r_fmt = float_format (width, prec); + i_fmt = float_format (width, prec); } else { @@ -981,8 +989,10 @@ { if (print_g) { - r_fmt = float_format (); - i_fmt = float_format (); + int prec = output_precision (); + int width = prec + 5; + r_fmt = float_format (width, prec); + i_fmt = float_format (width, prec); } else { @@ -1186,7 +1196,10 @@ || fw > pr_output_traits<T>::max_field_width)))) { if (print_g) - fmt = float_format (); + { + int prec = output_precision (); + fmt = float_format (prec+5, prec); + } else { int ex = 4;