changeset 27453:05f84e5cb08a

Display correct number of digits with "format long" and fixed_point_format (bug #56938). * pr-output.cc (make_real_matrix_format, make_complex_matrix_format, make_range_format): When fixed_point_format is true, set the number of digits to the right of the decimal point (rd) to precision - 1, rather than precision.
author Rik <rik@octave.org>
date Sat, 28 Sep 2019 04:20:49 -0700
parents 1aa7568aa139
children 43ece0b8318b
files libinterp/corefcn/pr-output.cc
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Fri Sep 27 17:49:14 2019 -0400
+++ b/libinterp/corefcn/pr-output.cc	Sat Sep 28 04:20:49 2019 -0700
@@ -529,7 +529,7 @@
     }
   else if (Vfixed_point_format && ! print_g)
     {
-      rd = prec;
+      rd = prec - 1;
       fw = rd + 3;
       if (inf_or_nan && fw < 4)
         fw = 4;
@@ -939,9 +939,9 @@
     }
   else if (Vfixed_point_format && ! print_g)
     {
-      rd = prec;
+      rd = prec - 1;
       i_fw = rd + 1;
-      r_fw = i_fw + 1;
+      r_fw = i_fw + 2;
       if (inf_or_nan && i_fw < 3)
         {
           i_fw = 3;
@@ -1183,7 +1183,7 @@
     }
   else if (Vfixed_point_format && ! print_g)
     {
-      rd = prec;
+      rd = prec - 1;
       fw = rd + 3;
     }
   else