sin and cos extended to work on [0,pi/4).