detail Namespace Reference

detail Namespace Reference#

half: half_float::detail Namespace Reference
half_float::detail Namespace Reference

Implementation details. More...

Classes

struct  conditional
 Conditional type. More...
 
struct  bool_type
 Helper for tag dispatching. More...
 
struct  is_float
 Type traits for floating point types. More...
 
struct  bits
 Type traits for floating point bits. More...
 
struct  bits< float >
 Unsigned integer of (at least) 32 bits width. More...
 
struct  bits< double >
 Unsigned integer of (at least) 64 bits width. More...
 
struct  binary_t
 Tag type for binary construction. More...
 
struct  expr
 Temporary half-precision expression. More...
 
struct  enable
 SFINAE helper for generic half-precision functions. More...
 
struct  result
 Return type for specialized generic 2-argument half-precision functions. More...
 
struct  unary_specialized
 Wrapper for unary half-precision functions needing specialization for individual argument types. More...
 
struct  binary_specialized
 Wrapper for binary half-precision functions needing specialization for individual argument types. More...
 
struct  half_caster
 Helper class for half casts. More...
 
struct  functions
 Wrapper implementing unspecialized half-precision functions. More...
 

Typedefs

typedef std::uint_least16_t uint16
 Unsigned integer of (at least) 16 bits width.
 

Functions

Classification helpers
template<typename T >
bool builtin_isinf (T arg)
 Check for infinity. More...
 
template<typename T >
bool builtin_isnan (T arg)
 Check for NaN. More...
 
template<typename T >
bool builtin_signbit (T arg)
 Check sign. More...
 
Conversion
template<std::float_round_style R>
uint16 float2half_impl (float value, true_type)
 Convert IEEE single-precision to half-precision. More...
 
template<std::float_round_style R>
uint16 float2half_impl (double value, true_type)
 Convert IEEE double-precision to half-precision. More...
 
template<std::float_round_style R, typename T >
uint16 float2half_impl (T value,...)
 Convert non-IEEE floating point to half-precision. More...
 
template<std::float_round_style R, typename T >
uint16 float2half (T value)
 Convert floating point to half-precision. More...
 
template<std::float_round_style R, bool S, typename T >
uint16 int2half_impl (T value)
 Convert integer to half-precision floating point. More...
 
template<std::float_round_style R, typename T >
uint16 int2half (T value)
 Convert integer to half-precision floating point. More...
 
float half2float_impl (uint16 value, float, true_type)
 Convert half-precision to IEEE single-precision. More...
 
double half2float_impl (uint16 value, double, true_type)
 Convert half-precision to IEEE double-precision. More...
 
template<typename T >
half2float_impl (uint16 value, T,...)
 Convert half-precision to non-IEEE floating point. More...
 
template<typename T >
half2float (uint16 value)
 Convert half-precision to floating point. More...
 
template<std::float_round_style R, bool E, typename T >
half2int_impl (uint16 value)
 Convert half-precision floating point to integer. More...
 
template<std::float_round_style R, typename T >
half2int (uint16 value)
 Convert half-precision floating point to integer. More...
 
template<typename T >
half2int_up (uint16 value)
 Convert half-precision floating point to integer using round-to-nearest-away-from-zero. More...
 
template<std::float_round_style R, bool E>
uint16 round_half_impl (uint16 value)
 Round half-precision number to nearest integer value. More...
 
template<std::float_round_style R>
uint16 round_half (uint16 value)
 Round half-precision number to nearest integer value. More...
 
uint16 round_half_up (uint16 value)
 Round half-precision number to nearest integer value using round-to-nearest-away-from-zero. More...
 
Comparison operators
template<typename T , typename U >
enable< bool, T, U >::type operator== (T x, U y)
 Comparison for equality. More...
 
template<typename T , typename U >
enable< bool, T, U >::type operator!= (T x, U y)
 Comparison for inequality. More...
 
template<typename T , typename U >
enable< bool, T, U >::type operator< (T x, U y)
 Comparison for less than. More...
 
template<typename T , typename U >
enable< bool, T, U >::type operator> (T x, U y)
 Comparison for greater than. More...
 
template<typename T , typename U >
enable< bool, T, U >::type operator<= (T x, U y)
 Comparison for less equal. More...
 
template<typename T , typename U >
enable< bool, T, U >::type operator>= (T x, U y)
 Comparison for greater equal. More...
 
Arithmetic operators
template<typename T , typename U >
enable< expr, T, U >::type operator+ (T x, U y)
 Add halfs. More...
 
template<typename T , typename U >
enable< expr, T, U >::type operator- (T x, U y)
 Subtract halfs. More...
 
template<typename T , typename U >
enable< expr, T, U >::type operator* (T x, U y)
 Multiply halfs. More...
 
template<typename T , typename U >
enable< expr, T, U >::type operator/ (T x, U y)
 Divide halfs. More...
 
template<typename T >
constexpr enable< T, T >::type operator+ (T arg)
 Identity. More...
 
template<typename T >
constexpr enable< T, T >::type operator- (T arg)
 Negation. More...
 
Input and output
template<typename T , typename charT , typename traits >
enable< std::basic_ostream< charT, traits > &, T >::type operator<< (std::basic_ostream< charT, traits > &out, T arg)
 Output operator. More...
 
