Hoops Visualize HPS  version 2018-SP2
Hoops Visualize HPS 3D Rendering Engine
Looking for a senior C++ dev?
I'm looking for work. Hire me!
HPS::Float Class Reference

The Float class is a concept class that exposes a number of useful utilities for working with floating point numbers. More...

#include <hps.h>

Collaboration diagram for HPS::Float:

Static Public Member Functions

static HPS_INLINE bool IsInfinite (float const &a)
 See if the value is either infinity. More...
 
static HPS_INLINE bool IsInfinite (double const &a)
 
static HPS_INLINE bool IsNAN (float const &a)
 See if the value is Not-A-Number. More...
 
static HPS_INLINE bool IsNAN (double const &a)
 
static HPS_INLINE bool IsAbnormal (float const &a)
 See if the value is not "normal" (infinite or NaN) More...
 
static HPS_INLINE bool IsAbnormal (double const &a)
 
static HPS_INLINE bool Equals (float const &a, float const &b, int tolerance=32)
 Checks two floats for equality within a specified tolerance. More...
 
static HPS_INLINE bool Equals (double const &a, double const &b, int tolerance=32)
 
template<typename Alloc >
static HPS_INLINE bool Equals (std::vector< float, Alloc > const &a, std::vector< float, Alloc > const &b, int tolerance=32)
 
static HPS_INLINE uint32_t extract_sign_bit (float const &a)
 
static HPS_INLINE uint32_t extract_sign_bit (double const &a)
 
static HPS_INLINE void apply_sign_bit (float &a, uint32_t const &sign_bit)
 
static HPS_INLINE void apply_sign_bit (double &a, uint32_t const &sign_bit)
 
static HPS_INLINE unsigned char unit_to_byte (float const &a)
 
static HPS_INLINE unsigned char unit_to_byte_scaled (float const &a, unsigned char mix)
 
static HPS_INLINE bool match (float const &a, float const &b)
 
static HPS_INLINE bool match (double const &a, double const &b)
 
static HPS_INLINE void replace_if_smaller (float &a, float const &b)
 
static HPS_INLINE void replace_if_smaller (double &a, double const &b)
 
static HPS_INLINE void replace_if_larger (float &a, float const &b)
 
static HPS_INLINE void replace_if_larger (double &a, double const &b)
 
static HPS_INLINE uint32_t extract_uint32_t (float const &a)
 
static HPS_INLINE void inject_uint32_t (float &a, uint32_t const &i)
 
static HPS_INLINE float C2F (unsigned char x)
 
static HPS_INLINE void pack_4 (float const &f, float *m)
 
static HPS_INLINE void pack_4 (float const &f0, float const &f1, float const &f2, float const &f3, float *m)
 
static HPS_INLINE void unpack_4 (float *f0, float const *const m)
 
static HPS_INLINE void unpack_4 (float &f0, float &f1, float &f2, float &f3, float const *const m)
 

Static Public Attributes

static const float Infinity
 The 32-bit float representation of infinity. More...
 
static const float NegativeInfinity
 The 32-bit float representation of negative infinity. More...
 

Private Types

enum  Parts {
  Low,
  High
}
 

Private Member Functions

 Float ()
 

Static Private Member Functions

static HPS_INLINE bool is_infinite (int32_t const &v)
 
static HPS_INLINE bool is_infinite (uint32_t const &v)
 
static HPS_INLINE bool is_infinite (int32_t const *v)
 
static HPS_INLINE bool is_infinite (uint32_t const *v)
 
static HPS_INLINE bool is_nan (int32_t const &v)
 
static HPS_INLINE bool is_nan (uint32_t const &v)
 
static HPS_INLINE bool is_nan (int32_t const *v)
 
static HPS_INLINE bool is_nan (uint32_t const *v)
 
static HPS_INLINE bool is_special (int32_t const &v)
 
