>> As I see a question about FOR/NEXT loops, I have mine:
>> the subsequent peice of code gives me an unexpected result
>> FOR n = 2.95 to 3.05 STEP 0.01 : print n, INT(n)
>> Why ?
>Only guessing because I can't try this until I get home, but when n
>reaches the value 2.9999.... (the nearest it'll get to 3.00 because
>0.01 is not represented exactly internally [that would need an infinite
>number of bits]), then PRINT n will round up to 3, whereas INT(n) will
>return the correct answer (2) which needs no rounding and therefore
>prints as 2.
Print returns 3 because of rounding of the QL float precision of >9 digits
to 7 digits available for printing. INT operates directly from QL float
format and will therefore give the right result: 2. This will again be
rounded to 7 digitsby print but obviously 2.0000000 = 2.000000 so nothing
will change.
Nasta