template<typename charT , typename traits >
std::basic_istream< charT, traits > & operator>> (std::basic_istream< charT, traits > &in, half &arg)
 Input operator. More...
 
Basic mathematical operations
half abs (half arg)
 Absolute value. More...
 
expr abs (expr arg)
 
half fabs (half arg)
 Absolute value. More...
 
expr fabs (expr arg)
 
expr fmod (half x, half y)
 Remainder of division. More...
 
expr fmod (half x, expr y)
 
expr fmod (expr x, half y)
 
expr fmod (expr x, expr y)
 
expr remainder (half x, half y)
 Remainder of division. More...
 
expr remainder (half x, expr y)
 
expr remainder (expr x, half y)
 
expr remainder (expr x, expr y)
 
expr remquo (half x, half y, int *quo)
 Remainder of division. More...
 
expr remquo (half x, expr y, int *quo)
 
expr remquo (expr x, half y, int *quo)
 
expr remquo (expr x, expr y, int *quo)
 
expr fma (half x, half y, half z)
 Fused multiply add. More...
 
expr fma (half x, half y, expr z)
 
expr fma (half x, expr y, half z)
 
expr fma (half x, expr y, expr z)
 
expr fma (expr x, half y, half z)
 
expr fma (expr x, half y, expr z)
 
expr fma (expr x, expr y, half z)
 
expr fma (expr x, expr y, expr z)
 
half fmax (half x, half y)
 Maximum of half expressions. More...
 
expr fmax (half x, expr y)
 
expr fmax (expr x, half y)
 
expr fmax (expr x, expr y)
 
half fmin (half x, half y)
 Minimum of half expressions. More...
 
expr fmin (half x, expr y)
 
expr fmin (expr x, half y)
 
expr fmin (expr x, expr y)
 
expr fdim (half x, half y)
 Positive difference. More...
 
expr fdim (half x, expr y)
 
expr fdim (expr x, half y)
 
expr fdim (expr x, expr y)
 
half nanh (const char *)
 Get NaN value. More...
 
Exponential functions
expr exp (half arg)
 Exponential function. More...
 
expr exp (expr arg)
 
expr expm1 (half arg)
 Exponential minus one. More...
 
expr expm1 (expr arg)
 
expr exp2 (half arg)
 Binary exponential. More...
 
expr exp2 (expr arg)
 
expr log (half arg)
 Natural logorithm. More...
 
expr log (expr arg)
 
expr log10 (half arg)
 Common logorithm. More...
 
expr log10 (expr arg)
 
expr log1p (half arg)
 Natural logorithm. More...
 
expr log1p (expr arg)
 
expr log2 (half arg)
 Binary logorithm. More...
 
expr log2 (expr arg)
 
Power functions
expr sqrt (half arg)
 Square root. More...
 
expr sqrt (expr arg)
 
expr cbrt (half arg)
 Cubic root. More...
 
expr cbrt (expr arg)
 
expr hypot (half x, half y)
 Hypotenuse function. More...
 
expr hypot (half x, expr y)
 
expr hypot (expr x, half y)
 
expr hypot (expr x, expr y)
 
expr pow (half base, half exp)
 Power function. More...
 
expr pow (half base, expr exp)
 
expr pow (expr base, half exp)
 
expr pow (expr base, expr exp)
 
Trigonometric functions
expr sin (half arg)
 Sine function. More...
 
expr sin (expr arg)
 
expr cos (half arg)
 Cosine function. More...
 
expr cos (expr arg)
 
expr tan (half arg)
 Tangent function. More...
 
expr tan (expr arg)
 
expr asin (half arg)
 Arc sine. More...
 
expr asin (expr arg)
 
expr acos (half arg)
 Arc cosine function. More...
 
expr acos (expr arg)
 
expr atan (half arg)
 Arc tangent function. More...
 
expr atan (expr arg)
 
expr atan2 (half x, half y)
 Arc tangent function. More...
 
expr atan2 (half x, expr y)
 
expr atan2 (expr x, half y)
 
expr atan2 (expr x, expr y)
 
Hyperbolic functions
expr sinh (half arg)
 Hyperbolic sine. More...
 
expr sinh (expr arg)
 
expr cosh (half arg)
 Hyperbolic cosine. More...
 
expr cosh (expr arg)
 
expr tanh (half arg)
 Hyperbolic tangent. More...
 
expr tanh (expr arg)
 
expr asinh (half arg)
 Hyperbolic area sine. More...
 
expr asinh (expr arg)
 
expr acosh (half arg)
 Hyperbolic area cosine. More...
 
expr acosh (expr arg)
 
expr atanh (half arg)
 Hyperbolic area tangent. More...
 
expr atanh (expr arg)
 
Error and gamma functions
expr erf (half arg)
 Error function. More...
 
expr erf (expr arg)
 
expr erfc (half arg)
 Complementary error function. More...
 
expr erfc (expr arg)
 
expr lgamma (half arg)
 Natural logarithm of gamma function. More...
 
expr lgamma (expr arg)
 
expr tgamma (half arg)
 Gamma function. More...
 
expr tgamma (expr arg)
 
Rounding
half ceil (half arg)
 Nearest integer not less than half value. More...
 
half ceil (expr arg)
 
half floor (half arg)
 Nearest integer not greater than half value. More...
 
half floor (expr arg)
 
