fix incorrect cos value (limit to [-1.0:1.0] bounds