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

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

[Octave-bug-tracker] [bug #46859] Error in "for" cycle


From: Ceral Paquet
Subject: [Octave-bug-tracker] [bug #46859] Error in "for" cycle
Date: Sat, 09 Jan 2016 22:04:24 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

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

I did a little playing around in Matlab and it seems that they consider float
values to be equal if they are within +/- eps(x)/2.

E.g.
 
 % Matlab
 x = 500
 x == (x+eps(x)/2)
 x == (x+eps(x)/1.99999999)

 500
 1
 0

Likewise,

 numel(1:(x-eps(x)/2))
 numel(1:(x-eps(x)/1.99999999))

 500
 499

Doing the same thing in Octave gives

 % Octave
 500
 1
 0

and 

 500
 500

So it looks like Octave's range function is using different logic to determine
whether to include the endpoint. It seems to allow a wider tolerance up to
about 6-7 times eps(x):

 numel(1:(x-eps(x)*6))
 500

 numel(1:(x-eps(x)*7))
 499

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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