half trunc (half arg)
 Nearest integer not greater in magnitude than half value. More...
 
half trunc (expr arg)
 
half round (half arg)
 Nearest integer. More...
 
half round (expr arg)
 
long lround (half arg)
 Nearest integer. More...
 
long lround (expr arg)
 
half nearbyint (half arg)
 Nearest integer using half's internal rounding mode. More...
 
half nearbyint (expr arg)
 
half rint (half arg)
 Nearest integer using half's internal rounding mode. More...
 
half rint (expr arg)
 
long lrint (half arg)
 Nearest integer using half's internal rounding mode. More...
 
long lrint (expr arg)
 
long long llround (half arg)
 Nearest integer. More...
 
long long llround (expr arg)
 
long long llrint (half arg)
 Nearest integer using half's internal rounding mode. More...
 
long long llrint (expr arg)
 
Floating point manipulation
half frexp (half arg, int *exp)
 Decompress floating point number. More...
 
half frexp (expr arg, int *exp)
 
half ldexp (half arg, int exp)
 Multiply by power of two. More...
 
half ldexp (expr arg, int exp)
 
half modf (half arg, half *iptr)
 Extract integer and fractional parts. More...
 
half modf (expr arg, half *iptr)
 
half scalbn (half arg, int exp)
 Multiply by power of two. More...
 
half scalbn (expr arg, int exp)
 
half scalbln (half arg, long exp)
 Multiply by power of two. More...
 
half scalbln (expr arg, long exp)
 
int ilogb (half arg)
 Extract exponent. More...
 
int ilogb (expr arg)
 
half logb (half arg)
 Extract exponent. More...
 
half logb (expr arg)
 
half nextafter (half from, half to)
 Next representable value. More...
 
half nextafter (half from, expr to)
 
half nextafter (expr from, half to)
 
half nextafter (expr from, expr to)
 
half nexttoward (half from, long double to)
 Next representable value. More...
 
half nexttoward (expr from, long double to)
 
half copysign (half x, half y)
 Take sign. More...
 
half copysign (half x, expr y)
 
half copysign (expr x, half y)
 
half copysign (expr x, expr y)
 
Floating point classification
int fpclassify (half arg)
 Classify floating point value. More...
 
int fpclassify (expr arg)
 
bool isfinite (half arg)
 Check if finite number. More...
 
bool isfinite (expr arg)
 
bool isinf (half arg)
 Check for infinity. More...
 
bool isinf (expr arg)
 
bool isnan (half arg)
 Check for NaN. More...
 
bool isnan (expr arg)
 
bool isnormal (half arg)
 Check if normal number. More...
 
bool isnormal (expr arg)
 
bool signbit (half arg)
 Check sign. More...
 
bool signbit (expr arg)
 
Comparison
bool isgreater (half x, half y)
 Comparison for greater than. More...
 
bool isgreater (half x, expr y)
 
bool isgreater (expr x, half y)
 
bool isgreater (expr x, expr y)
 
bool isgreaterequal (half x, half y)
 Comparison for greater equal. More...
 
bool isgreaterequal (half x, expr y)
 
bool isgreaterequal (expr x, half y)
 
bool isgreaterequal (expr x, expr y)
 
bool isless (half x, half y)
 Comparison for less than. More...
 
bool isless (half x, expr y)
 
bool isless (expr x, half y)
 
bool isless (expr x, expr y)
 
bool islessequal (half x, half y)
 Comparison for less equal. More...
 
bool islessequal (half x, expr y)
 
bool islessequal (expr x, half y)
 
bool islessequal (expr x, expr y)
 
bool islessgreater (half x, half y)
 Comarison for less or greater. More...
 
bool islessgreater (half x, expr y)
 
bool islessgreater (expr x, half y)
 
bool islessgreater (expr x, expr y)
 
bool isunordered (half x, half y)
 Check if unordered. More...
 
bool isunordered (half x, expr y)
 
bool isunordered (expr x, half y)
 
bool isunordered (expr x, expr y)
 
Casting
template<typename T , typename U >
half_cast (U arg)
 Cast to or from half-precision floating point number. More...
 
template<typename T , std::float_round_style R, typename U >
half_cast (U arg)
 Cast to or from half-precision floating point number. More...
 

Variables

constexpr binary_t binary = binary_t()
 Tag for binary construction.
 

Detailed Description

Implementation details.

Function Documentation

◆ builtin_isinf()

template<typename T >
bool half_float::detail::builtin_isinf ( arg)

Check for infinity.

Template Parameters
Targument type (builtin floating point type)
Parameters
argvalue to query
Return values
trueif infinity
falseelse

Definition at line 404 of file half.hpp.

◆ builtin_isnan()

template<typename T >
bool half_float::detail::builtin_isnan ( arg)

Check for NaN.

Template Parameters
Targument type (builtin floating point type)
Parameters
argvalue to query
Return values
trueif not a number
falseelse

Definition at line 420 of file half.hpp.

◆ builtin_signbit()

template<typename T >
bool half_float::detail::builtin_signbit ( arg)

Check sign.

Template Parameters
Targument type (builtin floating point type)
Parameters
argvalue to query
Return values
trueif signbit set
falseelse

Definition at line 436 of file half.hpp.

◆ float2half_impl() [1/3]

template<std::float_round_style R>
uint16 half_float::detail::float2half_impl ( float  value,
true_type   
)

