comparison libinterp/parse-tree/pt-eval.cc @ 19254:6443693a176f

maint: Periodic merge of gui-release to default.
author John W. Eaton <jwe@octave.org>
date Sun, 05 Oct 2014 10:48:26 -0400
parents 2a8243d8327a 3978a5509f40
children 5db5619fe54e
comparison
equal deleted inserted replaced
19249:c61deba773ab 19254:6443693a176f
334 if (rhs.is_range ()) 334 if (rhs.is_range ())
335 { 335 {
336 Range rng = rhs.range_value (); 336 Range rng = rhs.range_value ();
337 337
338 octave_idx_type steps = rng.nelem (); 338 octave_idx_type steps = rng.nelem ();
339 double b = rng.base ();
340 double increment = rng.inc ();
341 339
342 for (octave_idx_type i = 0; i < steps; i++) 340 for (octave_idx_type i = 0; i < steps; i++)
343 { 341 {
344 // Use multiplication here rather than declaring a 342 octave_value val (rng.elem (i));
345 // temporary variable outside the loop and using
346 //
347 // tmp_val += increment
348 //
349 // to avoid problems with limited precision. Also, this
350 // is consistent with the way Range::matrix_value is
351 // implemented.
352
353 octave_value val (b + i * increment);
354 343
355 ult.assign (octave_value::op_asn_eq, val); 344 ult.assign (octave_value::op_asn_eq, val);
356 345
357 if (! error_state && loop_body) 346 if (! error_state && loop_body)
358 loop_body->accept (*this); 347 loop_body->accept (*this);