small optim on trigonometry caclulation