22 lines · c
1//===----------------------------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef TEST_SUPPORT_FLOATING_POINT_HELPERS_H10#define TEST_SUPPORT_FLOATING_POINT_HELPERS_H11 12#include <limits>13 14#include "test_macros.h"15 16template <class T>17TEST_CONSTEXPR_CXX20 bool is_close(T v, T comp) {18 return v <= comp + std::numeric_limits<T>::epsilon() && v >= comp - std::numeric_limits<T>::epsilon();19}20 21#endif // TEST_SUPPORT_FLOATING_POINT_HELPERS_H22