Very weird issue with double to int conversion inside the loop

Printable View