FOR LOOP "STEP" ?
|
01-31-2015, 06:50 PM
Post: #2
|
|||
|
|||
RE: FOR LOOP "STEP" ?
(01-31-2015 04:27 PM)DrD Wrote: This is peculiar to say the least: This could be a simple example for one of the many numerical pitfalls when working with reals. ;-) (01-31-2015 04:27 PM)DrD Wrote: It's generally not a good idea to compare reals with "=". Just a slight roundoff error in the last digit, and the test will fail. This may (!) be the crucial point here. You may try a different less error-prone test instead, something like IF abs(angl – pi/3) < 1E–9 THEN ... Or, even better, use an integer counter variable: Code: FOR k FROM 0 to 6 DO Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
FOR LOOP "STEP" ? - DrD - 01-31-2015, 04:27 PM
RE: FOR LOOP "STEP" ? - Dieter - 01-31-2015 06:50 PM
RE: FOR LOOP "STEP" ? - cyrille de brébisson - 02-02-2015, 07:38 AM
|
User(s) browsing this thread: 1 Guest(s)