Following code generates Floating point exception: echo $(( 2**63 % -1 )) I don't have debug symbols installed at the moment, sorry. Reading symbols from busybox...(no debugging symbols found)...done. (gdb) run sh -c 'echo $(( 2**63 % -1 ))' Starting program: /bin/busybox sh -c 'echo $(( 2**63 % -1 ))' Program received signal SIGFPE, Arithmetic exception. 0x0000000000423b85 in ?? () This exception only appear on 64 bits apparently, tried on 32 bits but it didn't occur.
The same happens in bash. The cause is that MAX_NEGATIVE_INT / -1 = MAX_POSITIVE_INT+1 and thus is not representable. Therefore these ops fail: rez /= right_side_val; rez %= right_side_val; They dont fail in 32-bit case because 64-bit wide divide in 32-bit case is handled as a several divides of smaller width. The result is wrong, though (since correct result is not representable), Fixed in git. Thanks!