llvm-project/libcxx/test/support/floating_pointer_helpers.h
Nikolas Klauser 5aacf93a89
[libc++] Use _Complex for multiplication and division of complex floating point types (#83575)
This significantly simplifies the implementation and improves the
codegen. The only downside is that the accuracy can be marginally worse,
but that is up to the compiler to decide with this change, which means
it can be controlled by compiler flags.

Differential Revision: https://reviews.llvm.org/D155312
2024-07-05 11:25:59 +02:00

22 lines
733 B
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef TEST_SUPPORT_FLOATING_POINT_HELPERS_H
#define TEST_SUPPORT_FLOATING_POINT_HELPERS_H
#include <limits>
#include "test_macros.h"
template <class T>
TEST_CONSTEXPR_CXX20 bool is_close(T v, T comp) {
return v <= comp + std::numeric_limits<T>::epsilon() && v >= comp - std::numeric_limits<T>::epsilon();
}
#endif // TEST_SUPPORT_FLOATING_POINT_HELPERS_H