octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #41674] image package: temporary arrays in imr


From: Felipe G. Nievinski
Subject: [Octave-bug-tracker] [bug #41674] image package: temporary arrays in imresize are doubles
Date: Thu, 27 Feb 2014 19:52:06 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36

Follow-up Comment #5, bug #41674 (project octave):

you're right, I was wrong.

although, hard coded tolerance (1e-6) is to be avoided, not least because
Octave might be compiled in 64 bits.

I'd go for absolute comparison and take tol = eps(XDs):

if(all(isequalAbs(XD, XDs, k*eps(XDs))) ...
&& all(isequalAbs(YD, YDs, k*eps(YDs))))

if you need to relax the tolerance, then set k = 10.


here's a quick test showing it's viable:


XD = linspace(1, 5, 10)';
[XD, abs(XD-single(XD)), eps(single(XD)), abs(XD-single(XD)) <
eps(single(XD))]

ans =

               1               0    1.192093e-07               1
        1.444444    2.649095e-08    1.192093e-07               1
        1.888889    5.298191e-08    1.192093e-07               1
        2.333333    7.947286e-08    2.384186e-07               1
        2.777778    1.059638e-07    2.384186e-07               1
        3.222222    1.059638e-07    2.384186e-07               1
        3.666667    7.947286e-08    2.384186e-07               1
        4.111111    5.298191e-08    4.768372e-07               1
        4.555555    2.119276e-07    4.768372e-07               1
               5               0    4.768372e-07               1




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41674>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]