#include "src/math/tan.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
#include "utils/UnitTest/FPMatcher.h"
#include "utils/UnitTest/Test.h"
#include <math.h>
namespace mpfr = __llvm_libc::testing::mpfr;
DECLARE_SPECIAL_CONSTANTS(double)
TEST(LlvmLibctanTest, Range) {
static constexpr double _2pi = 6.283185307179586;
constexpr UIntType COUNT = 10000000;
constexpr UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
double x = double(FPBits(v));
if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi)
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tan(x), 1.0);
}
}