Convert IEEE single-precision to half-precision.

Credit for this goes to Jeroen van der Zijp.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Parameters
valuesingle-precision value
Returns
binary representation of half-precision value

Definition at line 454 of file half.hpp.

◆ float2half_impl() [2/3]

template<std::float_round_style R>
uint16 half_float::detail::float2half_impl ( double  value,
true_type   
)

Convert IEEE double-precision to half-precision.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Parameters
valuedouble-precision value
Returns
binary representation of half-precision value

Definition at line 574 of file half.hpp.

◆ float2half_impl() [3/3]

template<std::float_round_style R, typename T >
uint16 half_float::detail::float2half_impl ( value,
  ... 
)

Convert non-IEEE floating point to half-precision.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Tsource type (builtin floating point type)
Parameters
valuefloating point value
Returns
binary representation of half-precision value

Definition at line 632 of file half.hpp.

◆ float2half()

template<std::float_round_style R, typename T >
uint16 half_float::detail::float2half ( value)

Convert floating point to half-precision.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Tsource type (builtin floating point type)
Parameters
valuefloating point value
Returns
binary representation of half-precision value

Definition at line 681 of file half.hpp.

◆ int2half_impl()

template<std::float_round_style R, bool S, typename T >
uint16 half_float::detail::int2half_impl ( value)

Convert integer to half-precision floating point.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Strue if value negative, false else
Ttype to convert (builtin integer type)
Parameters
valuenon-negative integral value
Returns
binary representation of half-precision value

Definition at line 692 of file half.hpp.

◆ int2half()

template<std::float_round_style R, typename T >
uint16 half_float::detail::int2half ( value)

Convert integer to half-precision floating point.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Ttype to convert (builtin integer type)
Parameters
valueintegral value
Returns
binary representation of half-precision value

Definition at line 737 of file half.hpp.

◆ half2float_impl() [1/3]

float half_float::detail::half2float_impl ( uint16  value,
float  ,
true_type   
)
inline

Convert half-precision to IEEE single-precision.

Credit for this goes to Jeroen van der Zijp.

Parameters
valuebinary representation of half-precision value
Returns
single-precision value

Definition at line 746 of file half.hpp.

◆ half2float_impl() [2/3]

double half_float::detail::half2float_impl ( uint16  value,
double  ,
true_type   
)
inline

Convert half-precision to IEEE double-precision.

Parameters
valuebinary representation of half-precision value
Returns
double-precision value

Definition at line 904 of file half.hpp.

◆ half2float_impl() [3/3]

template<typename T >
T half_float::detail::half2float_impl ( uint16  value,
,
  ... 
)

Convert half-precision to non-IEEE floating point.

Template Parameters
Ttype to convert to (builtin integer type)
Parameters
valuebinary representation of half-precision value
Returns
floating point value

Definition at line 927 of file half.hpp.

◆ half2float()

template<typename T >
T half_float::detail::half2float ( uint16  value)

Convert half-precision to floating point.

Template Parameters
Ttype to convert to (builtin integer type)
Parameters
valuebinary representation of half-precision value
Returns
floating point value

Definition at line 946 of file half.hpp.

◆ half2int_impl()

template<std::float_round_style R, bool E, typename T >
T half_float::detail::half2int_impl ( uint16  value)

Convert half-precision floating point to integer.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Etrue for round to even, false for round away from zero
Ttype to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits)
Parameters
valuebinary representation of half-precision value
Returns
integral value

Definition at line 957 of file half.hpp.

◆ half2int()

template<std::float_round_style R, typename T >
T half_float::detail::half2int ( uint16  value)

Convert half-precision floating point to integer.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Ttype to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits)
Parameters
valuebinary representation of half-precision value
Returns
integral value

Definition at line 995 of file half.hpp.

◆ half2int_up()

template<typename T >
T half_float::detail::half2int_up ( uint16  value)

Convert half-precision floating point to integer using round-to-nearest-away-from-zero.

Template Parameters
Ttype to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits)
Parameters
valuebinary representation of half-precision value
Returns
integral value

Definition at line 1001 of file half.hpp.

◆ round_half_impl()

template<std::float_round_style R, bool E>
uint16 half_float::detail::round_half_impl ( uint16  value)

Round half-precision number to nearest integer value.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Etrue for round to even, false for round away from zero
Parameters
valuebinary representation of half-precision value
Returns
half-precision bits for nearest integral value

Definition at line 1008 of file half.hpp.

◆ round_half()

template<std::float_round_style R>
uint16 half_float::detail::round_half ( uint16  value)

Round half-precision number to nearest integer value.

Template Parameters
Rrounding mode to use, std::round_indeterminate for fastest rounding
Parameters
valuebinary representation of half-precision value
Returns
half-precision bits for nearest integral value

Definition at line 1041 of file half.hpp.

◆ round_half_up()

uint16 half_float::detail::round_half_up ( uint16  value)
inline

Round half-precision number to nearest integer value using round-to-nearest-away-from-zero.

Parameters
valuebinary representation of half-precision value
Returns
half-precision bits for nearest integral value

Definition at line 1046 of file half.hpp.

◆ operator==()

template<typename T , typename U >
enable<bool,T,U>::type half_float::detail::operator== ( x,
y 
)

Comparison for equality.

