[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187)
This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
This commit is contained in:
@@ -68,12 +68,9 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Errno checks.
|
||||
|
||||
#define ASSERT_ERRNO_EQ(VAL) \
|
||||
ASSERT_EQ(VAL, static_cast<int>(LIBC_NAMESPACE::libc_errno))
|
||||
#define ASSERT_ERRNO_SUCCESS() \
|
||||
ASSERT_EQ(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
|
||||
#define ASSERT_ERRNO_FAILURE() \
|
||||
ASSERT_NE(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
|
||||
#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(libc_errno))
|
||||
#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(libc_errno))
|
||||
#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast<int>(libc_errno))
|
||||
|
||||
// Integration tests are compiled with -ffreestanding which stops treating
|
||||
// the main function as a non-overloadable special function. Hence, we use a
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef LLVM_LIBC_TEST_UNITTEST_ERRNOCHECKINGTEST_H
|
||||
#define LLVM_LIBC_TEST_UNITTEST_ERRNOCHECKINGTEST_H
|
||||
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
@@ -25,7 +25,7 @@ class ErrnoCheckingTest : public Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
Test::SetUp();
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/__support/FPUtil/fpbits_str.h"
|
||||
#include "src/__support/StringUtil/error_to_string.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/macros/properties/architectures.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
@@ -114,8 +114,8 @@ public:
|
||||
|
||||
bool match(T got) {
|
||||
actual_return = got;
|
||||
actual_errno = LIBC_NAMESPACE::libc_errno;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
actual_errno = libc_errno;
|
||||
libc_errno = 0;
|
||||
if constexpr (ignore_errno())
|
||||
return return_cmp.compare(actual_return);
|
||||
else
|
||||
|
||||
@@ -279,8 +279,8 @@ private:
|
||||
#define EXPECT_MATH_ERRNO(expected) \
|
||||
do { \
|
||||
if (math_errhandling & MATH_ERRNO) { \
|
||||
int actual = LIBC_NAMESPACE::libc_errno; \
|
||||
LIBC_NAMESPACE::libc_errno = 0; \
|
||||
int actual = libc_errno; \
|
||||
libc_errno = 0; \
|
||||
EXPECT_EQ(actual, expected); \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -288,8 +288,8 @@ private:
|
||||
#define ASSERT_MATH_ERRNO(expected) \
|
||||
do { \
|
||||
if (math_errhandling & MATH_ERRNO) { \
|
||||
int actual = LIBC_NAMESPACE::libc_errno; \
|
||||
LIBC_NAMESPACE::libc_errno = 0; \
|
||||
int actual = libc_errno; \
|
||||
libc_errno = 0; \
|
||||
ASSERT_EQ(actual, expected); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -42,15 +42,14 @@
|
||||
|
||||
#define ASSERT_ERRNO_EQ(VAL) \
|
||||
do { \
|
||||
ASSERT_EQ(VAL, static_cast<int>(LIBC_NAMESPACE::libc_errno)); \
|
||||
LIBC_NAMESPACE::libc_errno = 0; \
|
||||
ASSERT_EQ(VAL, static_cast<int>(libc_errno)); \
|
||||
libc_errno = 0; \
|
||||
} while (0)
|
||||
#define ASSERT_ERRNO_SUCCESS() \
|
||||
ASSERT_EQ(0, static_cast<int>(LIBC_NAMESPACE::libc_errno))
|
||||
#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(libc_errno))
|
||||
#define ASSERT_ERRNO_FAILURE() \
|
||||
do { \
|
||||
ASSERT_NE(0, static_cast<int>(LIBC_NAMESPACE::libc_errno)); \
|
||||
LIBC_NAMESPACE::libc_errno = 0; \
|
||||
ASSERT_NE(0, static_cast<int>(libc_errno)); \
|
||||
libc_errno = 0; \
|
||||
} while (0)
|
||||
|
||||
#endif // LLVM_LIBC_TEST_UNITTEST_TEST_H
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "src/__support/CPP/new.h"
|
||||
#include "src/__support/threads/thread.h"
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
|
||||
#include "test/IntegrationTest/test.h"
|
||||
|
||||
@@ -332,7 +332,7 @@ static void run_failure_tests() {
|
||||
}
|
||||
|
||||
TEST_MAIN() {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
run_success_tests();
|
||||
run_failure_tests();
|
||||
return 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "src/pthread/pthread_create.h"
|
||||
#include "src/pthread/pthread_join.h"
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
|
||||
#include "test/IntegrationTest/test.h"
|
||||
#include <pthread.h>
|
||||
@@ -25,7 +25,7 @@ static void nullJoinTest() {
|
||||
}
|
||||
|
||||
TEST_MAIN() {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
nullJoinTest();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/CPP/string_view.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/pthread/pthread_create.h"
|
||||
#include "src/pthread/pthread_getname_np.h"
|
||||
#include "src/pthread/pthread_join.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/CPP/string_view.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/stdlib/getenv.h"
|
||||
#include "src/unistd/getcwd.h"
|
||||
|
||||
@@ -31,12 +31,12 @@ TEST_MAIN(int argc, char **argv, char **envp) {
|
||||
cwd = LIBC_NAMESPACE::getcwd(buffer, 0);
|
||||
ASSERT_TRUE(cwd == nullptr);
|
||||
ASSERT_ERRNO_EQ(EINVAL);
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
// Insufficient size
|
||||
cwd = LIBC_NAMESPACE::getcwd(buffer, 2);
|
||||
ASSERT_TRUE(cwd == nullptr);
|
||||
int err = LIBC_NAMESPACE::libc_errno;
|
||||
int err = libc_errno;
|
||||
ASSERT_EQ(err, ERANGE);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/sys/mman/mmap.h"
|
||||
#include "test/IntegrationTest/test.h"
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/str_to_float.h"
|
||||
#include "src/__support/uint128.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/__support/str_to_integer.h"
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/CPP/string_view.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/dirent/closedir.h"
|
||||
#include "src/dirent/dirfd.h"
|
||||
#include "src/dirent/opendir.h"
|
||||
#include "src/dirent/readdir.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -55,17 +55,17 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) {
|
||||
}
|
||||
|
||||
TEST(LlvmLibcDirentTest, OpenNonExistentDir) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
::DIR *dir = LIBC_NAMESPACE::opendir("___xyz123__.non_existent__");
|
||||
ASSERT_TRUE(dir == nullptr);
|
||||
ASSERT_ERRNO_EQ(ENOENT);
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
}
|
||||
|
||||
TEST(LlvmLibcDirentTest, OpenFile) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
::DIR *dir = LIBC_NAMESPACE::opendir("testdata/file1.txt");
|
||||
ASSERT_TRUE(dir == nullptr);
|
||||
ASSERT_ERRNO_EQ(ENOTDIR);
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
TEST(LlvmLibcErrnoTest, Basic) {
|
||||
int test_val = 123;
|
||||
LIBC_NAMESPACE::libc_errno = test_val;
|
||||
libc_errno = test_val;
|
||||
ASSERT_ERRNO_EQ(test_val);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/fcntl/creat.h"
|
||||
#include "src/fcntl/open.h"
|
||||
#include "src/unistd/close.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/fcntl_macros.h"
|
||||
#include "hdr/stdio_macros.h"
|
||||
#include "hdr/types/struct_flock.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/fcntl/fcntl.h"
|
||||
#include "src/fcntl/open.h"
|
||||
#include "src/unistd/close.h"
|
||||
@@ -166,7 +166,7 @@ TEST(LlvmLibcFcntlTest, UseAfterClose) {
|
||||
}
|
||||
|
||||
TEST(LlvmLibcFcntlTest, SetGetOwnerTest) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
|
||||
pid_t pid = LIBC_NAMESPACE::getpid();
|
||||
ASSERT_GT(pid, -1);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/fcntl/open.h"
|
||||
#include "src/fcntl/openat.h"
|
||||
#include "src/unistd/close.h"
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
|
||||
void test_one_input(RoundToIntegerFunc func, FloatType input,
|
||||
IntType expected, bool expectError) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
|
||||
|
||||
ASSERT_EQ(func(input), expected);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acosf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acoshf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acoshf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST_F(LlvmLibcAsinTest, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::asin(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/asinf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -22,7 +22,7 @@ using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/asinhf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -81,7 +81,7 @@ TEST_F(LlvmLibcAtan2fTest, InFloatRange) {
|
||||
if (FPBits(w).is_nan() || FPBits(w).is_inf())
|
||||
continue;
|
||||
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::atan2f(x, y);
|
||||
++total_count;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST_F(LlvmLibcAtanTest, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::atan(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atanf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -23,7 +23,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
// TODO: This test needs to have its checks for exceptions, errno
|
||||
// tightened
|
||||
TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN));
|
||||
// TODO: Uncomment these checks later, RoundingMode affects running
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atanhf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -25,7 +25,7 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
// tightened https://github.com/llvm/llvm-project/issues/88819.
|
||||
TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
|
||||
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN));
|
||||
// TODO: Uncomment these checks later, RoundingMode affects running
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/cosf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -23,7 +23,7 @@ using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/array.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/coshf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -22,7 +22,7 @@ using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::coshf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcCoshfTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/cospif.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/src/math/sdcomp26094.h"
|
||||
@@ -19,7 +19,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcCospifTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cospif(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -105,7 +105,7 @@ TEST_F(LlvmLibcExp10Test, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::exp10(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10f(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
@@ -55,7 +55,7 @@ TEST_F(LlvmLibcExp10fTest, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10fTest, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
0.0f, LIBC_NAMESPACE::exp10f(FPBits(0xff7fffffU).get_val()),
|
||||
FE_UNDERFLOW);
|
||||
@@ -97,7 +97,7 @@ TEST_F(LlvmLibcExp10fTest, TrickyInputs) {
|
||||
0x41200000, // x = 10.0f
|
||||
};
|
||||
for (int i = 0; i < N; ++i) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float x = FPBits(INPUTS[i]).get_val();
|
||||
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
|
||||
LIBC_NAMESPACE::exp10f(x), 0.5);
|
||||
@@ -113,15 +113,14 @@ TEST_F(LlvmLibcExp10fTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::exp10f(x);
|
||||
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
|
||||
LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x,
|
||||
LIBC_NAMESPACE::exp10f(x), 0.5);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/array.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10m1f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -69,7 +69,7 @@ TEST_F(LlvmLibcExp10m1fTest, TrickyInputs) {
|
||||
};
|
||||
|
||||
for (float x : INPUTS) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10m1, x,
|
||||
LIBC_NAMESPACE::exp10m1f(x), 0.5);
|
||||
}
|
||||
@@ -82,14 +82,14 @@ TEST_F(LlvmLibcExp10m1fTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_inf_or_nan())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::exp10m1f(x);
|
||||
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_inf_or_nan() || LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_inf_or_nan() || libc_errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10m1, x,
|
||||
LIBC_NAMESPACE::exp10m1f(x), 0.5);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -80,7 +80,7 @@ TEST_F(LlvmLibcExp2Test, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::exp2(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2f(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
@@ -71,7 +71,7 @@ TEST_F(LlvmLibcExp2fTest, TrickyInputs) {
|
||||
0xc3150000U, /*-0x1.2ap+7f*/
|
||||
};
|
||||
for (int i = 0; i < N; ++i) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float x = FPBits(INPUTS[i]).get_val();
|
||||
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
|
||||
LIBC_NAMESPACE::exp2f(x), 0.5);
|
||||
@@ -80,7 +80,7 @@ TEST_F(LlvmLibcExp2fTest, TrickyInputs) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2fTest, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
0.0f, LIBC_NAMESPACE::exp2f(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
@@ -108,15 +108,14 @@ TEST_F(LlvmLibcExp2fTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::exp2f(x);
|
||||
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
|
||||
LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x,
|
||||
LIBC_NAMESPACE::exp2f(x), 0.5);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/array.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2m1f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -38,7 +38,7 @@ TEST_F(LlvmLibcExp2m1fTest, TrickyInputs) {
|
||||
};
|
||||
|
||||
for (float x : INPUTS) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2m1, x,
|
||||
LIBC_NAMESPACE::exp2m1f(x), 0.5);
|
||||
}
|
||||
@@ -51,15 +51,14 @@ TEST_F(LlvmLibcExp2m1fTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::exp2m1f(x);
|
||||
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
|
||||
LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2m1, x,
|
||||
LIBC_NAMESPACE::exp2m1f(x), 0.5);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -78,7 +78,7 @@ TEST_F(LlvmLibcExpTest, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::exp(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpfTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
@@ -55,7 +55,7 @@ TEST_F(LlvmLibcExpfTest, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpfTest, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
0.0f, LIBC_NAMESPACE::expf(FPBits(0xff7fffffU).get_val()), FE_UNDERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
@@ -76,7 +76,7 @@ TEST_F(LlvmLibcExpfTest, Underflow) {
|
||||
TEST_F(LlvmLibcExpfTest, Borderline) {
|
||||
float x;
|
||||
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
x = FPBits(0x42affff8U).get_val();
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
|
||||
LIBC_NAMESPACE::expf(x), 0.5);
|
||||
@@ -110,15 +110,14 @@ TEST_F(LlvmLibcExpfTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::expf(x);
|
||||
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
|
||||
LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
|
||||
continue;
|
||||
EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x,
|
||||
LIBC_NAMESPACE::expf(x), 0.5);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expm1.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -64,7 +64,7 @@ TEST_F(LlvmLibcExpm1Test, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::expm1(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expm1f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1f(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpm1fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
@@ -55,7 +55,7 @@ TEST_F(LlvmLibcExpm1fTest, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpm1fTest, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(FPBits(0xff7fffffU).get_val()));
|
||||
|
||||
float x = FPBits(0xc2cffff8U).get_val();
|
||||
@@ -70,7 +70,7 @@ TEST_F(LlvmLibcExpm1fTest, Underflow) {
|
||||
TEST_F(LlvmLibcExpm1fTest, Borderline) {
|
||||
float x;
|
||||
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
x = FPBits(0x42affff8U).get_val();
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
|
||||
LIBC_NAMESPACE::expm1f(x), 0.5);
|
||||
@@ -119,15 +119,14 @@ TEST_F(LlvmLibcExpm1fTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::expm1f(x);
|
||||
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
|
||||
LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x,
|
||||
LIBC_NAMESPACE::expm1f(x), 0.5);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log10.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -101,7 +101,7 @@ TEST_F(LlvmLibcLog10Test, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::log10(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log1p.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -102,7 +102,7 @@ TEST_F(LlvmLibcLog1pTest, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::log1p(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log1pf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -75,7 +75,7 @@ TEST_F(LlvmLibcLog1pfTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x,
|
||||
LIBC_NAMESPACE::log1pf(x), 0.5);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log2.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -100,7 +100,7 @@ TEST_F(LlvmLibcLog2Test, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::log2(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log2f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -52,14 +52,13 @@ TEST_F(LlvmLibcLog2fTest, InFloatRange) {
|
||||
float x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::log2f(x);
|
||||
// If the computation resulted in an error or did not produce valid result
|
||||
// in the single-precision floating point range, then ignore comparing with
|
||||
// MPFR result as MPFR can still produce valid results because of its
|
||||
// wider precision.
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() ||
|
||||
LIBC_NAMESPACE::libc_errno != 0)
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf() || libc_errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x,
|
||||
LIBC_NAMESPACE::log2f(x), 0.5);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -99,7 +99,7 @@ TEST_F(LlvmLibcLogTest, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf() || x < 0.0)
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::log(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -78,7 +78,7 @@ TEST_F(LlvmLibcPowfTest, InFloatRange) {
|
||||
if (FPBits(w).is_nan() || FPBits(w).is_inf())
|
||||
continue;
|
||||
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float result = LIBC_NAMESPACE::powf(x, y);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -71,7 +71,7 @@ TEST_F(LlvmLibcSinTest, InDoubleRange) {
|
||||
double x = FPBits(v).get_val();
|
||||
if (FPBits(v).is_nan() || FPBits(v).is_inf())
|
||||
continue;
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
double result = LIBC_NAMESPACE::sin(x);
|
||||
++cc;
|
||||
if (FPBits(result).is_nan() || FPBits(result).is_inf())
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/sincosf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -24,7 +24,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcSinCosfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
float sin, cos;
|
||||
|
||||
LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/sinf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -24,7 +24,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcSinfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/array.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/sinhf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -22,7 +22,7 @@ using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcSinhfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -65,7 +65,7 @@ TEST_F(LlvmLibcSinhfTest, SmallValues) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcSinhfTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::sinhf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/sinpif.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/src/math/sdcomp26094.h"
|
||||
@@ -21,7 +21,7 @@ using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES;
|
||||
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
|
||||
|
||||
TEST_F(LlvmLibcSinpifTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinpif(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define LLVM_LIBC_TEST_SRC_MATH_FMODTEST_H
|
||||
|
||||
#include "src/__support/FPUtil/FEnvImpl.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "test/UnitTest/FEnvSafeTest.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
|
||||
void test_one_input(RoundToIntegerFunc func, F input, I expected,
|
||||
bool expectError) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
|
||||
|
||||
ASSERT_EQ(func(input), expected);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acos.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -21,7 +21,7 @@ TEST_F(LlvmLibcAcosTest, SpecialNumbers) {
|
||||
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(zero));
|
||||
EXPECT_FP_EQ(0x1.921fb54442d18p0, LIBC_NAMESPACE::acos(neg_zero));
|
||||
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acos(inf),
|
||||
FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(EDOM);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acosf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
using LlvmLibcAcosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcAcosf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acosf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acosf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAcosfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acosf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acoshf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
using LlvmLibcAcoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcAcoshf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acoshf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acoshf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAcoshfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acoshf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/acospif16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
using LlvmLibcAcospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
TEST_F(LlvmLibcAcospif16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::acospif16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/asinf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
using LlvmLibcAsinf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcAsinf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/asinf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAsinfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/asinhf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -14,7 +14,7 @@
|
||||
using LlvmLibcAsinhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcAsinhf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::asinhf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/asinhf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAsinhfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::asinhf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atan2f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcAtan2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAtan2fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atan2f(sNaN, sNaN),
|
||||
FE_INVALID);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atanf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -14,7 +14,7 @@
|
||||
using LlvmLibcAtanf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcAtanf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::atanf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atanf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAtanfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atanhf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
using LlvmLibcAtanhf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcAtanhf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf16(sNaN),
|
||||
FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/atanhf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -20,7 +20,7 @@ using LIBC_NAMESPACE::Sign;
|
||||
using LlvmLibcAtanhfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcAtanhfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::atanhf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
// TODO: Strengthen errno,exception checks and remove these assert macros
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/cosf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -14,7 +14,7 @@
|
||||
using LlvmLibcCosf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcCosf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cosf16(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/cosf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcCosfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cosf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/coshf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcCoshf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcCoshf16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcCoshf16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::coshf16(max_normal),
|
||||
FE_OVERFLOW | FE_INEXACT);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/CPP/array.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/coshf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -19,7 +19,7 @@
|
||||
using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::coshf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcCoshfTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcCoshfTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::coshf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/cospif16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
using LlvmLibcCospif16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcCospif16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cospif16(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/cospif.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
using LlvmLibcCospifTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcCospifTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::cospif(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcExp10f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcExp10f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10f16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10f16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10f16(max_normal),
|
||||
FE_OVERFLOW);
|
||||
@@ -53,7 +53,7 @@ TEST_F(LlvmLibcExp10f16Test, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10f16Test, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10f16(neg_max_normal),
|
||||
FE_UNDERFLOW | FE_INEXACT);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcExp10fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp10f(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -44,7 +44,7 @@ TEST_F(LlvmLibcExp10fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::exp10f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10m1f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcExp10m1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcExp10m1f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp10m1f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp10m1f16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10m1f16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10m1f16(max_normal),
|
||||
FE_OVERFLOW | FE_INEXACT);
|
||||
@@ -67,7 +67,7 @@ TEST_F(LlvmLibcExp10m1f16Test, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10m1f16Test, ResultNearNegOne) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(-1.0),
|
||||
LIBC_NAMESPACE::exp10m1f16(neg_max_normal),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp10m1f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -14,7 +14,7 @@
|
||||
using LlvmLibcExp10m1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp10m1f(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -34,7 +34,7 @@ TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10m1fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10m1f(0x1.fffffep+127f),
|
||||
FE_OVERFLOW);
|
||||
@@ -50,7 +50,7 @@ TEST_F(LlvmLibcExp10m1fTest, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp10m1fTest, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0f, LIBC_NAMESPACE::exp10m1f(-max_normal),
|
||||
FE_UNDERFLOW);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcExp2f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcExp2f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExp2f16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2f16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2f16(max_normal),
|
||||
FE_OVERFLOW);
|
||||
@@ -53,7 +53,7 @@ TEST_F(LlvmLibcExp2f16Test, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2f16Test, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2f16(neg_max_normal),
|
||||
FE_UNDERFLOW | FE_INEXACT);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcExp2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp2f(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -45,7 +45,7 @@ TEST_F(LlvmLibcExp2fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::exp2f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2m1f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcExp2m1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcExp2m1f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::exp2m1f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -39,7 +39,7 @@ TEST_F(LlvmLibcExp2m1f16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2m1f16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2m1f16(max_normal),
|
||||
FE_OVERFLOW | FE_INEXACT);
|
||||
@@ -65,7 +65,7 @@ TEST_F(LlvmLibcExp2m1f16Test, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2m1f16Test, ResultNearNegOne) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0, LIBC_NAMESPACE::exp2m1f16(neg_max_normal),
|
||||
FE_INEXACT);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp2m1f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@ using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
|
||||
using LIBC_NAMESPACE::fputil::testing::RoundingMode;
|
||||
|
||||
TEST_F(LlvmLibcExp2m1fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::exp2m1f(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -34,7 +34,7 @@ TEST_F(LlvmLibcExp2m1fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2m1fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2m1f(0x1.fffffep+127),
|
||||
FE_OVERFLOW);
|
||||
@@ -50,7 +50,7 @@ TEST_F(LlvmLibcExp2m1fTest, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExp2m1fTest, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(-1.0f, LIBC_NAMESPACE::exp2m1f(-0x1.fffffep+127),
|
||||
FE_UNDERFLOW);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/exp.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/errno_macros.h"
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expf16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -17,7 +17,7 @@
|
||||
using LlvmLibcExpf16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcExpf16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expf16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -41,7 +41,7 @@ TEST_F(LlvmLibcExpf16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpf16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expf16(max_normal),
|
||||
FE_OVERFLOW);
|
||||
@@ -54,7 +54,7 @@ TEST_F(LlvmLibcExpf16Test, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpf16Test, Underflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::expf16(neg_max_normal),
|
||||
FE_UNDERFLOW | FE_INEXACT);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcExpfTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::expf(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpfTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpfTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::expf(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expm1.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "hdr/errno_macros.h"
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expm1f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -17,7 +17,7 @@
|
||||
using LlvmLibcExpm1f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcExpm1f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::expm1f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1f16Test, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpm1f16Test, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::expm1f16(max_normal),
|
||||
FE_OVERFLOW | FE_INEXACT);
|
||||
@@ -67,7 +67,7 @@ TEST_F(LlvmLibcExpm1f16Test, Overflow) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpm1f16Test, ResultNearNegOne) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(LIBC_NAMESPACE::fputil::cast<float16>(-1.0),
|
||||
LIBC_NAMESPACE::expm1f16(neg_max_normal),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/expm1f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -18,7 +18,7 @@
|
||||
using LlvmLibcExpm1fTest = LIBC_NAMESPACE::testing::FPTest<float>;
|
||||
|
||||
TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::expm1f(sNaN), FE_INVALID);
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcExpm1fTest, SpecialNumbers) {
|
||||
}
|
||||
|
||||
TEST_F(LlvmLibcExpm1fTest, Overflow) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
EXPECT_FP_EQ_WITH_EXCEPTION(
|
||||
inf, LIBC_NAMESPACE::expm1f(FPBits(0x7f7fffffU).get_val()), FE_OVERFLOW);
|
||||
EXPECT_MATH_ERRNO(ERANGE);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log10.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log10f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcLog10f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcLog10f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::log10f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log1p.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log1pf.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log2.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/fenv_macros.h"
|
||||
#include "src/__support/FPUtil/cast.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log2f16.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
using LlvmLibcLog2f16Test = LIBC_NAMESPACE::testing::FPTest<float16>;
|
||||
|
||||
TEST_F(LlvmLibcLog2f16Test, SpecialNumbers) {
|
||||
LIBC_NAMESPACE::libc_errno = 0;
|
||||
libc_errno = 0;
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::log2f16(aNaN));
|
||||
EXPECT_MATH_ERRNO(0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log2f.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "hdr/math_macros.h"
|
||||
#include "src/__support/FPUtil/FPBits.h"
|
||||
#include "src/errno/libc_errno.h"
|
||||
#include "src/__support/libc_errno.h"
|
||||
#include "src/math/log.h"
|
||||
#include "test/UnitTest/FPMatcher.h"
|
||||
#include "test/UnitTest/Test.h"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user