IDS peak ICV
v1.3.0
Loading...
Searching...
No Matches
peak_common_math.hpp
Go to the documentation of this file.
1
11
#pragma once
12
13
#include <type_traits>
14
#include <algorithm>
15
#include <cstdint>
16
#include <cstdlib>
17
#include <limits>
18
19
namespace
peak
20
{
21
namespace
common
22
{
23
namespace
detail
24
{
25
44
template
<
typename
H
46
,
47
typename
std::enable_if_t<std::is_floating_point<H>::value,
int
> = 0
49
>
50
constexpr
bool
AreAlmostEqual
(H lhs, H rhs, uint32_t ulp)
51
{
52
return
std::abs(lhs - rhs) <= std::numeric_limits<H>::epsilon() * (std::max)(std::abs(lhs), std::abs(rhs)) *
static_cast<
H
>
(ulp);
53
}
54
55
}
// namespace detail
56
}
// namespace common
57
}
// namespace peak
peak::common::detail::AreAlmostEqual
constexpr bool AreAlmostEqual(H lhs, H rhs, uint32_t ulp)
Compares two floating-point values for approximate equality using a ULP-based tolerance.
Definition
peak_common_math.hpp:50
peak
Definition
peak_common_math.hpp:20
peak_common
detail
peak_common_math.hpp
Send mail feedback
Generated on Mon Apr 20 2026 - ©
IDS Imaging Development Systems GmbH