diff --git a/src/s_cosf.c b/src/s_cosf.c index 3e12f7a..1faf534 100644 --- a/src/s_cosf.c +++ b/src/s_cosf.c @@ -50,24 +50,22 @@ cosf(float x) return __kernel_cosdf(x); } if(ix<=0x407b53d1) { /* |x| ~<= 5*pi/4 */ - if(ix>0x4016cbe3) /* |x| ~> 3*pi/4 */ - return -__kernel_cosdf(x + (hx > 0 ? -c2pio2 : c2pio2)); - else { + if(ix<=0x4016cbe3) { /* |x| ~> 3*pi/4 */ if(hx>0) return __kernel_sindf(c1pio2 - x); else return __kernel_sindf(x + c1pio2); - } + } else + return -__kernel_cosdf(x + (hx > 0 ? -c2pio2 : c2pio2)); } if(ix<=0x40e231d5) { /* |x| ~<= 9*pi/4 */ - if(ix>0x40afeddf) /* |x| ~> 7*pi/4 */ - return __kernel_cosdf(x + (hx > 0 ? -c4pio2 : c4pio2)); - else { + if(ix<=0x40afeddf) { /* |x| ~> 7*pi/4 */ if(hx>0) return __kernel_sindf(x - c3pio2); else return __kernel_sindf(-c3pio2 - x); - } + } else + return __kernel_cosdf(x + (hx > 0 ? -c4pio2 : c4pio2)); } /* cos(Inf or NaN) is NaN */ diff --git a/src/s_sinf.c b/src/s_sinf.c index e1efb47..6fed17a 100644 --- a/src/s_sinf.c +++ b/src/s_sinf.c @@ -56,7 +56,7 @@ sinf(float x) else return -__kernel_cosdf(x + s1pio2); } else - return __kernel_sindf((hx > 0 ? s2pio2 : -s2pio2) - x); + return __kernel_sindf((hx > 0 ? s2pio2 : -s2pio2) - x); } if(ix<=0x40e231d5) { /* |x| ~<= 9*pi/4 */ if(ix<=0x40afeddf) { /* |x| ~<= 7*pi/4 */ @@ -65,7 +65,7 @@ sinf(float x) else return __kernel_cosdf(x + s3pio2); } else - return __kernel_sindf(x + (hx > 0 ? -s4pio2 : s4pio2)); + return __kernel_sindf(x + (hx > 0 ? -s4pio2 : s4pio2)); } /* sin(Inf or NaN) is NaN */ @@ -79,7 +79,7 @@ sinf(float x) case 1: return __kernel_cosdf(y); case 2: return __kernel_sindf(-y); default: - return -__kernel_cosdf(y); + return -__kernel_cosdf(y); } } }