MeshLib C++ Docs
Loading...
Searching...
No Matches
MRIsNaN.h
Go to the documentation of this file.
1#pragma once
2
3#include <limits>
4
5#if __cpp_lib_bit_cast >= 201806L
6#include <bit>
7#else
8#include <cmath>
9#endif
10
11namespace MR
12{
15
16
17constexpr float cQuietNan = std::numeric_limits<float>::quiet_NaN();
18#if __cpp_lib_bit_cast >= 201806L
19constexpr int cQuietNanBits = std::bit_cast< int >( cQuietNan );
20#endif
21
23inline bool isNanFast( float f )
24{
25#if __cpp_lib_bit_cast >= 201806L
26 return std::bit_cast< int >( f ) == cQuietNanBits;
27#else
28 return std::isnan( f );
29#endif
30}
31
32}
constexpr float cQuietNan
Definition MRIsNaN.h:17
bool isNanFast(float f)
quickly tests whether given float is not-a-number
Definition MRIsNaN.h:23
only for bindings generation
Definition MRCameraOrientationPlugin.h:8