Skip to content

Commit 06c9b4b

Browse files
committed
fixed float16 cast, nit formatting
1 parent d6fad4c commit 06c9b4b

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

libc/src/math/generic/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ add_entrypoint_object(
541541
libc.src.__support.FPUtil.multiply_add
542542
libc.src.__support.FPUtil.nearest_integer
543543
libc.src.__support.FPUtil.polyeval
544+
libc.src.__support.FPUtil.cast
544545
libc.src.__support.macros.properties.types
545546
COMPILE_OPTIONS
546547
-O3

libc/src/math/generic/sinpif16.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "src/__support/FPUtil/FEnvImpl.h"
1111
#include "src/__support/FPUtil/FPBits.h"
1212
#include "src/__support/FPUtil/PolyEval.h"
13+
#include "src/__support/FPUtil/cast.h"
1314
#include "src/__support/FPUtil/multiply_add.h"
1415
#include "src/__support/FPUtil/nearest_integer.h"
1516
#include "src/__support/common.h"
@@ -129,7 +130,7 @@ LLVM_LIBC_FUNCTION(float16, sinpif16, (float16 x)) {
129130

130131
// Since, cosm1_y = cos_y - 1, therefore:
131132
// sin(x * pi) = cos_k * sin_y + sin_k + (cosm1_y * sin_k)
132-
return static_cast<float16>(fputil::multiply_add(
133+
return fputil::cast<float16>(fputil::multiply_add(
133134
sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k)));
134135
}
135136
} // namespace LIBC_NAMESPACE_DECL

libc/test/src/math/sinpif16_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
//===--------------------------------------------------------------------- ===//
7+
//===---------------------------------------------------------------------===//
88

99
#include "src/math/sinpif16.h"
1010
#include "test/UnitTest/FPMatcher.h"

libc/test/src/math/smoke/sinpif16_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
// ===----------------------------------------------------------------------==//
7+
//===----------------------------------------------------------------------===//
88

99
#include "src/errno/libc_errno.h"
1010
#include "src/math/sinpif16.h"
@@ -19,10 +19,10 @@ TEST_F(LlvmLibcSinpif16Test, SpecialNumbers) {
1919
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinpif16(aNaN));
2020
EXPECT_MATH_ERRNO(0);
2121

22-
EXPECT_FP_EQ(zero, LIBC_NAMESPACE::sinpif16(0.0f));
22+
EXPECT_FP_EQ(zero, LIBC_NAMESPACE::sinpif16(zero));
2323
EXPECT_MATH_ERRNO(0);
2424

25-
EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::sinpif16(-0.0f));
25+
EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::sinpif16(neg_zero));
2626
EXPECT_MATH_ERRNO(0);
2727

2828
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinpif16(inf));

0 commit comments

Comments
 (0)