Closed
Description
Godot version
Godot v4.1.1.stable
System information
Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated GeForce GT 640 () - AMD FX(tm)-8320 Eight-Core Processor (8 Threads)
Issue description
for
loops with large int
values return negative values instead of the correct values.
Steps to reproduce
Example code:
const BLICKS:int = 705600000
var start_loop:int = BLICKS * 40
var end_loop:int = BLICKS * 42
var step_loop: int = BLICKS / 32
for i in range( start_loop, end_loop, step_loop ):
print(i)
Example output:
-1840771072
-1818721072
-1796671072
-1774621072
-1752571072
-1730521072
-1708471072
...
In contrast, a while
loop returns the correct values:
const BLICKS:int = 705600000
var start_loop:int = BLICKS * 40
var end_loop:int = BLICKS * 42
var step_loop: int = BLICKS / 32
while start_loop < end_loop:
print(start_loop)
start_loop += step_loop
Correct output:
28224000000
28246050000
28268100000
28290150000
28312200000
28334250000
28356300000
28378350000
...
Minimal reproduction project
N/A