Skip to content

Instantly share code, notes, and snippets.

View 2b-t's full-sized avatar

Tobit Flatscher 2b-t

View GitHub Profile
@2b-t
2b-t / is_almost_equal_ulps.hpp
Last active November 19, 2023 14:31
Constexpr units in the last place (ULP) floating number comparison in C++20 similar to GoogleTest
/**
* \file is_almost_equal_ulps.hpp
* \brief Constexpr implementation of a floating number point comparison based on units in last place (ULPs)
* \mainpage Contains traits and a constexpr function for comparing two floating point numbers based on units
* in the last place (ULP) similar to the implementation in GoogleTest but more modular and constexpr:
* https://github.com/google/googletest/blob/main/googletest/include/gtest/internal/gtest-internal.h
*/
#ifndef IS_ALMOST_EQUAL_ULPS_HPP
#define IS_ALMOST_EQUAL_ULPS_HPP