diff libinterp/corefcn/xpow.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/xpow.cc	Thu Aug 06 15:09:30 2020 -0400
+++ b/libinterp/corefcn/xpow.cc	Thu Aug 06 15:36:30 2020 -0400
@@ -732,8 +732,7 @@
         }
       else
         {
-          // Don't use Range::limit () here.
-          double limit = std::pow (a, r.base () + (n-1) * r.increment ());
+          double limit = std::pow (a, r.final_value ());
           double inc = std::pow (a, -r.increment ());
           result(n-1) = limit;
           for (octave_idx_type i = n-2; i >= 0; i--)
@@ -962,8 +961,7 @@
         }
       else
         {
-          // Don't use Range::limit () here.
-          Complex limit = std::pow (a, r.base () + (n-1) * r.increment ());
+          Complex limit = std::pow (a, r.final_value ());
           Complex inc = std::pow (a, -r.increment ());
           result(n-1) = limit;
           for (octave_idx_type i = n-2; i >= 0; i--)