Parameters
xfirst operand
ysecond operand
Return values
trueif operands equal
falseelse

Definition at line 2118 of file half.hpp.

◆ operator!=()

template<typename T , typename U >
enable<bool,T,U>::type half_float::detail::operator!= ( x,
y 
)

Comparison for inequality.

Parameters
xfirst operand
ysecond operand
Return values
trueif operands not equal
falseelse

Definition at line 2125 of file half.hpp.

◆ operator<()

template<typename T , typename U >
enable<bool,T,U>::type half_float::detail::operator< ( x,
y 
)

Comparison for less than.

Parameters
xfirst operand
ysecond operand
Return values
trueif x less than y
falseelse

Definition at line 2132 of file half.hpp.

◆ operator>()

template<typename T , typename U >
enable<bool,T,U>::type half_float::detail::operator> ( x,
y 
)

Comparison for greater than.

Parameters
xfirst operand
ysecond operand
Return values
trueif x greater than y
falseelse

Definition at line 2139 of file half.hpp.

◆ operator<=()

template<typename T , typename U >
enable<bool,T,U>::type half_float::detail::operator<= ( x,
y 
)

Comparison for less equal.

Parameters
xfirst operand
ysecond operand
Return values
trueif x less equal y
falseelse

Definition at line 2146 of file half.hpp.

◆ operator>=()

template<typename T , typename U >
enable<bool,T,U>::type half_float::detail::operator>= ( x,
y 
)

Comparison for greater equal.

Parameters
xfirst operand
ysecond operand
Return values
trueif x greater equal y
falseelse

Definition at line 2153 of file half.hpp.

◆ operator+() [1/2]

template<typename T , typename U >
enable<expr,T,U>::type half_float::detail::operator+ ( x,
y 
)

Add halfs.

Parameters
xleft operand
yright operand
Returns
sum of half expressions

Definition at line 2163 of file half.hpp.

◆ operator-() [1/2]

template<typename T , typename U >
enable<expr,T,U>::type half_float::detail::operator- ( x,
y 
)

Subtract halfs.

Parameters
xleft operand
yright operand
Returns
difference of half expressions

Definition at line 2169 of file half.hpp.

◆ operator*()

template<typename T , typename U >
enable<expr,T,U>::type half_float::detail::operator* ( x,
y 
)

Multiply halfs.

Parameters
xleft operand
yright operand
Returns
product of half expressions

Definition at line 2175 of file half.hpp.

◆ operator/()

template<typename T , typename U >
enable<expr,T,U>::type half_float::detail::operator/ ( x,
y 
)

Divide halfs.

Parameters
xleft operand
yright operand
Returns
quotient of half expressions

Definition at line 2181 of file half.hpp.

◆ operator+() [2/2]

template<typename T >
constexpr enable<T,T>::type half_float::detail::operator+ ( arg)
constexpr

Identity.

Parameters
argoperand
Returns
uncahnged operand

Definition at line 2186 of file half.hpp.

◆ operator-() [2/2]

template<typename T >
constexpr enable<T,T>::type half_float::detail::operator- ( arg)
constexpr

Negation.

Parameters
argoperand
Returns
negated operand

Definition at line 2191 of file half.hpp.

◆ operator<<()

template<typename T , typename charT , typename traits >
enable<std::basic_ostream<charT,traits>&,T>::type half_float::detail::operator<< ( std::basic_ostream< charT, traits > &  out,
arg 
)

Output operator.

Parameters
outoutput stream to write into
arghalf expression to write
Returns
reference to output stream

Definition at line 2201 of file half.hpp.

◆ operator>>()

template<typename charT , typename traits >
std::basic_istream<charT,traits>& half_float::detail::operator>> ( std::basic_istream< charT, traits > &  in,
half arg 
)

Input operator.

Parameters
ininput stream to read from
arghalf to read into
Returns
reference to input stream

Definition at line 2209 of file half.hpp.

◆ abs()

half half_float::detail::abs ( half  arg)
inline

Absolute value.

Parameters
argoperand
Returns
absolute value of arg

Definition at line 2219 of file half.hpp.

◆ fabs()

half half_float::detail::fabs ( half  arg)
inline

Absolute value.

Parameters
argoperand
Returns
absolute value of arg

Definition at line 2226 of file half.hpp.

◆ fmod()

expr half_float::detail::fmod ( half  x,
half  y 
)
inline

Remainder of division.

Parameters
xfirst operand
ysecond operand
Returns
remainder of floating point division.

Definition at line 2234 of file half.hpp.

◆ remainder()

expr half_float::detail::remainder ( half  x,
half  y 
)
inline

Remainder of division.

Parameters
xfirst operand
ysecond operand
Returns
remainder of floating point division.

Definition at line 2244 of file half.hpp.

◆ remquo()

expr half_float::detail::remquo ( half  x,
half  y,
int *  quo 
)
inline

Remainder of division.

Parameters
xfirst operand
ysecond operand
quoaddress to store some bits of quotient at
Returns
remainder of floating point division.

Definition at line 2255 of file half.hpp.

◆ fma()

expr half_float::detail::fma ( half  x,
half  y,
half  z 
)
inline

Fused multiply add.

Parameters
xfirst operand
ysecond operand
zthird operand
Returns
( x * y ) + z rounded as one operation.

Definition at line 2266 of file half.hpp.

