# Maximum negative integer problem

Attention Topic was automatically imported from the old Question2Answer platform.

Documentation says that int is in range [-9223372036854775808, 9223372036854775807], but when I set int value to maximum negative value (-9223372036854775808 or hex 8000 0000 0000 0000) it says:

“E 0:00:00.460 to_int64: Cannot represent 9223372036854775808 as 64-bit integer, provided value is too big. <C++ Error> Condition “overflow” is true. Returned: sign == 1 ? 9223372036854775807LL : (-9223372036854775807LL - 1) <C++ Source> core/ustring.cpp:1840 @ to_int64()”

Why a cant set integer to hex value of 8000 0000 0000 0000. Can someone explain what I what i’m doing wrong here?

The max positive value of a signed 64-bit int in HEX is `7FFF FFFF FFFF FFFF`. So, your hex value is too big by 1.

Yes, but max negative value is 8000 0000 0000 0000, and it can’t be set. If I set int value to hex 8000 0000 0000 0000 (max negative int) Godot returns positive int 9223372036854775807, but if I set int value to max negative int in decimal -9223372036854775808 it returns -9223372036854775807, not a max negative int.

pospathos | 2020-12-30 09:08

Hmmm… I see that it’s possible to successfully set a value in the range of `-0x7fff ffff ffff ffff --> 0x7fff ffff ffff ffff`, however, the INT64_MIN value of `-0x8000 0000 0000 0000` is not accepted.

This feels like a bug to me…

Poking around, it seems likely to have been fixed by this commit:

Fix overflow and underflow checks for string conversion to int · godotengine/godot@687b127 · GitHub

jgodfrey | 2020-12-30 16:44