[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / libc / test / src / math / exhaustive / sqrtf_test.cpp
blob28f7e43f6050c6cee59d48f3befb7e03c96d78a6
1 //===-- Exhaustive test for sqrtf -----------------------------------------===//
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/__support/FPUtil/FPBits.h"
10 #include "src/math/sqrtf.h"
11 #include "utils/MPFRWrapper/MPFRUtils.h"
12 #include <math.h>
14 using FPBits = __llvm_libc::fputil::FPBits<float>;
16 namespace mpfr = __llvm_libc::testing::mpfr;
18 TEST(LlvmLibcSqrtfExhaustiveTest, AllValues) {
19 uint32_t bits = 0;
20 do {
21 FPBits xbits(bits);
22 float x = float(xbits);
23 ASSERT_MPFR_MATCH(mpfr::Operation::Sqrt, x, __llvm_libc::sqrtf(x), 0.5);
24 } while (bits++ < 0xffff'ffffU);