10 to the power of 10 is 10,000,000,000 but the scripting engine uses signed 32-bit integers and the maximum value that can be held by such integers is 2,147,483,647 (2^31 − 1).
Any value above this will cause the integer to overflow so you have to be aware of this and manually check the boundaries. In your case this would mean checking that getarg(0) is shorter than 10 characters long so
if ( .@num == 0 || .@num >= 10 ** 9 ) return getarg(0);
instead of
if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
to avoid the case where getstrlen is above 10