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

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

[Octave-bug-tracker] [bug #42589] Inaccurate results with the colon oper


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #42589] Inaccurate results with the colon operator
Date: Tue, 24 Jun 2014 16:29:09 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0 Iceweasel/29.0.1

Follow-up Comment #30, bug #42589 (project octave):

Octave's range type was implemented simply as a way to save memory.  I saw no
reason to store all elements of a:b if they weren't going to be needed all at
once as an array object.  Other than that, the range object should have
behavior that is as close as possible to what Matlab does for ranges, which is
to immediatly convert to an array on construction.

The mistake was in the implementation of addition and multiplication operators
for Octave.  I think this is fixed now.  It's still possible that there will
be a difference in intermediate range values because instead of computing all
the values for a range, then multiplying them all by a constant (for example),
we are just adjusting the endpoints and recalculating the intermediate values.
 I don't know, but I suspect it is possible to end up with different values
this way.

In any case, I'm considering providing an option that will be enabled by
default if using --traditional (aka --maximum-braindamage) to disable the
range type optimization so that the behavior is even more like Matlab's (i.e.,
generate the array value instead of storing the more memory efficient range
type).

I'm also considering doing the same for the diagonal and permutation matrix
types.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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