switched from floating point to integer arithmetic