Mercurial > hg > octave-shane
changeset 12363:eb7c0ba7ca87 release-3-4-x
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 | 3de1dae1e403 |
children | 1a24d55b1714 |
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;