Skip to content

Commit e91e6dc

Browse files
committed
Minor formatting to make sin/cos easier to read
1 parent 5b4fb9a commit e91e6dc

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/s_cosf.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,22 @@ cosf(float x)
5050
return __kernel_cosdf(x);
5151
}
5252
if(ix<=0x407b53d1) { /* |x| ~<= 5*pi/4 */
53-
if(ix>0x4016cbe3) /* |x| ~> 3*pi/4 */
54-
return -__kernel_cosdf(x + (hx > 0 ? -c2pio2 : c2pio2));
55-
else {
53+
if(ix<=0x4016cbe3) { /* |x| ~> 3*pi/4 */
5654
if(hx>0)
5755
return __kernel_sindf(c1pio2 - x);
5856
else
5957
return __kernel_sindf(x + c1pio2);
60-
}
58+
} else
59+
return -__kernel_cosdf(x + (hx > 0 ? -c2pio2 : c2pio2));
6160
}
6261
if(ix<=0x40e231d5) { /* |x| ~<= 9*pi/4 */
63-
if(ix>0x40afeddf) /* |x| ~> 7*pi/4 */
64-
return __kernel_cosdf(x + (hx > 0 ? -c4pio2 : c4pio2));
65-
else {
62+
if(ix<=0x40afeddf) { /* |x| ~> 7*pi/4 */
6663
if(hx>0)
6764
return __kernel_sindf(x - c3pio2);
6865
else
6966
return __kernel_sindf(-c3pio2 - x);
70-
}
67+
} else
68+
return __kernel_cosdf(x + (hx > 0 ? -c4pio2 : c4pio2));
7169
}
7270

7371
/* cos(Inf or NaN) is NaN */

src/s_sinf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ sinf(float x)
5656
else
5757
return -__kernel_cosdf(x + s1pio2);
5858
} else
59-
return __kernel_sindf((hx > 0 ? s2pio2 : -s2pio2) - x);
59+
return __kernel_sindf((hx > 0 ? s2pio2 : -s2pio2) - x);
6060
}
6161
if(ix<=0x40e231d5) { /* |x| ~<= 9*pi/4 */
6262
if(ix<=0x40afeddf) { /* |x| ~<= 7*pi/4 */
@@ -65,7 +65,7 @@ sinf(float x)
6565
else
6666
return __kernel_cosdf(x + s3pio2);
6767
} else
68-
return __kernel_sindf(x + (hx > 0 ? -s4pio2 : s4pio2));
68+
return __kernel_sindf(x + (hx > 0 ? -s4pio2 : s4pio2));
6969
}
7070

7171
/* sin(Inf or NaN) is NaN */
@@ -79,7 +79,7 @@ sinf(float x)
7979
case 1: return __kernel_cosdf(y);
8080
case 2: return __kernel_sindf(-y);
8181
default:
82-
return -__kernel_cosdf(y);
82+
return -__kernel_cosdf(y);
8383
}
8484
}
8585
}

0 commit comments

Comments
 (0)