◆ fmax()

half half_float::detail::fmax ( half  x,
half  y 
)
inline

Maximum of half expressions.

Parameters
xfirst operand
ysecond operand
Returns
maximum of operands

Definition at line 2280 of file half.hpp.

◆ fmin()

half half_float::detail::fmin ( half  x,
half  y 
)
inline

Minimum of half expressions.

Parameters
xfirst operand
ysecond operand
Returns
minimum of operands

Definition at line 2290 of file half.hpp.

◆ fdim()

expr half_float::detail::fdim ( half  x,
half  y 
)
inline

Positive difference.

Parameters
xfirst operand
ysecond operand
Returns
x - y or 0 if difference negative

Definition at line 2300 of file half.hpp.

◆ nanh()

half half_float::detail::nanh ( const char *  )
inline

Get NaN value.

Returns
quiet NaN

Definition at line 2307 of file half.hpp.

◆ exp()

expr half_float::detail::exp ( half  arg)
inline

Exponential function.

Parameters
argfunction argument
Returns
e raised to arg

Definition at line 2317 of file half.hpp.

◆ expm1()

expr half_float::detail::expm1 ( half  arg)
inline

Exponential minus one.

Parameters
argfunction argument
Returns
e raised to arg subtracted by 1

Definition at line 2324 of file half.hpp.

◆ exp2()

expr half_float::detail::exp2 ( half  arg)
inline

Binary exponential.

Parameters
argfunction argument
Returns
2 raised to arg

Definition at line 2331 of file half.hpp.

◆ log()

expr half_float::detail::log ( half  arg)
inline

Natural logorithm.

Parameters
argfunction argument
Returns
logarithm of arg to base e

Definition at line 2338 of file half.hpp.

◆ log10()

expr half_float::detail::log10 ( half  arg)
inline

Common logorithm.

Parameters
argfunction argument
Returns
logarithm of arg to base 10

Definition at line 2345 of file half.hpp.

◆ log1p()

expr half_float::detail::log1p ( half  arg)
inline

Natural logorithm.

Parameters
argfunction argument
Returns
logarithm of arg plus 1 to base e

Definition at line 2352 of file half.hpp.

◆ log2()

expr half_float::detail::log2 ( half  arg)
inline

Binary logorithm.

Parameters
argfunction argument
Returns
logarithm of arg to base 2

Definition at line 2359 of file half.hpp.

◆ sqrt()

expr half_float::detail::sqrt ( half  arg)
inline

Square root.

Parameters
argfunction argument
Returns
square root of arg

Definition at line 2370 of file half.hpp.

◆ cbrt()

expr half_float::detail::cbrt ( half  arg)
inline

Cubic root.

Parameters
argfunction argument
Returns
cubic root of arg

Definition at line 2377 of file half.hpp.

◆ hypot()

expr half_float::detail::hypot ( half  x,
half  y 
)
inline

Hypotenuse function.

Parameters
xfirst argument
ysecond argument
Returns
square root of sum of squares without internal over- or underflows

Definition at line 2385 of file half.hpp.

◆ pow()

expr half_float::detail::pow ( half  base,
half  exp 
)
inline

Power function.

Parameters
basefirst argument
expsecond argument
Returns
base raised to exp

Definition at line 2395 of file half.hpp.

◆ sin()

expr half_float::detail::sin ( half  arg)
inline

Sine function.

Parameters
argfunction argument
Returns
sine value of arg

Definition at line 2408 of file half.hpp.

◆ cos()

expr half_float::detail::cos ( half  arg)
inline

Cosine function.

Parameters
argfunction argument
Returns
cosine value of arg

Definition at line 2415 of file half.hpp.

◆ tan()

expr half_float::detail::tan ( half  arg)
inline

Tangent function.

Parameters
argfunction argument
Returns
tangent value of arg

Definition at line 2422 of file half.hpp.

◆ asin()

expr half_float::detail::asin ( half  arg)
inline

Arc sine.

Parameters
argfunction argument
Returns
arc sine value of arg

Definition at line 2429 of file half.hpp.

◆ acos()

expr half_float::detail::acos ( half  arg)
inline

Arc cosine function.

Parameters
argfunction argument
Returns
arc cosine value of arg

Definition at line 2436 of file half.hpp.

◆ atan()

expr half_float::detail::atan ( half  arg)
inline

Arc tangent function.

Parameters
argfunction argument
Returns
arc tangent value of arg

Definition at line 2443 of file half.hpp.

◆ atan2()

expr half_float::detail::atan2 ( half  x,
half  y 
)
inline

Arc tangent function.

Parameters
xfirst argument
ysecond argument
Returns
arc tangent value

Definition at line 2451 of file half.hpp.

◆ sinh()

expr half_float::detail::sinh ( half  arg)
inline

Hyperbolic sine.

Parameters
argfunction argument
Returns
hyperbolic sine value of arg

Definition at line 2464 of file half.hpp.

◆ cosh()

expr half_float::detail::cosh ( half  arg)
inline

Hyperbolic cosine.

Parameters
argfunction argument
Returns
hyperbolic cosine value of arg

Definition at line 2471 of file half.hpp.

◆ tanh()

expr half_float::detail::tanh ( half  arg)
inline

Hyperbolic tangent.

Parameters
argfunction argument
Returns
hyperbolic tangent value of arg

