diff liboctave/array/idx-vector.cc @ 26415:f553b02e13c6 stable

Use "x == fix (x)" to detect integers rather than floor or round (bug #55347). * find.cc, oct-stream.cc, ov-usr-fcn.cc, idx-vector.cc, oct-inttypes.cc: Use "x == fix (x)" to detect integers rather than floor or round for performance.
author Rik <rik@octave.org>
date Thu, 03 Jan 2019 15:21:53 -0800
parents 00f796120a6d
children 0e77df67b522
line wrap: on
line diff
--- a/liboctave/array/idx-vector.cc	Thu Jan 03 15:06:49 2019 -0800
+++ b/liboctave/array/idx-vector.cc	Thu Jan 03 15:21:53 2019 -0800
@@ -152,7 +152,7 @@
           // find first non-integer, then gripe about it
           double b = r.base ();
           double inc = r.inc ();
-          octave::err_invalid_index (b != std::floor (b) ? b : b + inc);
+          octave::err_invalid_index (b != std::trunc (b) ? b : b + inc);
         }
     }
 }