Mercurial > hg > octave-terminal
changeset 12326:731a0b589cab
Range.cc (Range::Range (double, double, octave_idx_type)): correctly compute limit
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 02 Feb 2011 03:36:31 -0500 |
parents | 5d68277d4496 |
children | 2ad37783bf01 ad2ee858180b |
files | liboctave/ChangeLog liboctave/Range.cc |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2011-02-02 John W. Eaton <jwe@octave.org> + + * Range.cc (Range::Range (double, double, octave_idx_type)): + Correctly compute limit from base, increment and number of + elements. Bug #32321. + 2011-01-31 John W. Eaton <jwe@octave.org> * Sparse.cc (Sparse<T>::assign (const idx_vector&, const idx_vector&,
--- a/liboctave/Range.cc +++ b/liboctave/Range.cc @@ -37,8 +37,8 @@ #include "Array-util.h" Range::Range (double b, double i, octave_idx_type n) - : rng_base (b), rng_limit (b + n * i), rng_inc (i), - rng_nelem (n), cache () + : rng_base (b), rng_limit (b + (n-1) * i), rng_inc (i), + rng_nelem (n), cache () { if (! xfinite (b) || ! xfinite (i)) rng_nelem = -2;