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: John W. Eaton
Subject: [Octave-bug-tracker] [bug #46859] Error in "for" cycle
Date: Sat, 09 Jan 2016 16:35:38 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.2.1

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

I agree that there is a bug of some sort, and certainly an incompatibility
with Matlab.  But I don't know what the best solution is.

In any case, my experience has been that when people come across things I like
this they typically expect something different.  the usual expectation is that
the result of T/dt should be exactly 1001 and that the range 2:T/dt should
have 1000 elements, not 999.  And that's what Octave tries to do here, but
then there is still a possible bug because it sets the end point of the range
to the result of the floating point calculation T/dt instead of 1001 even
though the beginning of the range and the increment are both integers, and
(again, if we were doing exact arithmetic) the endpoint would be as well.

These sorts of things have given us all kinds of trouble, and trying to be
"smart" about them by going to great lengths to compute the "proper" number of
elements for ranges can NEVER give the results that please everyone all the
time.

    _______________________________________________________

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]