[HP50g] why this ?
|
11-12-2017, 09:19 PM
(This post was last modified: 11-12-2017 09:34 PM by Gilles59.)
Post: #1
|
|||
|
|||
[HP50g] why this ?
I know it's not a good idea to change the value of the counter of a "FOR NEXT" loop. But consider :
Code:
You get 50. seems logic... Now try : Code: « 0. You get .... 1. The loop excecutes only once. Is this a bug or I misunderstand something ? EDIT : Ohoh ! The bug is only in approx mode ( |R ) .... NEXTPRIME always returns an integer ( 1. NEXTPRIME returns 2 and the loop dont works). With and I->R after NEXTPRIME, it's OK |
|||
11-12-2017, 11:16 PM
Post: #2
|
|||
|
|||
RE: [HP50g] why this ?
Shorter, but slower:
100 « -1, 1, ROT DO ROT 1, + ROT NEXTPRIME ROT DUP2 UNTIL ≥ END DROP2 » EVAL —> 25. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)