diff libinterp/corefcn/oct-stream.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 ab6b8d8e0307
children d76f9e42290a
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc	Thu Jan 03 15:06:49 2019 -0800
+++ b/libinterp/corefcn/oct-stream.cc	Thu Jan 03 15:21:53 2019 -0800
@@ -5615,7 +5615,7 @@
       {
         double dval = val.double_value (true);
 
-        if (dval == math::round (dval) && dval <= limit)
+        if (dval == math::fix (dval) && dval <= limit)
           return true;
       }
 
@@ -5642,7 +5642,7 @@
 
         uint64_t limit = std::numeric_limits<uint64_t>::max ();
 
-        if (dval == math::round (dval) && dval >= 0 && dval <= limit)
+        if (dval == math::fix (dval) && dval >= 0 && dval <= limit)
           return true;
       }