OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
FloatingPoint< RawType > Class Template Reference

#include <opentrep/basic/float_utils_google.hpp>

Public Types

typedef TypeWithSize< sizeof(RawType)>::UInt Bits
 

Public Member Functions

 FloatingPoint (const RawType &x)
 
const Bitsbits () const
 
Bits exponent_bits () const
 
Bits fraction_bits () const
 
Bits sign_bit () const
 
bool is_nan () const
 
bool AlmostEquals (const FloatingPoint &rhs) const
 

Static Public Member Functions

static RawType ReinterpretBits (const Bits bits)
 
static RawType Infinity ()
 

Static Public Attributes

static const size_t kBitCount = 8*sizeof(RawType)
 
static const size_t kFractionBitCount
 
static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount
 
static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1)
 
static const Bits kFractionBitMask
 
static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask)
 
static const size_t kMaxUlps = 4
 

Detailed Description

template<typename RawType>
class FloatingPoint< RawType >

Definition at line 124 of file float_utils_google.hpp.

Member Typedef Documentation

◆ Bits

template<typename RawType>
typedef TypeWithSize<sizeof(RawType)>::UInt FloatingPoint< RawType >::Bits

Definition at line 128 of file float_utils_google.hpp.

Constructor & Destructor Documentation

◆ FloatingPoint()

template<typename RawType>
FloatingPoint< RawType >::FloatingPoint ( const RawType & x)
inlineexplicit

Definition at line 172 of file float_utils_google.hpp.

Referenced by AlmostEquals(), and ReinterpretBits().

Member Function Documentation

◆ ReinterpretBits()

template<typename RawType>
static RawType FloatingPoint< RawType >::ReinterpretBits ( const Bits bits)
inlinestatic

Definition at line 179 of file float_utils_google.hpp.

References bits(), and FloatingPoint().

Referenced by Infinity().

◆ Infinity()

template<typename RawType>
static RawType FloatingPoint< RawType >::Infinity ( )
inlinestatic

Definition at line 186 of file float_utils_google.hpp.

References kExponentBitMask, and ReinterpretBits().

◆ bits()

template<typename RawType>
const Bits & FloatingPoint< RawType >::bits ( ) const
inline

Definition at line 193 of file float_utils_google.hpp.

Referenced by ReinterpretBits().

◆ exponent_bits()

template<typename RawType>
Bits FloatingPoint< RawType >::exponent_bits ( ) const
inline

Definition at line 196 of file float_utils_google.hpp.

References kExponentBitMask.

Referenced by is_nan().

◆ fraction_bits()

template<typename RawType>
Bits FloatingPoint< RawType >::fraction_bits ( ) const
inline

Definition at line 199 of file float_utils_google.hpp.

References kFractionBitMask.

Referenced by is_nan().

◆ sign_bit()

template<typename RawType>
Bits FloatingPoint< RawType >::sign_bit ( ) const
inline

Definition at line 202 of file float_utils_google.hpp.

References kSignBitMask.

◆ is_nan()

template<typename RawType>
bool FloatingPoint< RawType >::is_nan ( ) const
inline

Definition at line 205 of file float_utils_google.hpp.

References exponent_bits(), fraction_bits(), and kExponentBitMask.

Referenced by AlmostEquals().

◆ AlmostEquals()

template<typename RawType>
bool FloatingPoint< RawType >::AlmostEquals ( const FloatingPoint< RawType > & rhs) const
inline

Definition at line 217 of file float_utils_google.hpp.

References FloatingPoint(), is_nan(), and kMaxUlps.

Referenced by OPENTREP::ScoreBoard::setScore().

Member Data Documentation

◆ kBitCount

template<typename RawType>
const size_t FloatingPoint< RawType >::kBitCount = 8*sizeof(RawType)
static

Definition at line 133 of file float_utils_google.hpp.

◆ kFractionBitCount

template<typename RawType>
const size_t FloatingPoint< RawType >::kFractionBitCount
static
Initial value:

Definition at line 136 of file float_utils_google.hpp.

◆ kExponentBitCount

template<typename RawType>
const size_t FloatingPoint< RawType >::kExponentBitCount = kBitCount - 1 - kFractionBitCount
static

Definition at line 140 of file float_utils_google.hpp.

◆ kSignBitMask

template<typename RawType>
const Bits FloatingPoint< RawType >::kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1)
static

Definition at line 143 of file float_utils_google.hpp.

Referenced by sign_bit().

◆ kFractionBitMask

template<typename RawType>
const Bits FloatingPoint< RawType >::kFractionBitMask
static
Initial value:

Definition at line 146 of file float_utils_google.hpp.

Referenced by fraction_bits().

◆ kExponentBitMask

template<typename RawType>
const Bits FloatingPoint< RawType >::kExponentBitMask = ~(kSignBitMask | kFractionBitMask)
static

Definition at line 150 of file float_utils_google.hpp.

Referenced by exponent_bits(), Infinity(), and is_nan().

◆ kMaxUlps

template<typename RawType>
const size_t FloatingPoint< RawType >::kMaxUlps = 4
static

Definition at line 164 of file float_utils_google.hpp.

Referenced by AlmostEquals().


The documentation for this class was generated from the following file: