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