tact-lang / tact-docs

Tact main documentation
https://docs.tact-lang.org
57 stars 39 forks source link

Correct description of the `repeat` loop boundaries #379

Closed novusnota closed 2 months ago

novusnota commented 2 months ago

The exit code 5 will be thrown when the integer is out of its 257-bit signed bounds, NOT when the integer is bigger than $2^{31} - 1$

anton-trunov commented 2 months ago

Is there a reference backing this?

novusnota commented 2 months ago

The tests in https://github.com/tact-lang/tact/pull/766

They intentionally didn't introduce giant ints as they're automatically spotted by const-eval and reported as an error there. And runtime overflows also cause exit code 5.

anton-trunov commented 2 months ago

It looks like we need to open an issue in ton-docs then: https://docs.ton.org/develop/func/statements#repeat-loop

If the number of times is less than -2^31 or greater than 2^31 - 1, range check exception is thrown.

novusnota commented 2 months ago

It looks like we need to open an issue in ton-docs then: https://docs.ton.org/develop/func/statements#repeat-loop

If the number of times is less than -2^31 or greater than 2^31 - 1, range check exception is thrown.

Yes, there is no error for numbers less than -2^31. But there is for greater — I just made an whoopsie and looked at a different test, so this issue is incorrect :)