See manual/variables. A var has 32 bits. Your code produces wrong results because you're exceeding the var precision. - Please only post engine bugs to the bug forum, not script bugs.