diff libinterp/corefcn/pr-output.cc @ 28637:fb37f50d5ba8

new Range::final_value function * Range.h (Range::final_value): New function. * pr-output.cc (octave_print_internal (std::ostream&, const Range&, bool, int)): Use Range::final_value instead of computing it here. * xpow.cc (elem_expow (double, const Range&)): Likewise. (elem_expow (const Complex&, const Range&)): Likewise.
author John W. Eaton <jwe@octave.org>
date Thu, 06 Aug 2020 15:36:30 -0400
parents a3db48e66ef8
children 98192ec1621f
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Thu Aug 06 15:09:30 2020 -0400
+++ b/libinterp/corefcn/pr-output.cc	Thu Aug 06 15:36:30 2020 -0400
@@ -2494,6 +2494,7 @@
   double base = r.base ();
   double increment = r.increment ();
   double limit = r.limit ();
+  double final_value = r.final_value ();
   octave_idx_type num_elem = r.numel ();
 
   if (plus_format && ! pr_as_read_syntax)
@@ -2575,12 +2576,7 @@
                     val = base + i * increment;
 
                   if (i == num_elem - 1)
-                    {
-                      // See the comments in Range::matrix_value.
-                      if ((increment > 0 && val >= limit)
-                          || (increment < 0 && val <= limit))
-                        val = limit;
-                    }
+                    val = final_value;
 
                   os << "  ";