changeset 13286:49ae6f497171

Use common code idiom x == fix (x) to detect integers * cosd.m, sind.m, tand.m, duplication_matrix.m: Use common code idiom x == fix (x) to detect integers.
author Rik <octave@nomad.inbox5.com>
date Fri, 07 Oct 2011 08:28:00 -0700
parents cb9b60b1c9bb
children 5c22edebf2e8
files scripts/elfun/cosd.m scripts/elfun/sind.m scripts/elfun/tand.m scripts/linear-algebra/duplication_matrix.m
diffstat 4 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/elfun/cosd.m	Thu Oct 06 23:39:14 2011 +0100
+++ b/scripts/elfun/cosd.m	Fri Oct 07 08:28:00 2011 -0700
@@ -32,7 +32,7 @@
   I = x / 180;
   y = cos (I .* pi);
   I = I + 0.5;
-  y(I == round (I) & finite (I)) = 0;
+  y(I == fix (I) & finite (I)) = 0;
 endfunction
 
 %!error(cosd())
--- a/scripts/elfun/sind.m	Thu Oct 06 23:39:14 2011 +0100
+++ b/scripts/elfun/sind.m	Fri Oct 07 08:28:00 2011 -0700
@@ -31,7 +31,7 @@
   endif
   I = x / 180;
   y = sin (I .* pi);
-  y(I == round (I) & finite (I)) = 0;
+  y(I == fix (I) & finite (I)) = 0;
 endfunction
 
 %!error(sind())
--- a/scripts/elfun/tand.m	Thu Oct 06 23:39:14 2011 +0100
+++ b/scripts/elfun/tand.m	Fri Oct 07 08:28:00 2011 -0700
@@ -33,8 +33,8 @@
   I0 = x / 180;
   I90 = (x-90) / 180;
   y = tan (I0 .* pi);
-  y(I0 == round (I0) & finite (I0)) = 0;
-  y(I90 == round (I90) & finite (I90)) = Inf;
+  y(I0 == fix (I0) & finite (I0)) = 0;
+  y(I90 == fix (I90) & finite (I90)) = Inf;
 endfunction;
 
 %!error(tand())
--- a/scripts/linear-algebra/duplication_matrix.m	Thu Oct 06 23:39:14 2011 +0100
+++ b/scripts/linear-algebra/duplication_matrix.m	Fri Oct 07 08:28:00 2011 -0700
@@ -68,7 +68,7 @@
     print_usage ();
   endif
 
-  if (! (isscalar (n) && n == round (n) && n > 0))
+  if (! (isscalar (n) && n > 0 && n == fix (n)))
     error ("duplication_matrix: N must be a positive integer");
   endif