1//
2// Created by kirill on 8/30/22.
3//
4
5#ifndef LLVM_LIBC_TEST_SRC_MATH_IN_FLOAT_RANGE_TEST_HELPER_H
6#define LLVM_LIBC_TEST_SRC_MATH_IN_FLOAT_RANGE_TEST_HELPER_H
7
8#include <stdint.h>
9
10#define CHECK_DATA(start, stop, mfp_op, f, f_check, count, prec) \
11 { \
12 uint64_t ustart = FPBits(start).uintval(); \
13 uint64_t ustop = FPBits(stop).uintval(); \
14 for (uint64_t i = 0;; ++i) { \
15 uint64_t v = ustart + (ustop - ustart) * i / count; \
16 if (v > ustop) \
17 break; \
18 float x = FPBits(uint32_t(v)).get_val(); \
19 if ((f_check)(x)) { \
20 EXPECT_MPFR_MATCH_ALL_ROUNDING(mfp_op, x, static_cast<float>((f)(x)), \
21 (prec)); \
22 } \
23 } \
24 }
25
26#endif // LLVM_LIBC_TEST_SRC_MATH_IN_FLOAT_RANGE_TEST_HELPER_H
27

source code of libc/test/src/math/in_float_range_test_helper.h