static HPS_INLINE bool is_special (uint32_t const &v)
 
static HPS_INLINE bool is_special (int32_t const *v)
 
static HPS_INLINE bool is_special (uint32_t const *v)
 

Static Private Attributes

static const float char_to_float [256]
 

Detailed Description

The Float class is a concept class that exposes a number of useful utilities for working with floating point numbers.

Member Enumeration Documentation

◆ Parts

enum HPS::Float::Parts
private
Enumerator
Low 
High 

Constructor & Destructor Documentation

◆ Float()

HPS::Float::Float ( )
private

Member Function Documentation

◆ apply_sign_bit() [1/2]

static HPS_INLINE void HPS::Float::apply_sign_bit ( float &  a,
uint32_t const &  sign_bit 
)
inlinestatic
Here is the caller graph for this function:

◆ apply_sign_bit() [2/2]

static HPS_INLINE void HPS::Float::apply_sign_bit ( double &  a,
uint32_t const &  sign_bit 
)
inlinestatic

◆ C2F()

static HPS_INLINE float HPS::Float::C2F ( unsigned char  x)
inlinestatic
Here is the caller graph for this function:

◆ Equals() [1/3]

HPS_INLINE bool HPS::Float::Equals ( float const &  a,
float const &  b,
int  tolerance = 32 
)
static

Checks two floats for equality within a specified tolerance.

The tolerance is specified in float increments that scale with the floats themselves.

Here is the caller graph for this function:

◆ Equals() [2/3]

HPS_INLINE bool HPS::Float::Equals ( double const &  a,
double const &  b,
int  tolerance = 32 
)
static
Here is the call graph for this function:

◆ Equals() [3/3]

template<typename Alloc >
static HPS_INLINE bool HPS::Float::Equals ( std::vector< float, Alloc > const &  a,
std::vector< float, Alloc > const &  b,
int  tolerance = 32 
)
inlinestatic

◆ extract_sign_bit() [1/2]

static HPS_INLINE uint32_t HPS::Float::extract_sign_bit ( float const &  a)
inlinestatic
Here is the caller graph for this function:

◆ extract_sign_bit() [2/2]

static HPS_INLINE uint32_t HPS::Float::extract_sign_bit ( double const &  a)
inlinestatic

◆ extract_uint32_t()

static HPS_INLINE uint32_t HPS::Float::extract_uint32_t ( float const &  a)
inlinestatic

◆ inject_uint32_t()

static HPS_INLINE void HPS::Float::inject_uint32_t ( float &  a,
uint32_t const &  i 
)
inlinestatic

◆ is_infinite() [1/4]

static HPS_INLINE bool HPS::Float::is_infinite ( int32_t const &  v)
inlinestaticprivate

◆ is_infinite() [2/4]

static HPS_INLINE bool HPS::Float::is_infinite ( uint32_t const &  v)
inlinestaticprivate

◆ is_infinite() [3/4]

static HPS_INLINE bool HPS::Float::is_infinite ( int32_t const *  v)
inlinestaticprivate

◆ is_infinite() [4/4]

static HPS_INLINE bool HPS::Float::is_infinite ( uint32_t const *  v)
inlinestaticprivate

◆ is_nan() [1/4]

static HPS_INLINE bool HPS::Float::is_nan ( int32_t const &  v)
inlinestaticprivate

◆ is_nan() [2/4]

static HPS_INLINE bool HPS::Float::is_nan ( uint32_t const &  v)
inlinestaticprivate

◆ is_nan() [3/4]

static HPS_INLINE bool HPS::Float::is_nan ( int32_t const *  v)
inlinestaticprivate

◆ is_nan() [4/4]

static HPS_INLINE bool HPS::Float::is_nan ( uint32_t const *  v)
inlinestaticprivate

◆ is_special() [1/4]

static HPS_INLINE bool HPS::Float::is_special ( int32_t const &  v)
inlinestaticprivate

