jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
Float types and arithmetic

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

Namespaces

namespace  jau::float_literals
 
namespace  jau::string_literals
 

Classes

class  jau::float_ctti
 
class  jau::string_ctti
 

Typedefs

typedef jau::uint_bytes_t< sizeof(double)> jau::double_uint_t
 
typedef float jau::float32_t
 
typedef double jau::float64_t
 
typedef jau::uint_bytes_t< sizeof(float)> jau::float_uint_t
 
typedef float jau::si_lengthf32_t
 Length in fractions of meter using float.
 
typedef float jau::si_massf32_t
 Mass in fractions of kilograms using float.
 
typedef float jau::si_speedf32_t
 Speed in fractions of meter/seconds using float.
 
typedef float jau::si_timef32_t
 Time in fractions of seconds using float.
 
typedef std::basic_ostream< uchar8_tjau::u8ostream
 
typedef std::basic_string< uchar8_tjau::u8string
 
typedef std::basic_string_view< uchar8_tjau::u8string_view
 
typedef uint8_t jau::uchar8_t
 

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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
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.
 
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.
 
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.
 
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.
 
template<class T, std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
jau::uint_bytes_t< sizeof(T)> jau::bit_value_raw (const T a) noexcept
 Returns the unsigned integer representation according to IEEE 754 (IEC 559) floating-point bit layout.
 
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.
 
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.
 
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()
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
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()
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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.
 
template<class T>
std::enable_if_t< std::is_floating_point_v< T >, T > jau::machineEpsilon () noexcept
 Calculates the smallest floating point value approximation the given type T can represent, the machine epsilon of T.
 
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
 
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.
 
template<class T, std::enable_if_t< std::is_floating_point_v< T >, bool > = true>
constexpr jau::sint_bytes_t< sizeof(T)> jau::round_to_int (const T v) noexcept
 Returns the rounded value cast to int.
 
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
 

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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 

Detailed Description

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

Typedef Documentation

◆ float_uint_t

typedef jau::uint_bytes_t<sizeof(float)> jau::float_uint_t

Definition at line 52 of file float_math.hpp.

◆ double_uint_t

typedef jau::uint_bytes_t<sizeof(double)> jau::double_uint_t

Definition at line 53 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 49 of file float_types.hpp.

◆ float64_t

typedef double jau::float64_t

Definition at line 50 of file float_types.hpp.

◆ uchar8_t

typedef uint8_t jau::uchar8_t

Definition at line 47 of file string_types.hpp.

◆ u8string

typedef std::basic_string<uchar8_t> jau::u8string

Definition at line 48 of file string_types.hpp.

◆ u8string_view

typedef std::basic_string_view<uchar8_t> jau::u8string_view

Definition at line 49 of file string_types.hpp.

◆ u8ostream

typedef std::basic_ostream<uchar8_t> jau::u8ostream

Definition at line 56 of file string_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_t< sizeof(T)> 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 128 of file float_math.hpp.

Here is the caller graph for this function:

◆ bit_value_raw() [2/3]

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 143 of file float_math.hpp.

◆ bit_value() [1/2]

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 173 of file float_math.hpp.

Here is the caller graph for this function:

◆ float_value()

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 181 of file float_math.hpp.

Here is the caller graph for this function:

◆ bit_value_raw() [3/3]

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 193 of file float_math.hpp.

◆ bit_value() [2/2]

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 220 of file float_math.hpp.

◆ double_value()

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 227 of file float_math.hpp.

Here is the caller graph for this function:

◆ machineEpsilon()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, T > 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 240 of file float_math.hpp.

◆ is_zero()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 254 of file float_math.hpp.

Here is the caller graph for this function:

◆ is_zero2f()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 261 of file float_math.hpp.

◆ is_zero3f()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 268 of file float_math.hpp.

Here is the caller graph for this function:

◆ is_zero4f()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 275 of file float_math.hpp.

◆ is_zero_raw()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 285 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>
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 306 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>
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 347 of file float_math.hpp.

◆ equals_raw()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 370 of file float_math.hpp.

Here is the caller graph for this function:

◆ equals() [1/2]

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 393 of file float_math.hpp.

Here is the caller graph for this function:

◆ equals2()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 412 of file float_math.hpp.

◆ equals() [2/2]

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 435 of file float_math.hpp.

◆ almost_equal()

template<class T>
std::enable_if_t< std::is_floating_point_v< T >, bool > 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 459 of file float_math.hpp.

◆ round_to_int()

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

Returns the rounded value cast to int.

Definition at line 474 of file float_math.hpp.

Here is the caller graph for this function:

◆ adeg_to_rad()

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

Converts arc-degree to radians.

Definition at line 481 of file float_math.hpp.

◆ rad_to_adeg()

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

Converts radians to arc-degree.

Definition at line 488 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 505 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 536 of file float_math.hpp.

Here is the caller graph for this function:

Variable Documentation

◆ float_iec559_sign_bit

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 56 of file float_math.hpp.

◆ float_iec559_exp_mask

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 59 of file float_math.hpp.

◆ float_iec559_mant_mask

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 62 of file float_math.hpp.

◆ float_iec559_positive_inf_bitval

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 65 of file float_math.hpp.

◆ float_iec559_negative_inf_bitval

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 68 of file float_math.hpp.

◆ float_iec559_nan_bitval

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 71 of file float_math.hpp.

◆ double_iec559_sign_bit

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 74 of file float_math.hpp.

◆ double_iec559_exp_mask

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 77 of file float_math.hpp.

◆ double_iec559_mant_mask

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 80 of file float_math.hpp.

◆ double_iec559_positive_inf_bitval

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 83 of file float_math.hpp.

◆ double_iec559_negative_inf_bitval

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 86 of file float_math.hpp.

◆ double_iec559_nan_bitval

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 89 of file float_math.hpp.