Menu

#1429 Erratic behaviour of do for loops

closed-duplicate
nobody
5
2015-03-23
2014-06-13
Anonymous
No

I have noticed an strange behaviour of do for loops. Depending of the loop limits and increments of the iterator gnuplot behaves erratically.

This piece of code works ok:

do for [i=999:2000000:1000] {
print i
}

This one do nothing, it exit the loop without print any value of i:

do for [i=999:3000000:1000] {
print i
}

This one works ok until i=704999 and then exits the loop :

do for [i=999:5000000:1000] {
print i
}

This one works ok again:

do for [i=999:5000000:100] {
print i
}

I have reproduced this behaviour in a desktop with ubuntu 12.04 and gnuplot 4.6 patch level 4, and in a macbook with gnuplot 4.6 patch level 5 (installed through macports).

Discussion

  • Ethan Merritt

    Ethan Merritt - 2014-06-13
    • status: open --> pending-duplicate
     
  • Ethan Merritt

    Ethan Merritt - 2014-06-13

    This bug has already been fixed in 5.0rc1 and the fix will be in 4.6.6 also.

    See Bug #1358

     
    • Christoph Bersch

      Works fine also for large increments:

      do for [i=400000:4000000:400000] { print i }
      
       

      Last edit: Christoph Bersch 2014-06-18
  • Antonio Tejero

    Antonio Tejero - 2014-06-13

    Thanks, I tried but didn't find something similar.

    :)

     
  • Ethan Merritt

    Ethan Merritt - 2014-06-13
    • status: pending-duplicate --> closed-duplicate
     

Log in to post a comment.