◆ is_special() [2/4]

static HPS_INLINE bool HPS::Float::is_special ( uint32_t const &  v)
inlinestaticprivate

◆ is_special() [3/4]

static HPS_INLINE bool HPS::Float::is_special ( int32_t const *  v)
inlinestaticprivate

◆ is_special() [4/4]

static HPS_INLINE bool HPS::Float::is_special ( uint32_t const *  v)
inlinestaticprivate

◆ IsAbnormal() [1/2]

static HPS_INLINE bool HPS::Float::IsAbnormal ( float const &  a)
inlinestatic

See if the value is not "normal" (infinite or NaN)

◆ IsAbnormal() [2/2]

static HPS_INLINE bool HPS::Float::IsAbnormal ( double const &  a)
inlinestatic

◆ IsInfinite() [1/2]

static HPS_INLINE bool HPS::Float::IsInfinite ( float const &  a)
inlinestatic

See if the value is either infinity.

◆ IsInfinite() [2/2]

static HPS_INLINE bool HPS::Float::IsInfinite ( double const &  a)
inlinestatic

◆ IsNAN() [1/2]

static HPS_INLINE bool HPS::Float::IsNAN ( float const &  a)
inlinestatic

See if the value is Not-A-Number.

◆ IsNAN() [2/2]

static HPS_INLINE bool HPS::Float::IsNAN ( double const &  a)
inlinestatic

◆ match() [1/2]

static HPS_INLINE bool HPS::Float::match ( float const &  a,
float const &  b 
)
inlinestatic

◆ match() [2/2]

static HPS_INLINE bool HPS::Float::match ( double const &  a,
double const &  b 
)
inlinestatic

◆ pack_4() [1/2]

static HPS_INLINE void HPS::Float::pack_4 ( float const &  f,
float *  m 
)
inlinestatic

◆ pack_4() [2/2]

static HPS_INLINE void HPS::Float::pack_4 ( float const &  f0,
float const &  f1,
float const &  f2,
float const &  f3,
float *  m 
)
inlinestatic

◆ replace_if_larger() [1/2]

static HPS_INLINE void HPS::Float::replace_if_larger ( float &  a,
float const &  b 
)
inlinestatic
Here is the caller graph for this function:

◆ replace_if_larger() [2/2]

static HPS_INLINE void HPS::Float::replace_if_larger ( double &  a,
double const &  b 
)
inlinestatic

◆ replace_if_smaller() [1/2]

static HPS_INLINE void HPS::Float::replace_if_smaller ( float &  a,
float const &  b 
)
inlinestatic
Here is the caller graph for this function:

◆ replace_if_smaller() [2/2]

static HPS_INLINE void HPS::Float::replace_if_smaller ( double &  a,
double const &  b 
)
inlinestatic

◆ unit_to_byte()

static HPS_INLINE unsigned char HPS::Float::unit_to_byte ( float const &  a)
inlinestatic
Here is the caller graph for this function:

◆ unit_to_byte_scaled()

static HPS_INLINE unsigned char HPS::Float::unit_to_byte_scaled ( float const &  a,
unsigned char  mix 
)
inlinestatic
Here is the caller graph for this function:

◆ unpack_4() [1/2]

static HPS_INLINE void HPS::Float::unpack_4 ( float *  f0,
float const *const  m 
)
inlinestatic

◆ unpack_4() [2/2]

static HPS_INLINE void HPS::Float::unpack_4 ( float &  f0,
float &  f1,
float &  f2,
float &  f3,
float const *const  m 
)
inlinestatic

Member Data Documentation

◆ char_to_float

const float HPS::Float::char_to_float[256]
staticprivate

◆ Infinity

const float HPS::Float::Infinity
static

The 32-bit float representation of infinity.

◆ NegativeInfinity

const float HPS::Float::NegativeInfinity
static

The 32-bit float representation of negative infinity.


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