Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Namespaces | Typedefs | Functions | Variables
Float types and arithmetic

Float types and arithmetic, see also and meta-group Math Support. More...

Namespaces

namespace  jau::float_literals
 

Typedefs

typedef jau::uint_bytes< sizeof(double)>::type jau::double_uint_t
 
typedef float jau::float32_t
 
typedef double jau::float64_t
 
typedef jau::uint_bytes< sizeof(float)>::type jau::float_uint_t
 
typedef float jau::si_lengthf32_t
 Length in fractions of meter using float. More...
 
typedef float jau::si_massf32_t
 Mass in fractions of kilograms using float. More...
 
typedef float jau::si_speedf32_t
 Speed in fractions of meter/seconds using float. More...
 
typedef float jau::si_timef32_t
 Time in fractions of seconds using float. More...
 

Functions

template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr T jau::adeg_to_rad (const T arc_degree) noexcept
 Converts arc-degree to radians. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type jau::almost_equal (const T &a, const T &b, int ulp=1, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true, if both floating point values are equal in the sense that their potential difference is less or equal epsilon * |a+b| * ulp, where |a+b| scales epsilon to the magnitude of used values. More...
 
constexpr uint64_t jau::bit_value (const double a) noexcept
 Returns the unsigned integer representation according to IEEE 754 (IEC 559) double floating-point bit layout. More...
 
constexpr uint32_t jau::bit_value (const float a) noexcept
 Returns the unsigned integer representation according to IEEE 754 (IEC 559) single floating-point bit layout. More...
 
constexpr uint64_t jau::bit_value_raw (const double a) noexcept
 Returns the unsigned integer representation according to IEEE 754 (IEC 559) double floating-point bit layout. More...
 
constexpr uint32_t jau::bit_value_raw (const float a) noexcept
 Returns the unsigned integer representation according to IEEE 754 (IEC 559) single floating-point bit layout. More...
 
template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
jau::uint_bytes< sizeof(T)>::type jau::bit_value_raw (const T a) noexcept
 Returns the unsigned integer representation according to IEEE 754 (IEC 559) floating-point bit layout. More...
 
template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr int jau::compare (const T a, const T b) noexcept
 Returns -1, 0 or 1 if a is less, equal or greater than b, disregarding epsilon but considering NaN, -Inf and +Inf. More...
 
template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr int jau::compare (const T a, const T b, const T epsilon) noexcept
 Returns -1, 0 or 1 if a is less, equal or greater than b, considering epsilon and NaN, -Inf and +Inf. More...
 
constexpr double jau::double_value (const uint64_t a) noexcept
 Converting IEEE 754 (IEC 559) double floating-point bit layout to double, see bit_value() More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals (const T &a, const T &b, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true if both values are equal, i.e. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals (const T &a, const T &b, int ulp, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true, if both floating point values are equal in the sense that their potential difference is less or equal epsilon * ulp. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals2 (const T &a, const T &b, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true if both values are equal, i.e. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals_raw (const T &a, const T &b) noexcept
 Returns true if both values are equal disregarding epsilon but considering NaN, -Inf and +Inf. More...
 
constexpr float jau::float_value (const uint32_t a) noexcept
 Converting IEEE 754 (IEC 559) single floating-point bit layout to float, see bit_value() More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero (const T &a, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true if the given value is less than epsilon, w/ epsilon > 0. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero2f (const T &a, const T &b, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true if all given values a and b are less than epsilon, w/ epsilon > 0. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero3f (const T &a, const T &b, const T &c, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true if all given values a, b and c are less than epsilon, w/ epsilon > 0. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero4f (const T &a, const T &b, const T &c, const T &d, const T &epsilon=std::numeric_limits< T >::epsilon()) noexcept
 Returns true if all given values a, b, c and d are less than epsilon, w/ epsilon > 0. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero_raw (const T &a) noexcept
 Returns true if the given value is zero, disregarding epsilon but considering NaN, -Inf and +Inf. More...
 
template<class T >
std::enable_if< std::is_floating_point_v< T >, T >::type jau::machineEpsilon () noexcept
 Calculates the smallest floating point value approximation the given type T can represent, the machine epsilon of T. More...
 
template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
std::string & jau::mat_to_string (std::string &sb, const std::string &rowPrefix, const std::string &f, const T a[], const jau::nsize_t rows, const jau::nsize_t columns, const bool rowMajorOrder) noexcept
 Appends a matrix of floating points to the given string sb More...
 
template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr T jau::rad_to_adeg (const T rad) noexcept
 Converts radians to arc-degree. More...
 
template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr jau::sint_bytes< sizeof(T)>::type jau::round_to_int (const T v) noexcept
 Returns the rounded value cast to int. More...
 
template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
std::string & jau::row_to_string (std::string &sb, const std::string &f, const T a[], const jau::nsize_t rows, const jau::nsize_t columns, const bool rowMajorOrder, const jau::nsize_t row) noexcept
 Appends a row of floating points to the given string sb More...
 

Variables

constexpr uint64_t const jau::double_iec559_exp_mask = 0x7ff0000000000000_u64
 Exponent mask bits 52-62 of IEEE 754 (IEC 559) double double-point bit layout, i.e. More...
 
constexpr uint64_t const jau::double_iec559_mant_mask = 0x000fffffffffffff_u64
 Mantissa mask bits 0-51 of IEEE 754 (IEC 559) double double-point bit layout, i.e. More...
 
constexpr uint64_t const jau::double_iec559_nan_bitval = 0x7ff8000000000000_u64
 NaN bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e. More...
 
constexpr uint64_t const jau::double_iec559_negative_inf_bitval = 0xfff0000000000000_u64
 Negative infinity bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e. More...
 
constexpr uint64_t const jau::double_iec559_positive_inf_bitval = 0x7ff0000000000000_u64
 Positive infinity bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e. More...
 
constexpr uint64_t const jau::double_iec559_sign_bit = 1_u64 << 63
 Signed bit 63 of IEEE 754 (IEC 559) double double-point bit layout, i.e. More...
 
constexpr uint32_t const jau::float_iec559_exp_mask = 0x7f800000_u32
 Exponent mask bits 23-30 of IEEE 754 (IEC 559) single float-point bit layout, i.e. More...
 
constexpr uint32_t const jau::float_iec559_mant_mask = 0x007fffff_u32
 Mantissa mask bits 0-22 of IEEE 754 (IEC 559) single float-point bit layout, i.e. More...
 
constexpr uint32_t const jau::float_iec559_nan_bitval = 0x7fc00000_u32
 NaN bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e. More...
 
constexpr uint32_t const jau::float_iec559_negative_inf_bitval = 0xff800000_u32
 Negative infinity bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e. More...
 
constexpr uint32_t const jau::float_iec559_positive_inf_bitval = 0x7f800000_u32
 Positive infinity bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e. More...
 
constexpr uint32_t const jau::float_iec559_sign_bit = 1_u32 << 31
 Signed bit 31 of IEEE 754 (IEC 559) single float-point bit layout, i.e. More...
 

Detailed Description

Float types and arithmetic, see also and meta-group Math Support.

Typedef Documentation

◆ float_uint_t

typedef jau::uint_bytes<sizeof(float)>::type jau::float_uint_t

Definition at line 53 of file float_math.hpp.

◆ double_uint_t

typedef jau::uint_bytes<sizeof(double)>::type jau::double_uint_t

Definition at line 54 of file float_math.hpp.

◆ si_timef32_t

typedef float jau::si_timef32_t

Time in fractions of seconds using float.

Definition at line 36 of file float_si_types.hpp.

◆ si_lengthf32_t

typedef float jau::si_lengthf32_t

Length in fractions of meter using float.

Definition at line 38 of file float_si_types.hpp.

◆ si_massf32_t

typedef float jau::si_massf32_t

Mass in fractions of kilograms using float.

Definition at line 40 of file float_si_types.hpp.

◆ si_speedf32_t

typedef float jau::si_speedf32_t

Speed in fractions of meter/seconds using float.

Definition at line 42 of file float_si_types.hpp.

◆ float32_t

typedef float jau::float32_t

Definition at line 46 of file float_types.hpp.

◆ float64_t

typedef double jau::float64_t

Definition at line 47 of file float_types.hpp.

Function Documentation

◆ bit_value_raw() [1/3]

template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
jau::uint_bytes< sizeof(T)>::type jau::bit_value_raw ( const T  a)
noexcept

Returns the unsigned integer representation according to IEEE 754 (IEC 559) floating-point bit layout.

Meaningful semantics are only given if true == std::numeric_limits<T>::is_iec559.

This raw method does not collapse all NaN values.

The result is a functional unsigned integer that, i.e. reversible to double via float_value() or double via double_value() depending on type T,

See specific semantics of IEEE 754 (IEC 559) single floating-point bit layout:

  • float_iec559_sign_bit
  • float_iec559_exp_mask
  • float_iec559_mant_mask
  • float_iec559_positive_inf_bitval
  • float_iec559_negative_inf_bitval
  • float_iec559_nan_bitval

See specific semantics of IEEE 754 (IEC 559) double doubleing-point bit layout:

  • double_iec559_sign_bit
  • double_iec559_exp_mask
  • double_iec559_mant_mask
  • double_iec559_positive_inf_bitval
  • double_iec559_negative_inf_bitval
  • double_iec559_nan_bitval
Template Parameters
Tfloating point type, e.g. float or double
matchingfloating point unsigned integer type, e.g. float_uint_t or double_uint_t
Parameters
afloat value
Returns
unsigned integer representation of IEEE 754 (IEC 559) floating-point bit layout
See also
float_value()
double_value()

Definition at line 129 of file float_math.hpp.

Here is the caller graph for this function:

◆ bit_value_raw() [2/3]

constexpr uint32_t jau::bit_value_raw ( const float  a)
constexprnoexcept

Returns the unsigned integer representation according to IEEE 754 (IEC 559) single floating-point bit layout.

See bit_value() for details.

This raw method does not collapse all NaN values to float_iec559_nan_bitval.

Definition at line 144 of file float_math.hpp.

◆ bit_value() [1/2]

constexpr uint32_t jau::bit_value ( const float  a)
constexprnoexcept

Returns the unsigned integer representation according to IEEE 754 (IEC 559) single floating-point bit layout.

Meaningful semantics are only given if true == std::numeric_limits<float>::is_iec559.

All NaN values which are represented by float_iec559_nan_bitval.

The result is a functional unsigned integer that, i.e. reversible to double via float_value().

See specific semantics of IEEE 754 (IEC 559) single floating-point bit layout:

  • float_iec559_sign_bit
  • float_iec559_exp_mask
  • float_iec559_mant_mask
  • float_iec559_positive_inf_bitval
  • float_iec559_negative_inf_bitval
  • float_iec559_nan_bitval

The result is a functional unsigned integer that, i.e. reversible to float via float_value(), except all NaN values which are represented by float_iec559_nan_bitval.

Parameters
asingle float value
Returns
unsigned integer representation of IEEE 754 (IEC 559) single floating-point bit layout
See also
float_value()
bit_value_raw()

Definition at line 174 of file float_math.hpp.

Here is the caller graph for this function:

◆ float_value()

constexpr float jau::float_value ( const uint32_t  a)
constexprnoexcept

Converting IEEE 754 (IEC 559) single floating-point bit layout to float, see bit_value()

Definition at line 182 of file float_math.hpp.

Here is the caller graph for this function:

◆ bit_value_raw() [3/3]

constexpr uint64_t jau::bit_value_raw ( const double  a)
constexprnoexcept

Returns the unsigned integer representation according to IEEE 754 (IEC 559) double floating-point bit layout.

See bit_value() for details.

This raw method does not collapse all NaN values to double_iec559_nan_bitval.

Definition at line 194 of file float_math.hpp.

◆ bit_value() [2/2]

constexpr uint64_t jau::bit_value ( const double  a)
constexprnoexcept

Returns the unsigned integer representation according to IEEE 754 (IEC 559) double floating-point bit layout.

Meaningful semantics are only given if true == std::numeric_limits<double>::is_iec559.

All NaN values which are represented by double_iec559_nan_bitval.

The result is a functional unsigned integer that, i.e. reversible to double via double_value().

See specific semantics of IEEE 754 (IEC 559) double floating-point bit layout:

  • double_iec559_sign_bit
  • double_iec559_exp_mask
  • double_iec559_mant_mask
  • double_iec559_positive_inf_bitval
  • double_iec559_negative_inf_bitval
  • double_iec559_nan_bitval
Parameters
adouble float value
Returns
unsigned integer representation of IEEE 754 (IEC 559) double floating-point bit layout
See also
double_value()
bit_value_raw()

Definition at line 221 of file float_math.hpp.

◆ double_value()

constexpr double jau::double_value ( const uint64_t  a)
constexprnoexcept

Converting IEEE 754 (IEC 559) double floating-point bit layout to double, see bit_value()

Definition at line 228 of file float_math.hpp.

Here is the caller graph for this function:

◆ machineEpsilon()

template<class T >
std::enable_if< std::is_floating_point_v< T >, T >::type jau::machineEpsilon ( )
noexcept

Calculates the smallest floating point value approximation the given type T can represent, the machine epsilon of T.

Template Parameters
Ta non integer float type
Returns
machine epsilon of T

Definition at line 241 of file float_math.hpp.

◆ is_zero()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero ( const T &  a,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true if the given value is less than epsilon, w/ epsilon > 0.

Definition at line 255 of file float_math.hpp.

Here is the caller graph for this function:

◆ is_zero2f()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero2f ( const T &  a,
const T &  b,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true if all given values a and b are less than epsilon, w/ epsilon > 0.

Definition at line 262 of file float_math.hpp.

◆ is_zero3f()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero3f ( const T &  a,
const T &  b,
const T &  c,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true if all given values a, b and c are less than epsilon, w/ epsilon > 0.

Definition at line 269 of file float_math.hpp.

Here is the caller graph for this function:

◆ is_zero4f()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero4f ( const T &  a,
const T &  b,
const T &  c,
const T &  d,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true if all given values a, b, c and d are less than epsilon, w/ epsilon > 0.

Definition at line 276 of file float_math.hpp.

◆ is_zero_raw()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::is_zero_raw ( const T &  a)
constexprnoexcept

Returns true if the given value is zero, disregarding epsilon but considering NaN, -Inf and +Inf.

Definition at line 286 of file float_math.hpp.

Here is the caller graph for this function:

◆ compare() [1/2]

template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr int jau::compare ( const T  a,
const T  b 
)
constexprnoexcept

Returns -1, 0 or 1 if a is less, equal or greater than b, disregarding epsilon but considering NaN, -Inf and +Inf.

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
  • NaN > 0
  • +Inf > -Inf
Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare

Definition at line 307 of file float_math.hpp.

Here is the caller graph for this function:

◆ compare() [2/2]

template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr int jau::compare ( const T  a,
const T  b,
const T  epsilon 
)
constexprnoexcept

Returns -1, 0 or 1 if a is less, equal or greater than b, considering epsilon and NaN, -Inf and +Inf.

epsilon must be > 0.

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
  • NaN > 0
  • +Inf > -Inf
Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare
epsilondefaults to std::numeric_limits<T>::epsilon(), must be > 0

Definition at line 348 of file float_math.hpp.

◆ equals_raw()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals_raw ( const T &  a,
const T &  b 
)
constexprnoexcept

Returns true if both values are equal disregarding epsilon but considering NaN, -Inf and +Inf.

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare

Definition at line 371 of file float_math.hpp.

Here is the caller graph for this function:

◆ equals() [1/2]

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals ( const T &  a,
const T &  b,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true if both values are equal, i.e.

their absolute delta < epsilon, considering epsilon and NaN, -Inf and +Inf.

epsilon must be > 0.

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare
epsilondefaults to std::numeric_limits<T>::epsilon(), must be > 0

Definition at line 394 of file float_math.hpp.

Here is the caller graph for this function:

◆ equals2()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals2 ( const T &  a,
const T &  b,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true if both values are equal, i.e.

their absolute delta < epsilon, considering epsilon but disregarding NaN, -Inf and +Inf.

Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare

Definition at line 413 of file float_math.hpp.

◆ equals() [2/2]

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type constexpr jau::equals ( const T &  a,
const T &  b,
int  ulp,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
constexprnoexcept

Returns true, if both floating point values are equal in the sense that their potential difference is less or equal epsilon * ulp.

epsilon must be > 0.

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare
ulpdesired precision in ULPs (units in the last place)
epsilonthe machine epsilon of type T, defaults to std::numeric_limits<T>::epsilon()

Definition at line 436 of file float_math.hpp.

◆ almost_equal()

template<class T >
std::enable_if< std::is_floating_point_v< T >, bool >::type jau::almost_equal ( const T &  a,
const T &  b,
int  ulp = 1,
const T &  epsilon = std::numeric_limits<T>::epsilon() 
)
noexcept

Returns true, if both floating point values are equal in the sense that their potential difference is less or equal epsilon * |a+b| * ulp, where |a+b| scales epsilon to the magnitude of used values.

epsilon must be > 0.

Implementation considers following corner cases:

  • NaN == NaN
  • +Inf == +Inf
  • -Inf == -Inf
Template Parameters
Ta non integer float type
Parameters
avalue to compare
bvalue to compare
ulpdesired precision in ULPs (units in the last place), defaults to 1
epsilonthe machine epsilon of type T, defaults to std::numeric_limits<T>::epsilon()

Definition at line 460 of file float_math.hpp.

◆ round_to_int()

template<class T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr jau::sint_bytes< sizeof(T)>::type jau::round_to_int ( const T  v)
constexprnoexcept

Returns the rounded value cast to int.

Definition at line 475 of file float_math.hpp.

◆ adeg_to_rad()

template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr T jau::adeg_to_rad ( const T  arc_degree)
constexprnoexcept

Converts arc-degree to radians.

Definition at line 482 of file float_math.hpp.

◆ rad_to_adeg()

template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr T jau::rad_to_adeg ( const T  rad)
constexprnoexcept

Converts radians to arc-degree.

Definition at line 489 of file float_math.hpp.

Here is the caller graph for this function:

◆ row_to_string()

template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
std::string & jau::row_to_string ( std::string &  sb,
const std::string &  f,
const T  a[],
const jau::nsize_t  rows,
const jau::nsize_t  columns,
const bool  rowMajorOrder,
const jau::nsize_t  row 
)
noexcept

Appends a row of floating points to the given string sb

Parameters
sbstring buffer to appends to
fformat string for each float element, e.g. "%10.5f"
athe float data of size rows x columns
rowsfloat data a size row factor
columnsfloat data a size column factor
rowMajorOrderif true floats are laid out in row-major-order, otherwise column-major-order (OpenGL)
rowselected row of float data a
Returns
given string buffer sb for chaining

Definition at line 506 of file float_math.hpp.

Here is the caller graph for this function:

◆ mat_to_string()

template<typename T , std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
std::string & jau::mat_to_string ( std::string &  sb,
const std::string &  rowPrefix,
const std::string &  f,
const T  a[],
const jau::nsize_t  rows,
const jau::nsize_t  columns,
const bool  rowMajorOrder 
)
noexcept

Appends a matrix of floating points to the given string sb

Parameters
sbstring buffer to appends to
rowPrefixprefix for each row
fformat string for each float element, e.g. "%10.5f"
athe float data of size rows x columns
rowsfloat data a size row factor
columnsfloat data a size column factor
rowMajorOrderif true floats are laid out in row-major-order, otherwise column-major-order (OpenGL)
Returns
given string buffer sb for chaining

Definition at line 537 of file float_math.hpp.

Here is the caller graph for this function:

Variable Documentation

◆ float_iec559_sign_bit

constexpr uint32_t const jau::float_iec559_sign_bit = 1_u32 << 31
constexpr

Signed bit 31 of IEEE 754 (IEC 559) single float-point bit layout, i.e.

0x80000000.

Definition at line 57 of file float_math.hpp.

◆ float_iec559_exp_mask

constexpr uint32_t const jau::float_iec559_exp_mask = 0x7f800000_u32
constexpr

Exponent mask bits 23-30 of IEEE 754 (IEC 559) single float-point bit layout, i.e.

0x7f800000.

Definition at line 60 of file float_math.hpp.

◆ float_iec559_mant_mask

constexpr uint32_t const jau::float_iec559_mant_mask = 0x007fffff_u32
constexpr

Mantissa mask bits 0-22 of IEEE 754 (IEC 559) single float-point bit layout, i.e.

0x007fffff.

Definition at line 63 of file float_math.hpp.

◆ float_iec559_positive_inf_bitval

constexpr uint32_t const jau::float_iec559_positive_inf_bitval = 0x7f800000_u32
constexpr

Positive infinity bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e.

0x7f800000.

Definition at line 66 of file float_math.hpp.

◆ float_iec559_negative_inf_bitval

constexpr uint32_t const jau::float_iec559_negative_inf_bitval = 0xff800000_u32
constexpr

Negative infinity bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e.

0xff800000.

Definition at line 69 of file float_math.hpp.

◆ float_iec559_nan_bitval

constexpr uint32_t const jau::float_iec559_nan_bitval = 0x7fc00000_u32
constexpr

NaN bit-value of IEEE 754 (IEC 559) single float-point bit layout, i.e.

0x7fc00000.

Definition at line 72 of file float_math.hpp.

◆ double_iec559_sign_bit

constexpr uint64_t const jau::double_iec559_sign_bit = 1_u64 << 63
constexpr

Signed bit 63 of IEEE 754 (IEC 559) double double-point bit layout, i.e.

0x8000000000000000.

Definition at line 75 of file float_math.hpp.

◆ double_iec559_exp_mask

constexpr uint64_t const jau::double_iec559_exp_mask = 0x7ff0000000000000_u64
constexpr

Exponent mask bits 52-62 of IEEE 754 (IEC 559) double double-point bit layout, i.e.

0x7ff0000000000000.

Definition at line 78 of file float_math.hpp.

◆ double_iec559_mant_mask

constexpr uint64_t const jau::double_iec559_mant_mask = 0x000fffffffffffff_u64
constexpr

Mantissa mask bits 0-51 of IEEE 754 (IEC 559) double double-point bit layout, i.e.

0x000fffffffffffff.

Definition at line 81 of file float_math.hpp.

◆ double_iec559_positive_inf_bitval

constexpr uint64_t const jau::double_iec559_positive_inf_bitval = 0x7ff0000000000000_u64
constexpr

Positive infinity bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e.

0x7ff0000000000000.

Definition at line 84 of file float_math.hpp.

◆ double_iec559_negative_inf_bitval

constexpr uint64_t const jau::double_iec559_negative_inf_bitval = 0xfff0000000000000_u64
constexpr

Negative infinity bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e.

0xfff0000000000000.

Definition at line 87 of file float_math.hpp.

◆ double_iec559_nan_bitval

constexpr uint64_t const jau::double_iec559_nan_bitval = 0x7ff8000000000000_u64
constexpr

NaN bit-value of IEEE 754 (IEC 559) double double-point bit layout, i.e.

0x7ff8000000000000.

Definition at line 90 of file float_math.hpp.