forked from OSchip/llvm-project
[libc] Remove redundant header files included from internal paths.
This commit is contained in:
parent
e94125f054
commit
35e2e448ce
|
@ -10,7 +10,6 @@
|
|||
#define LLVM_LIBC_SRC_MATH_MATH_UTILS_H
|
||||
|
||||
#include "src/__support/common.h"
|
||||
#include "src/errno/llvmlibc_errno.h"
|
||||
#include "utils/CPP/TypeTraits.h"
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
@ -56,7 +55,7 @@ template <> struct XFlowValues<double> {
|
|||
|
||||
template <typename T> static inline T with_errno(T x, int err) {
|
||||
if (math_errhandling & MATH_ERRNO)
|
||||
llvmlibc_errno = err;
|
||||
errno = err; // NOLINT
|
||||
return x;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "include/errno.h"
|
||||
#include "src/errno/llvmlibc_errno.h"
|
||||
#include "src/math/cosf.h"
|
||||
#include "test/src/math/sdcomp26094.h"
|
||||
#include "utils/CPP/Array.h"
|
||||
|
@ -19,6 +17,7 @@
|
|||
#include "utils/UnitTest/Test.h"
|
||||
#include <math.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
using __llvm_libc::fputil::isNegativeQuietNaN;
|
||||
|
@ -33,40 +32,40 @@ using __llvm_libc::testing::sdcomp26094Values;
|
|||
namespace mpfr = __llvm_libc::testing::mpfr;
|
||||
|
||||
TEST(LlvmLibcCosfTest, SpecialNumbers) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
|
||||
EXPECT_TRUE(
|
||||
isQuietNaN(__llvm_libc::cosf(valueFromBits(BitPatterns::aQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::cosf(valueFromBits(BitPatterns::aNegativeQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isQuietNaN(
|
||||
__llvm_libc::cosf(valueFromBits(BitPatterns::aSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::cosf(valueFromBits(BitPatterns::aNegativeSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::one,
|
||||
valueAsBits(__llvm_libc::cosf(valueFromBits(BitPatterns::zero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::one, valueAsBits(__llvm_libc::cosf(
|
||||
valueFromBits(BitPatterns::negZero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_TRUE(isQuietNaN(__llvm_libc::cosf(valueFromBits(BitPatterns::inf))));
|
||||
EXPECT_EQ(llvmlibc_errno, EDOM);
|
||||
EXPECT_EQ(errno, EDOM);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_TRUE(
|
||||
isQuietNaN(__llvm_libc::cosf(valueFromBits(BitPatterns::negInf))));
|
||||
EXPECT_EQ(llvmlibc_errno, EDOM);
|
||||
EXPECT_EQ(errno, EDOM);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcCosfTest, InFloatRange) {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "include/errno.h"
|
||||
#include "src/errno/llvmlibc_errno.h"
|
||||
#include "src/math/exp2f.h"
|
||||
#include "utils/FPUtil/BitPatterns.h"
|
||||
#include "utils/FPUtil/ClassificationFunctions.h"
|
||||
|
@ -17,6 +15,7 @@
|
|||
#include "utils/UnitTest/Test.h"
|
||||
#include <math.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
using __llvm_libc::fputil::isNegativeQuietNaN;
|
||||
|
@ -29,56 +28,56 @@ using BitPatterns = __llvm_libc::fputil::BitPatterns<float>;
|
|||
namespace mpfr = __llvm_libc::testing::mpfr;
|
||||
|
||||
TEST(LlvmLibcexp2fTest, SpecialNumbers) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
|
||||
EXPECT_TRUE(
|
||||
isQuietNaN(__llvm_libc::exp2f(valueFromBits(BitPatterns::aQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::exp2f(valueFromBits(BitPatterns::aNegativeQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isQuietNaN(
|
||||
__llvm_libc::exp2f(valueFromBits(BitPatterns::aSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::exp2f(valueFromBits(BitPatterns::aNegativeSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::exp2f(valueFromBits(BitPatterns::inf))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::zero, valueAsBits(__llvm_libc::exp2f(
|
||||
valueFromBits(BitPatterns::negInf))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::one,
|
||||
valueAsBits(__llvm_libc::exp2f(valueFromBits(BitPatterns::zero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::one, valueAsBits(__llvm_libc::exp2f(
|
||||
valueFromBits(BitPatterns::negZero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcExpfTest, Overflow) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::exp2f(valueFromBits(0x7f7fffffU))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::exp2f(valueFromBits(0x43000000U))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::exp2f(valueFromBits(0x43000001U))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
}
|
||||
|
||||
// Test with inputs which are the borders of underflow/overflow but still
|
||||
|
@ -86,47 +85,47 @@ TEST(LlvmLibcExpfTest, Overflow) {
|
|||
TEST(LlvmLibcExpfTest, Borderline) {
|
||||
float x;
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
x = valueFromBits(0x42fa0001U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0x42ffffffU);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0xc2fa0001U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0xc2fc0000U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0xc2fc0001U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0xc3150000U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcExpfTest, Underflow) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::zero,
|
||||
valueAsBits(__llvm_libc::exp2f(valueFromBits(0xff7fffffU))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
float x = valueFromBits(0xc3158000U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
x = valueFromBits(0xc3165432U);
|
||||
EXPECT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcexp2fTest, InFloatRange) {
|
||||
|
@ -136,14 +135,14 @@ TEST(LlvmLibcexp2fTest, InFloatRange) {
|
|||
float x = valueFromBits(v);
|
||||
if (isnan(x) || isinf(x))
|
||||
continue;
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
float result = __llvm_libc::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 (isnan(result) || isinf(result) || llvmlibc_errno != 0)
|
||||
if (isnan(result) || isinf(result) || errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH(mpfr::Operation::Exp2, x, __llvm_libc::exp2f(x), 1.0);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "include/errno.h"
|
||||
#include "src/errno/llvmlibc_errno.h"
|
||||
#include "src/math/expf.h"
|
||||
#include "utils/FPUtil/BitPatterns.h"
|
||||
#include "utils/FPUtil/ClassificationFunctions.h"
|
||||
|
@ -17,6 +15,7 @@
|
|||
#include "utils/UnitTest/Test.h"
|
||||
#include <math.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
using __llvm_libc::fputil::isNegativeQuietNaN;
|
||||
|
@ -29,73 +28,73 @@ using BitPatterns = __llvm_libc::fputil::BitPatterns<float>;
|
|||
namespace mpfr = __llvm_libc::testing::mpfr;
|
||||
|
||||
TEST(LlvmLibcExpfTest, SpecialNumbers) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
|
||||
EXPECT_TRUE(
|
||||
isQuietNaN(__llvm_libc::expf(valueFromBits(BitPatterns::aQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::expf(valueFromBits(BitPatterns::aNegativeQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isQuietNaN(
|
||||
__llvm_libc::expf(valueFromBits(BitPatterns::aSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::expf(valueFromBits(BitPatterns::aNegativeSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(BitPatterns::inf))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::zero,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(BitPatterns::negInf))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::one,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(BitPatterns::zero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::one, valueAsBits(__llvm_libc::expf(
|
||||
valueFromBits(BitPatterns::negZero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcExpfTest, Overflow) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(0x7f7fffffU))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(0x42cffff8U))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::inf,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(0x42d00008U))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcExpfTest, Underflow) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::zero,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(0xff7fffffU))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::zero,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(0xc2cffff8U))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_EQ(BitPatterns::zero,
|
||||
valueAsBits(__llvm_libc::expf(valueFromBits(0xc2d00008U))));
|
||||
EXPECT_EQ(llvmlibc_errno, ERANGE);
|
||||
EXPECT_EQ(errno, ERANGE);
|
||||
}
|
||||
|
||||
// Test with inputs which are the borders of underflow/overflow but still
|
||||
|
@ -103,22 +102,22 @@ TEST(LlvmLibcExpfTest, Underflow) {
|
|||
TEST(LlvmLibcExpfTest, Borderline) {
|
||||
float x;
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
x = valueFromBits(0x42affff8U);
|
||||
ASSERT_MPFR_MATCH(mpfr::Operation::Exp, x, __llvm_libc::expf(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0x42b00008U);
|
||||
ASSERT_MPFR_MATCH(mpfr::Operation::Exp, x, __llvm_libc::expf(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0xc2affff8U);
|
||||
ASSERT_MPFR_MATCH(mpfr::Operation::Exp, x, __llvm_libc::expf(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
x = valueFromBits(0xc2b00008U);
|
||||
ASSERT_MPFR_MATCH(mpfr::Operation::Exp, x, __llvm_libc::expf(x), 1.0);
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcExpfTest, InFloatRange) {
|
||||
|
@ -128,14 +127,14 @@ TEST(LlvmLibcExpfTest, InFloatRange) {
|
|||
float x = valueFromBits(v);
|
||||
if (isnan(x) || isinf(x))
|
||||
continue;
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
float result = __llvm_libc::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 (isnan(result) || isinf(result) || llvmlibc_errno != 0)
|
||||
if (isnan(result) || isinf(result) || errno != 0)
|
||||
continue;
|
||||
ASSERT_MPFR_MATCH(mpfr::Operation::Exp, x, __llvm_libc::expf(x), 1.0);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "include/errno.h"
|
||||
#include "src/errno/llvmlibc_errno.h"
|
||||
#include "src/math/sincosf.h"
|
||||
#include "test/src/math/sdcomp26094.h"
|
||||
#include "utils/CPP/Array.h"
|
||||
|
@ -19,6 +17,7 @@
|
|||
#include "utils/UnitTest/Test.h"
|
||||
#include <math.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
using __llvm_libc::fputil::isNegativeQuietNaN;
|
||||
|
@ -33,52 +32,52 @@ using __llvm_libc::testing::sdcomp26094Values;
|
|||
namespace mpfr = __llvm_libc::testing::mpfr;
|
||||
|
||||
TEST(LlvmLibcSinCosfTest, SpecialNumbers) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
float sin, cos;
|
||||
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::aQuietNaN), &sin, &cos);
|
||||
EXPECT_TRUE(isQuietNaN(cos));
|
||||
EXPECT_TRUE(isQuietNaN(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::aNegativeQuietNaN), &sin,
|
||||
&cos);
|
||||
EXPECT_TRUE(isNegativeQuietNaN(cos));
|
||||
EXPECT_TRUE(isNegativeQuietNaN(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::aSignallingNaN), &sin, &cos);
|
||||
EXPECT_TRUE(isQuietNaN(cos));
|
||||
EXPECT_TRUE(isQuietNaN(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::aNegativeSignallingNaN), &sin,
|
||||
&cos);
|
||||
EXPECT_TRUE(isNegativeQuietNaN(cos));
|
||||
EXPECT_TRUE(isNegativeQuietNaN(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::zero), &sin, &cos);
|
||||
EXPECT_EQ(BitPatterns::one, valueAsBits(cos));
|
||||
EXPECT_EQ(BitPatterns::zero, valueAsBits(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::negZero), &sin, &cos);
|
||||
EXPECT_EQ(BitPatterns::one, valueAsBits(cos));
|
||||
EXPECT_EQ(BitPatterns::negZero, valueAsBits(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::inf), &sin, &cos);
|
||||
EXPECT_TRUE(isQuietNaN(cos));
|
||||
EXPECT_TRUE(isQuietNaN(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, EDOM);
|
||||
EXPECT_EQ(errno, EDOM);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
__llvm_libc::sincosf(valueFromBits(BitPatterns::negInf), &sin, &cos);
|
||||
EXPECT_TRUE(isQuietNaN(cos));
|
||||
EXPECT_TRUE(isQuietNaN(sin));
|
||||
EXPECT_EQ(llvmlibc_errno, EDOM);
|
||||
EXPECT_EQ(errno, EDOM);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcSinCosfTest, InFloatRange) {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "include/errno.h"
|
||||
#include "src/errno/llvmlibc_errno.h"
|
||||
#include "src/math/sinf.h"
|
||||
#include "test/src/math/sdcomp26094.h"
|
||||
#include "utils/CPP/Array.h"
|
||||
|
@ -19,6 +17,7 @@
|
|||
#include "utils/UnitTest/Test.h"
|
||||
#include <math.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
using __llvm_libc::fputil::isNegativeQuietNaN;
|
||||
|
@ -33,40 +32,40 @@ using __llvm_libc::testing::sdcomp26094Values;
|
|||
namespace mpfr = __llvm_libc::testing::mpfr;
|
||||
|
||||
TEST(LlvmLibcSinfTest, SpecialNumbers) {
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
|
||||
EXPECT_TRUE(
|
||||
isQuietNaN(__llvm_libc::sinf(valueFromBits(BitPatterns::aQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::sinf(valueFromBits(BitPatterns::aNegativeQuietNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isQuietNaN(
|
||||
__llvm_libc::sinf(valueFromBits(BitPatterns::aSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_TRUE(isNegativeQuietNaN(
|
||||
__llvm_libc::sinf(valueFromBits(BitPatterns::aNegativeSignallingNaN))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::zero,
|
||||
valueAsBits(__llvm_libc::sinf(valueFromBits(BitPatterns::zero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
EXPECT_EQ(BitPatterns::negZero, valueAsBits(__llvm_libc::sinf(
|
||||
valueFromBits(BitPatterns::negZero))));
|
||||
EXPECT_EQ(llvmlibc_errno, 0);
|
||||
EXPECT_EQ(errno, 0);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_TRUE(isQuietNaN(__llvm_libc::sinf(valueFromBits(BitPatterns::inf))));
|
||||
EXPECT_EQ(llvmlibc_errno, EDOM);
|
||||
EXPECT_EQ(errno, EDOM);
|
||||
|
||||
llvmlibc_errno = 0;
|
||||
errno = 0;
|
||||
EXPECT_TRUE(
|
||||
isQuietNaN(__llvm_libc::sinf(valueFromBits(BitPatterns::negInf))));
|
||||
EXPECT_EQ(llvmlibc_errno, EDOM);
|
||||
EXPECT_EQ(errno, EDOM);
|
||||
}
|
||||
|
||||
TEST(LlvmLibcSinfTest, InFloatRange) {
|
||||
|
|
Loading…
Reference in New Issue