It'd be safer to use 0.5 * instead of 1/2 since if params[2] is an integer, there may be integer division happening in Python 2.x