Definition at line 2478 of file half.hpp.

◆ asinh()

expr half_float::detail::asinh ( half  arg)
inline

Hyperbolic area sine.

Parameters
argfunction argument
Returns
area sine value of arg

Definition at line 2485 of file half.hpp.

◆ acosh()

expr half_float::detail::acosh ( half  arg)
inline

Hyperbolic area cosine.

Parameters
argfunction argument
Returns
area cosine value of arg

Definition at line 2492 of file half.hpp.

◆ atanh()

expr half_float::detail::atanh ( half  arg)
inline

Hyperbolic area tangent.

Parameters
argfunction argument
Returns
area tangent value of arg

Definition at line 2499 of file half.hpp.

◆ erf()

expr half_float::detail::erf ( half  arg)
inline

Error function.

Parameters
argfunction argument
Returns
error function value of arg

Definition at line 2510 of file half.hpp.

◆ erfc()

expr half_float::detail::erfc ( half  arg)
inline

Complementary error function.

Parameters
argfunction argument
Returns
1 minus error function value of arg

Definition at line 2517 of file half.hpp.

◆ lgamma()

expr half_float::detail::lgamma ( half  arg)
inline

Natural logarithm of gamma function.

Parameters
argfunction argument
Returns
natural logarith of gamma function for arg

Definition at line 2524 of file half.hpp.

◆ tgamma()

expr half_float::detail::tgamma ( half  arg)
inline

Gamma function.

Parameters
argfunction argument
Returns
gamma function value of arg

Definition at line 2531 of file half.hpp.

◆ ceil()

half half_float::detail::ceil ( half  arg)
inline

Nearest integer not less than half value.

Parameters
arghalf to round
Returns
nearest integer not less than arg

Definition at line 2542 of file half.hpp.

◆ floor()

half half_float::detail::floor ( half  arg)
inline

Nearest integer not greater than half value.

Parameters
arghalf to round
Returns
nearest integer not greater than arg

Definition at line 2549 of file half.hpp.

◆ trunc()

half half_float::detail::trunc ( half  arg)
inline

Nearest integer not greater in magnitude than half value.

Parameters
arghalf to round
Returns
nearest integer not greater in magnitude than arg

Definition at line 2556 of file half.hpp.

◆ round()

half half_float::detail::round ( half  arg)
inline

Nearest integer.

Parameters
arghalf to round
Returns
nearest integer, rounded away from zero in half-way cases

Definition at line 2563 of file half.hpp.

◆ lround()

long half_float::detail::lround ( half  arg)
inline

Nearest integer.

Parameters
arghalf to round
Returns
nearest integer, rounded away from zero in half-way cases

Definition at line 2570 of file half.hpp.

◆ nearbyint()

half half_float::detail::nearbyint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode

Definition at line 2577 of file half.hpp.

◆ rint()

half half_float::detail::rint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode

Definition at line 2584 of file half.hpp.

◆ lrint()

long half_float::detail::lrint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode

Definition at line 2591 of file half.hpp.

◆ llround()

long long half_float::detail::llround ( half  arg)
inline

Nearest integer.

Parameters
arghalf to round
Returns
nearest integer, rounded away from zero in half-way cases

Definition at line 2598 of file half.hpp.

◆ llrint()

long long half_float::detail::llrint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode

Definition at line 2605 of file half.hpp.

◆ frexp()

half half_float::detail::frexp ( half  arg,
int *  exp 
)
inline

Decompress floating point number.

Parameters
argnumber to decompress
expaddress to store exponent at
Returns
significant in range [0.5, 1)

Definition at line 2618 of file half.hpp.

◆ ldexp()

half half_float::detail::ldexp ( half  arg,
int  exp 
)
inline

Multiply by power of two.

Parameters
argnumber to modify
exppower of two to multiply with
Returns
arg multplied by 2 raised to exp

Definition at line 2626 of file half.hpp.

◆ modf()

half half_float::detail::modf ( half  arg,
half iptr 
)
inline

Extract integer and fractional parts.

Parameters
argnumber to decompress
iptraddress to store integer part at
Returns
fractional part

Definition at line 2634 of file half.hpp.

◆ scalbn()

half half_float::detail::scalbn ( half  arg,
int  exp 
)
inline

Multiply by power of two.

Parameters
argnumber to modify
exppower of two to multiply with
Returns
arg multplied by 2 raised to exp

Definition at line 2642 of file half.hpp.

◆ scalbln()

half half_float::detail::scalbln ( half  arg,
long  exp 
)
inline

Multiply by power of two.

Parameters
argnumber to modify
exppower of two to multiply with
Returns
arg multplied by 2 raised to exp

Definition at line 2650 of file half.hpp.

◆ ilogb()

int half_float::detail::ilogb ( half  arg)
inline

Extract exponent.

Parameters
argnumber to query
Returns
floating point exponent
Return values
FP_ILOGB0for zero
FP_ILOGBNANfor NaN
MAX_INTfor infinity

Definition at line 2660 of file half.hpp.

◆ logb()

half half_float::detail::logb ( half  arg)
inline

Extract exponent.

Parameters
argnumber to query
Returns
floating point exponent

Definition at line 2667 of file half.hpp.

◆ nextafter()

half half_float::detail::nextafter ( half  from,
half  to 
)
inline

