removing floating-point operations

replaced floating-point operations with fixed-point approximations, and
optimized integer division used in drive function.