Skip to content

Commit 31ea8dc

Browse files
committed
more formatting changes
1 parent 5db2256 commit 31ea8dc

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

libc/src/math/generic/cospif16.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ LLVM_LIBC_FUNCTION(float16, cospif16, (float16 x)) {
3939
// Once k and y are computed, we then deduce the answer by the sine of sum
4040
// formula:
4141
// cos(x * pi) = cos((k + y) * pi/32)
42-
// = cos(k * pi/32) * cos(y * pi/32) +
42+
// = cos(k * pi/32) * cos(y * pi/32) +
4343
// sin(y * pi/32) * sin(k * pi/32)
4444

4545
// For signed zeros

libc/src/math/generic/sincosf16_utils.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,17 @@ LIBC_INLINE void sincospif16_eval(float xf, float &sin_k, float &cos_k,
5454
sin_k = SIN_K_PI_OVER_32[k & 63];
5555
cos_k = SIN_K_PI_OVER_32[(k + 16) & 63];
5656

57-
// Recall;
58-
// sin(x * pi/32) = sin((k + y) * pi/32)
59-
// = sin(y * pi/32) * cos(k * pi/32) +
60-
// cos(y * pi/32) * sin(k * pi/32)
6157
// Recall, after range reduction, -0.5 <= y <= 0.5. For very small values of
6258
// y, calculating sin(y * p/32) can be inaccurate. Generating a polynomial for
6359
// sin(y * p/32)/y instead significantly reduces the relative errors.
6460
float ysq = y * y;
6561

6662
// Degree-6 minimax even polynomial for sin(y*pi/32)/y generated by Sollya
67-
// with: > Q = fpminimax(sin(y*pi/32)/y, [|0, 2, 4, 6|], [|SG...|], [0, 0.5]);
63+
// with:
64+
// > Q = fpminimax(sin(y * pi/32)/y, [|0, 2, 4, 6|], [|SG...|], [0, 0.5]);
6865
sin_y = y * fputil::polyeval(ysq, 0x1.921fb6p-4f, -0x1.4aeabcp-13f,
6966
0x1.a03354p-21f, -0x1.ad02d2p-20f);
7067

71-
// Note that cosm1_y = cos(y*pi/32) - 1 = cos_y - 1
72-
// Derivation:
73-
// sin(x * pi) = sin((k + y) * pi/32)
74-
// = sin_y * cos_k + cos_y * sin_k
75-
// = cos_k * sin_y + sin_k * (1 + cos_y - 1)
7668
// Degree-6 minimax even polynomial for cos(y*pi/32) generated by Sollya with:
7769
// > P = fpminimax(cos(y * pi/32), [|0, 2, 4, 6|],[|1, SG...|], [0, 0.5]);
7870
cosm1_y = ysq * fputil::polyeval(ysq, -0x1.3bd3ccp-8f, 0x1.03a61ap-18f,

libc/src/math/generic/sinpif16.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
109
#include "src/math/sinpif16.h"
1110
#include "hdr/errno_macros.h"
1211
#include "hdr/fenv_macros.h"
12+
#include "sincosf16_utils.h"
1313
#include "src/__support/FPUtil/FEnvImpl.h"
1414
#include "src/__support/FPUtil/FPBits.h"
1515
#include "src/__support/FPUtil/cast.h"
1616
#include "src/__support/FPUtil/multiply_add.h"
17-
#include "sincosf16_utils.h"
1817

1918
namespace LIBC_NAMESPACE_DECL {
2019
LLVM_LIBC_FUNCTION(float16, sinpif16, (float16 x)) {
@@ -41,7 +40,7 @@ LLVM_LIBC_FUNCTION(float16, sinpif16, (float16 x)) {
4140
// sin(x * pi) = sin((k + y) * pi/32)
4241
// = sin(k * pi/32) * cos(y * pi/32) +
4342
// sin(y * pi/32) * cos(k * pi/32)
44-
43+
4544
// For signed zeros
4645
if (LIBC_UNLIKELY(x_abs == 0U))
4746
return x;

0 commit comments

Comments
 (0)