# Float

class Float

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

  Public Static Functions

  static inline HPS_INLINE void apply_sign_bit (double &a, uint32_t const &sign_bit)
  static inline HPS_INLINE void apply_sign_bit (float &a, uint32_t const &sign_bit)
  static inline HPS_INLINE float C2F (unsigned char x)
  static HPS_INLINE bool Equals (double const &a, double const &b, int tolerance=default_tolerance)
  static HPS_INLINE bool Equals (float const &a, float const &b, int tolerance=default_tolerance)
  template<typename Alloc> static inline HPS_INLINE bool Equals (std::vector< float, Alloc > const &a, std::vector< float, Alloc > const &b, int tolerance=32)
  static inline HPS_INLINE uint32_t extract_sign_bit (double const &a)
  static inline HPS_INLINE uint32_t extract_sign_bit (float const &a)
  static inline HPS_INLINE uint32_t extract_uint32_t (float const &a)
  static inline HPS_INLINE void inject_uint32_t (float &a, uint32_t const &i)
  static inline HPS_INLINE bool IsAbnormal (double const &a)
  static inline HPS_INLINE bool IsAbnormal (float const &a)

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

  static inline HPS_INLINE bool IsInfinite (double const &a)
  static inline HPS_INLINE bool IsInfinite (float const &a)

    See if the value is either infinity

  static inline HPS_INLINE bool IsNAN (double const &a)
  static inline HPS_INLINE bool IsNAN (float const &a)

    See if the value is Not-A-Number

  static inline HPS_INLINE bool match (double const &a, double const &b)
  static inline HPS_INLINE bool match (float const &a, float const &b)
  static inline HPS_INLINE void pack_4 (float const &f, float *m)
  static inline HPS_INLINE void pack_4 (float const &f0, float const &f1, float const &f2, float const &f3, float *m)
  static inline HPS_INLINE void replace_if_larger (double &a, double const &b)
  static inline HPS_INLINE void replace_if_larger (float &a, float const &b)
  static inline HPS_INLINE void replace_if_smaller (double &a, double const &b)
  static inline HPS_INLINE void replace_if_smaller (float &a, float const &b)
  static inline HPS_INLINE unsigned char unit_to_byte (float const &a)
  static inline HPS_INLINE unsigned char unit_to_byte_scaled (float const &a, unsigned char mix)
  static inline HPS_INLINE void unpack_4 (float &f0, float &f1, float &f2, float &f3, float const *const m)
  static inline HPS_INLINE void unpack_4 (float *f0, float const *const m)

  Public Static Attributes

  static constexpr int default_tolerance = 32

    Checks two floats for equality within a specified tolerance. The tolerance is specified in float increments that scale with the floats themselves.

  static float const Infinity

    The 32-bit float representation of infinity.

  static float const NegativeInfinity

    The 32-bit float representation of negative infinity.

Hello I'm HOOPSY!

HOOPSY BETA

Hello I am HOOPSY! your Docs generative AI assistant.

Ask me anything about HOOPS Visualize HPS or choose a sample question below to start a conversation:

Additional info

HOOPSY may store chats to provide and maintain the service according to OpenAI's data policy.

This feature is currently experimental. While we are continually enhancing its performance and quality, the underlying AI model may generate inaccurate or fabricated responses, especially if prompted to do so.

New Conversation
Continue generating