fix bug around signFlag in sin and cos