Next representable value.

Parameters
fromvalue to compute next representable value for
todirection towards which to compute next value
Returns
next representable value after from in direction towards to

Definition at line 2675 of file half.hpp.

◆ nexttoward()

half half_float::detail::nexttoward ( half  from,
long double  to 
)
inline

Next representable value.

Parameters
fromvalue to compute next representable value for
todirection towards which to compute next value
Returns
next representable value after from in direction towards to

Definition at line 2685 of file half.hpp.

◆ copysign()

half half_float::detail::copysign ( half  x,
half  y 
)
inline

Take sign.

Parameters
xvalue to change sign for
yvalue to take sign from
Returns
value equal to x in magnitude and to y in sign

Definition at line 2693 of file half.hpp.

◆ fpclassify()

int half_float::detail::fpclassify ( half  arg)
inline

Classify floating point value.

Parameters
argnumber to classify
Return values
FP_ZEROfor positive and negative zero
FP_SUBNORMALfor subnormal numbers
FP_INFINITYfor positive and negative infinity
FP_NANfor NaNs
FP_NORMALfor all other (normal) values

Definition at line 2711 of file half.hpp.

◆ isfinite()

bool half_float::detail::isfinite ( half  arg)
inline

Check if finite number.

Parameters
argnumber to check
Return values
trueif neither infinity nor NaN
falseelse

Definition at line 2719 of file half.hpp.

◆ isinf()

bool half_float::detail::isinf ( half  arg)
inline

Check for infinity.

Parameters
argnumber to check
Return values
truefor positive or negative infinity
falseelse

Definition at line 2727 of file half.hpp.

◆ isnan()

bool half_float::detail::isnan ( half  arg)
inline

Check for NaN.

Parameters
argnumber to check
Return values
truefor NaNs
falseelse

Definition at line 2735 of file half.hpp.

◆ isnormal()

bool half_float::detail::isnormal ( half  arg)
inline

Check if normal number.

Parameters
argnumber to check
Return values
trueif normal number
falseif either subnormal, zero, infinity or NaN

Definition at line 2743 of file half.hpp.

◆ signbit()

bool half_float::detail::signbit ( half  arg)
inline

Check sign.

Parameters
argnumber to check
Return values
truefor negative number
falsefor positive number

Definition at line 2751 of file half.hpp.

◆ isgreater()

bool half_float::detail::isgreater ( half  x,
half  y 
)
inline

Comparison for greater than.

Parameters
xfirst operand
ysecond operand
Return values
trueif x greater than y
falseelse

Definition at line 2764 of file half.hpp.

◆ isgreaterequal()

bool half_float::detail::isgreaterequal ( half  x,
half  y 
)
inline

Comparison for greater equal.

Parameters
xfirst operand
ysecond operand
Return values
trueif x greater equal y
falseelse

Definition at line 2775 of file half.hpp.

◆ isless()

bool half_float::detail::isless ( half  x,
half  y 
)
inline

Comparison for less than.

Parameters
xfirst operand
ysecond operand
Return values
trueif x less than y
falseelse

Definition at line 2786 of file half.hpp.

◆ islessequal()

bool half_float::detail::islessequal ( half  x,
half  y 
)
inline

Comparison for less equal.

Parameters
xfirst operand
ysecond operand
Return values
trueif x less equal y
falseelse

Definition at line 2797 of file half.hpp.

◆ islessgreater()

bool half_float::detail::islessgreater ( half  x,
half  y 
)
inline

Comarison for less or greater.

Parameters
xfirst operand
ysecond operand
Return values
trueif either less or greater
falseelse

Definition at line 2808 of file half.hpp.

◆ isunordered()

bool half_float::detail::isunordered ( half  x,
half  y 
)
inline

Check if unordered.

Parameters
xfirst operand
ysecond operand
Return values
trueif unordered (one or two NaN operands)
falseelse

Definition at line 2819 of file half.hpp.

◆ half_cast() [1/2]

template<typename T , typename U >
T half_float::detail::half_cast ( arg)

Cast to or from half-precision floating point number.

This casts between half and any built-in arithmetic type. The values are converted directly using the given rounding mode, without any roundtrip over float that a static_cast would otherwise do. It uses the default rounding mode.

Using this cast with neither of the two types being a half or with any of the two types not being a built-in arithmetic type (apart from half, of course) results in a compiler error and casting between halfs is just a no-op.

Template Parameters
Tdestination type (half or built-in arithmetic type)
Usource type (half or built-in arithmetic type)
Parameters
argvalue to cast
Returns
arg converted to destination type

Definition at line 2839 of file half.hpp.

◆ half_cast() [2/2]

template<typename T , std::float_round_style R, typename U >
T half_float::detail::half_cast ( arg)

Cast to or from half-precision floating point number.

This casts between half and any built-in arithmetic type. The values are converted directly using the given rounding mode, without any roundtrip over float that a static_cast would otherwise do.

Using this cast with neither of the two types being a half or with any of the two types not being a built-in arithmetic type (apart from half, of course) results in a compiler error and casting between halfs is just a no-op.

Template Parameters
Tdestination type (half or built-in arithmetic type)
Rrounding mode to use.
Usource type (half or built-in arithmetic type)
Parameters
argvalue to cast
Returns
arg converted to destination type

Definition at line 2853 of file half.hpp.