Mercurial > octave
changeset 19218:0279c601b49c stable
compute for loop indices consistently with range element results
* pt-eval.cc (tree_evaluator::visit_simple_for_command): Use
Range::elem instead of compuiting elements directly. This change
appears to fix obscure test failures in eig.cc-tst on 64-bit Windows
systems. See also task #13313.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 05 Oct 2014 10:41:51 -0400 |
parents | 3ffb8f53e940 |
children | 3978a5509f40 c766a1f63c40 |
files | libinterp/parse-tree/pt-eval.cc |
diffstat | 1 files changed, 1 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc Sun Oct 05 10:24:07 2014 -0400 +++ b/libinterp/parse-tree/pt-eval.cc Sun Oct 05 10:41:51 2014 -0400 @@ -336,21 +336,10 @@ Range rng = rhs.range_value (); octave_idx_type steps = rng.nelem (); - double b = rng.base (); - double increment = rng.inc (); for (octave_idx_type i = 0; i < steps; i++) { - // Use multiplication here rather than declaring a - // temporary variable outside the loop and using - // - // tmp_val += increment - // - // to avoid problems with limited precision. Also, this - // is consistent with the way Range::matrix_value is - // implemented. - - octave_value val (b + i * increment); + octave_value val (rng.elem (i)); ult.assign (octave_value::op_asn_eq, val);