May 04, 2024, 06:28:26 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


FOR NEXT Handicap?

Started by Ficko, December 24, 2006, 11:24:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ficko

I am not trying to be a pain-in-ass but I think this:

OPENCONSOLE
DEF T AS Double
T = 100
FOR A=0 TO INT(T)
ÂÃ,  PRINT A
NEXT A
DO:UNTIL INKEY$<>""

Should work.
Indeed "T" automatically should be converted to TYPE of "A".

That's only my humble opinion.ÂÃ,  ;)

Csaba



Ionic Wind Support Team

the INT function returns an INT64 when passed a DOUBLE since both are 64 bit.

FOR only works with 32 bit integers.  Use a WHILE or DO loop if you want to count using floating point.
Ionic Wind Support Team

Ficko

December 24, 2006, 12:18:27 PM #2 Last Edit: December 24, 2006, 12:23:03 PM by Ficko
Ok,

Than You for you fast reply! :)

Csaba

Ionic Wind Support Team

However with that said I think we need an inline way of casting a double to an int.  Or at least I can let the FOR statment use 64 bit integers, not that you would want to be stuck in a loop that long ;)
Ionic Wind Support Team

Ficko

Yes the most semantically correct way would be a function like INT64() for 64bits integers and INT<32>() for 32 but that would throw up backwards compatibility.

So you have to keep INT() how it is and may introduce an INT64().

To running FOR NEXT on 64 bits isn’t a bad Idea either sooner or later you will import Ebasic on a 64 bit assembler anyway, don’t you?ÂÃ,  ;D

-Just teasing you!-
;)