changeset 32331:b5337260e574

Backed out changeset 0c32e838e522
author John W. Eaton <jwe@octave.org>
date Sat, 23 Sep 2023 12:11:08 -0400
parents da0079d97965
children 1a63396c3173
files libinterp/corefcn/interpreter.cc liboctave/array/Range.cc scripts/general/interpn.m
diffstat 3 files changed, 4 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Sat Sep 23 11:12:38 2023 -0400
+++ b/libinterp/corefcn/interpreter.cc	Sat Sep 23 12:11:08 2023 -0400
@@ -2084,8 +2084,6 @@
 
   m_error_system.disable_warning ("Octave:abbreviated-property-match");
   m_error_system.disable_warning ("Octave:colon-nonscalar-argument");
-  m_error_system.disable_warning ("Octave:range-limit-not-integer");
-  m_error_system.disable_warning ("Octave:floating-point-in-range");
   m_error_system.disable_warning ("Octave:data-file-in-path");
   m_error_system.disable_warning ("Octave:empty-index");
   m_error_system.disable_warning ("Octave:function-name-clash");
--- a/liboctave/array/Range.cc	Sat Sep 23 11:12:38 2023 -0400
+++ b/liboctave/array/Range.cc	Sat Sep 23 12:11:08 2023 -0400
@@ -147,7 +147,7 @@
 
   // If the range has only one element, then the base needs to be an
   // integer.
-  if (nel == 1 && math::nint_big (base) == base)
+  if (nel == 1 && math::nint_big (base))
     return true;
 
   return false;
@@ -216,23 +216,11 @@
       return;
     }
 
-  // Warn about floating point values in ranges.
-  if (math::nint_big (base) == base && math::nint_big (inc) == inc
-      && math::nint_big (limit) != limit)
-    (*current_liboctave_warning_with_id_handler)
-      ("Octave:range-limit-not-integer",
-       "range limit is not an integer and will not be reached exactly");
-  else if (math::nint_big (base) != base || math::nint_big (inc) != inc)
-    (*current_liboctave_warning_with_id_handler)
-      ("Octave:floating-point-in-range",
-       "using floating point values in ranges may yield unexpected results");
-
   // The following case also catches Inf values for increment when
   // there will be only one element.
 
-  if ( ( (limit <= base && base + inc < limit) 
-         || (limit >= base && base + inc > limit) )
-        && ! xteq (base + inc, limit) )
+  if ((limit <= base && base + inc < limit)
+      || (limit >= base && base + inc > limit))
     {
       final_val = base;
       nel = 1;
--- a/scripts/general/interpn.m	Sat Sep 23 11:12:38 2023 -0400
+++ b/scripts/general/interpn.m	Sat Sep 23 12:11:08 2023 -0400
@@ -131,7 +131,7 @@
     y = cell (1, nd);
     for i = 1 : nd
       x{i} = 1 : sz(i);
-      y{i} = (2^m : (sz(i) * 2^m)) / 2^m;
+      y{i} = 1 : (1 / (2 ^ m)) : sz(i);
     endfor
     y{1} = y{1}.';
     [y{:}] = ndgrid (y{:});