1
- // ===-- Collection of utils for sinf16/cosf16 ------------------*- C++ -*-===//
1
+ // ===-- Collection of utils for sinf16/cosf16 ------------------- *- C++ -*-===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
- // ===----------------------------------------------------------------------===/
7
+ // ===----------------------------------------------------------------------===//
8
8
#ifndef LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF16_UTILS_H
9
9
#define LLVM_LIBC_SRC_MATH_GENERIC_SINCOSF16_UTILS_H
10
10
14
14
#include " src/__support/common.h"
15
15
#include " src/__support/macros/config.h"
16
16
17
-
18
17
namespace LIBC_NAMESPACE_DECL {
19
18
20
19
// Lookup table for sin(k * pi / 32) with k = 0, ..., 63.
@@ -46,10 +45,11 @@ LIBC_INLINE int32_t range_reduction(float x, float &y) {
46
45
return static_cast <int32_t >(kf);
47
46
}
48
47
49
- LIBC_INLINE void sincospif16_eval (float xf, float &sin_k, float &cos_k, float &sin_y, float &cosm1_y) {
48
+ LIBC_INLINE void sincospif16_eval (float xf, float &sin_k, float &cos_k,
49
+ float &sin_y, float &cosm1_y) {
50
50
float y;
51
51
int32_t k = range_reduction (xf, y);
52
-
52
+
53
53
sin_k = SIN_K_PI_OVER_32[k & 63 ];
54
54
cos_k = SIN_K_PI_OVER_32[(k + 16 ) & 63 ];
55
55
@@ -65,7 +65,7 @@ LIBC_INLINE void sincospif16_eval(float xf, float &sin_k, float &cos_k, float &s
65
65
// Degree-6 minimax even polynomial for sin(y*pi/32)/y generated by Sollya
66
66
// with: > Q = fpminimax(sin(y*pi/32)/y, [|0, 2, 4, 6|], [|SG...|], [0, 0.5]);
67
67
sin_y = y * fputil::polyeval (ysq, 0x1 .921fb6p-4f , -0x1 .4aeabcp-13f ,
68
- 0x1 .a03354p -21f , -0x1 .ad02d2p -20f );
68
+ 0x1 .a03354p -21f , -0x1 .ad02d2p -20f );
69
69
70
70
// Note that cosm1_y = cos(y*pi/32) - 1 = cos_y - 1
71
71
// Derivation:
@@ -75,7 +75,7 @@ LIBC_INLINE void sincospif16_eval(float xf, float &sin_k, float &cos_k, float &s
75
75
// Degree-6 minimax even polynomial for cos(y*pi/32) generated by Sollya with:
76
76
// > P = fpminimax(cos(y*pi/32), [|0, 2, 4, 6|],[|1, SG...|], [0, 0.5]);
77
77
cosm1_y = ysq * fputil::polyeval (ysq, -0x1 .3bd3ccp-8f , 0x1 .03a61ap-18f ,
78
- 0x1 .a6f7a2p -29f );
78
+ 0x1 .a6f7a2p -29f );
79
79
}
80
80
81
81
} // namespace LIBC_NAMESPACE_DECL
0 commit comments