Added division by zero check to Mac platform. There seem to be inaccuracies in calculation when starting x is negative, odd and greater than -21………..