72#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_REAL_H_
73#define ELEMENTSKERNEL_ELEMENTSKERNEL_REAL_H_
95template <std::
size_t size>
120 using UInt =
unsigned long long;
123template <
typename RawType>
161template <
typename RawType>
177 static const std::size_t s_exponent_bitcount = s_bitcount - 1 - s_fraction_bitcount;
180 static const Bits s_sign_bitmask =
static_cast<Bits>(1) << (s_bitcount - 1);
183 static const Bits s_fraction_bitmask = ~static_cast<Bits>(0) >> (s_exponent_bitcount + 1);
186 static const Bits s_exponent_bitmask = ~(s_sign_bitmask | s_fraction_bitmask);
278template <
typename FloatType>
282template <
typename RawType>
285template <typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()>
288template <std::
size_t max_ulps>
291template <std::
size_t max_ulps>
294template <typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()>
297template <std::
size_t max_ulps>
300template <std::
size_t max_ulps>
303template <typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()>
306template <std::
size_t max_ulps>
309template <std::
size_t max_ulps>
312template <typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()>
315template <std::
size_t max_ulps>
318template <std::
size_t max_ulps>
321template <typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()>
324template <std::
size_t max_ulps>
327template <std::
size_t max_ulps>
330template <typename RawType, std::size_t max_ulps = defaultMaxUlps<RawType>()>
333template <std::
size_t max_ulps>
336template <std::
size_t max_ulps>
389template <
typename RawType>
394#define ELEMENTSKERNEL_ELEMENTSKERNEL_REAL_IMPL_
396#undef ELEMENTSKERNEL_ELEMENTSKERNEL_REAL_IMPL_
defines the macros to be used for explicit export of the symbols
implementation of the templates declared in ElementsKernel/Real.h
Macro to silence unused variables warnings from the compiler.
Bits fractionBits() const
typename TypeWithSize< sizeof(RawType)>::UInt Bits
static RawType ReinterpretBits(const Bits &bits)
FloatingPoint(const RawType &x)
static Bits distanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, const Bits &sam2)
static Bits signAndMagnitudeToBiased(const Bits &sam)
static RawType Infinity()
bool AlmostEquals(const FloatingPoint &rhs) const
Bits exponentBits() const
const Bits & bits() const
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
ELEMENTS_API const double FLT_DEFAULT_TEST_TOLERANCE
Single precision float default test tolerance.
ELEMENTS_API bool isLess(const RawType &left, const RawType &right)
ELEMENTS_API bool isNotEqual(const RawType &left, const RawType &right)
ELEMENTS_API bool isGreater(const RawType &left, const RawType &right)
constexpr std::size_t FLT_DEFAULT_MAX_ULPS
Single precision float default maximum unit in the last place.
ELEMENTS_API bool isNan(const RawType &x)
ELEMENTS_API bool isEqual(const RawType &left, const RawType &right)
ELEMENTS_API const double DBL_DEFAULT_TEST_TOLERANCE
Double precision float default test tolerance.
ELEMENTS_API bool isLessOrEqual(const RawType &left, const RawType &right)
constexpr std::size_t DBL_DEFAULT_MAX_ULPS
Double precision float default maximum unit in the last place.
ELEMENTS_API bool realBitWiseEqual(const RawType &left, const RawType &right)
This function compares 2 floating point numbers bitwise. These are the strict equivalent of the "=="....
ELEMENTS_API constexpr std::size_t defaultMaxUlps< double >()
ELEMENTS_API constexpr std::size_t defaultMaxUlps< float >()
ELEMENTS_API bool almostEqual2sComplement(ELEMENTS_UNUSED const FloatType &a, ELEMENTS_UNUSED const FloatType &b, ELEMENTS_UNUSED const std::size_t &max_ulps=0)
ELEMENTS_API bool isGreaterOrEqual(const RawType &left, const RawType &right)
ELEMENTS_API constexpr std::size_t defaultMaxUlps()