# HG changeset patch # User John W. Eaton # Date 1412520111 14400 # Node ID 0279c601b49ce5d539b1ae938e8ec562b63f1ced # Parent 3ffb8f53e94019084321d065390f4d4e215fd465 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. diff -r 3ffb8f53e940 -r 0279c601b49c libinterp/parse-tree/pt-eval.cc --- 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);