# HG changeset patch # User Rik # Date 1569010751 25200 # Node ID ba3fc70ba996faa9b00ddcc394523040b74a9255 # Parent e0134184c1fd84fbe85dddf0287f14c7a4865b23 Correctly print "format g" when variable is of single type (bug #56926). * pr-output.cc (make_real_format, make_real_matrix_format, make_complex_format, make_complex_matrix_format, make_range_format): When calling float_format constructor, use precision determined to be the minimum of the output_precision or the number of significant digits. diff -r e0134184c1fd -r ba3fc70ba996 libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc Fri Sep 20 11:44:44 2019 -0700 +++ b/libinterp/corefcn/pr-output.cc Fri Sep 20 13:19:11 2019 -0700 @@ -418,10 +418,7 @@ || fw > pr_output_traits::max_field_width)) { if (print_g) - { - int prec = output_precision (); - fmt = float_format (prec+5, prec); - } + fmt = float_format (prec+5, prec); else { // e+ddd @@ -585,10 +582,7 @@ || fw > pr_output_traits::max_field_width)))) { if (print_g) - { - int prec = output_precision (); - fmt = float_format (prec+5, prec); - } + fmt = float_format (prec+5, prec); else { int ex = 4; @@ -763,7 +757,6 @@ { if (print_g) { - int prec = output_precision (); int width = prec + 5; r_fmt = float_format (width, prec); i_fmt = float_format (width, prec); @@ -989,7 +982,6 @@ { if (print_g) { - int prec = output_precision (); int width = prec + 5; r_fmt = float_format (width, prec); i_fmt = float_format (width, prec); @@ -1196,10 +1188,7 @@ || fw > pr_output_traits::max_field_width)))) { if (print_g) - { - int prec = output_precision (); - fmt = float_format (prec+5, prec); - } + fmt = float_format (prec+5, prec); else { int ex = 4;