diff libinterp/corefcn/data.cc @ 18869:23681c9ea7ba stable

better guess if rem or mod could be zero (bug #42627) * lo-mappers.h (xmod, xrem): Don't treat abs(x)<=1 specially. Return 0 if x/y is assumed an integer. * data.cc: New tests for rem and mod.
author Olaf Till <i7tiol@t-online.de>
date Fri, 27 Jun 2014 11:49:22 +0200
parents 9d185537e5d1
children 23e511f3395d
line wrap: on
line diff
--- a/libinterp/corefcn/data.cc	Fri Jun 20 18:55:38 2014 -0400
+++ b/libinterp/corefcn/data.cc	Fri Jun 27 11:49:22 2014 +0200
@@ -722,6 +722,8 @@
 %!error rem ([1, 2], [3, 4, 5])
 %!error rem (i, 1)
 
+# bug 42627
+%!assert (rem (0.94, 0.01), 0.0);
 */
 
 DEFALIAS (fmod, rem)
@@ -873,6 +875,9 @@
 ## non-integer real numbers
 %!assert (mod (2.1, 0.1), 0)
 %!assert (mod (2.1, 0.2), 0.1, eps)
+
+# bug 42627
+%!assert (mod (0.94, 0.01), 0.0);
 */
 
 // FIXME: Need to convert reduction functions of this file for single precision