[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / libc / test / src / math / pow_test.cpp
blob2be8b87500a4bf09179c6d435e66a39c1a3a0f69
1 //===-- Unittests for pow -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "src/math/pow.h"
10 #include "test/UnitTest/FPMatcher.h"
11 #include "test/UnitTest/Test.h"
12 #include "utils/MPFRWrapper/MPFRUtils.h"
13 #include <math.h>
15 #include <errno.h>
16 #include <stdint.h>
18 using FPBits = __llvm_libc::fputil::FPBits<double>;
20 namespace mpfr = __llvm_libc::testing::mpfr;
22 DECLARE_SPECIAL_CONSTANTS(double)
24 TEST(LlvmLibcAsinTest, SpecialNumbers) {
25 errno = 0;
27 EXPECT_FP_EQ(aNaN, __llvm_libc::pow(aNaN, aNaN));
28 EXPECT_MATH_ERRNO(0);
30 EXPECT_FP_EQ(1.0, __llvm_libc::pow(1.0, 1.0));
31 EXPECT_MATH_ERRNO(0);
33 EXPECT_FP_EQ(1.0, __llvm_libc::pow(1.0, 2.0));
34 EXPECT_MATH_ERRNO(0);
36 EXPECT_FP_EQ(inf, __llvm_libc::pow(2.0, inf));