diff scripts/general/bicubic.m @ 7795:df9519e9990c

Handle single precision eps values
author David Bateman <dbateman@free.fr>
date Mon, 12 May 2008 22:57:11 +0200
parents a1dbe9d80eee
children bc982528de11
line wrap: on
line diff
--- a/scripts/general/bicubic.m	Mon May 12 01:35:30 2008 +0200
+++ b/scripts/general/bicubic.m	Mon May 12 22:57:11 2008 +0200
@@ -48,6 +48,13 @@
     extrapval = NaN;
   endif
 
+  if (isa (X, "single") || isa (Y, "single") || isa (Z, "single") || 
+      isa (XI, "single") || isa (YI, "single"))
+    myeps = eps("single");
+  else
+    myeps = eps;
+  endif
+
   if (nargin <= 2)
     ## bicubic (Z) or bicubic (Z, 2)
     if (nargin == 1) 
@@ -94,9 +101,9 @@
 
 
     X = reshape (X, 1, cz);
-    X(cz) *= 1 + sign (X(cz))*eps;
+    X(cz) *= 1 + sign (X(cz))*myeps;
     if (X(cz) == 0) 
-      X(cz) = eps;
+      X(cz) = myeps;
     endif; 
     XI = reshape (XI, 1, length (XI));
     [m, i] = sort ([X, XI]);
@@ -104,9 +111,9 @@
     xidx = o(find (i > cz));
     
     Y = reshape (Y, rz, 1);
-    Y(rz) *= 1 + sign (Y(rz))*eps;
+    Y(rz) *= 1 + sign (Y(rz))*myeps;
     if (Y(rz) == 0) 
-      Y(rz) = eps;
+      Y(rz) = myeps;
     endif; 
     YI = reshape (YI, length (YI), 1);
     [m, i] = sort ([Y; YI]);