Your version of ksh on Cygwin is probably pdksh (Public domain ksh.) Check $KSH_VERSION to be certain. pdksh only supports integer arithmetic and uses 32-bit integers for that purpose on Cygwin. Therefore it is limited in the size of the integers which it can handle. As a test, set a to 4000 and see if the result is 2000.