GlobeEngine
half_float::detail Namespace Reference

Classes

struct  binary_specialized
 
struct  binary_specialized< half, half >
 
struct  binary_t
 Tag type for binary construction. More...
 
struct  bool_type
 Helper for tag dispatching. More...
 
struct  conditional
 Conditional type. More...
 
struct  conditional< false, T, F >
 
struct  enable
 
struct  enable< T, expr, expr, expr >
 
struct  enable< T, expr, expr, half >
 
struct  enable< T, expr, expr, void >
 
struct  enable< T, expr, half, expr >
 
struct  enable< T, expr, half, half >
 
struct  enable< T, expr, half, void >
 
struct  enable< T, expr, void, void >
 
struct  enable< T, half, expr, expr >
 
struct  enable< T, half, expr, half >
 
struct  enable< T, half, expr, void >
 
struct  enable< T, half, half, expr >
 
struct  enable< T, half, half, half >
 
struct  enable< T, half, half, void >
 
struct  enable< T, half, void, void >
 
struct  expr
 
struct  functions
 Wrapper implementing unspecialized half-precision functions. More...
 
struct  half_caster
 
struct  half_caster< half, expr, R >
 
struct  half_caster< half, half, R >
 
struct  half_caster< half, U, R >
 
struct  half_caster< T, expr, R >
 
struct  half_caster< T, half, R >
 
struct  is_float
 Type traits for floating point types. More...
 
struct  is_float< const T >
 
struct  is_float< const volatile T >
 
struct  is_float< double >
 
struct  is_float< float >
 
struct  is_float< long double >
 
struct  is_float< volatile T >
 
struct  result
 
struct  result< half, half >
 
struct  unary_specialized
 
struct  unary_specialized< expr >
 

Typedefs

typedef bool_type< true > true_type
 
typedef bool_type< false > false_type
 
typedef unsigned short uint16
 Unsigned integer of (at least) 16 bits width. More...
 
typedef unsigned int
 
typedef unsigned unsigned long::type uint32
 
typedef long::type int17
 

Functions

Classification helpers
template<typename T >
bool builtin_isinf (T arg)
 
template<typename T >
bool builtin_isnan (T arg)
 
template<typename T >
bool builtin_signbit (T arg)
 
Conversion
template<std::float_round_style R>
uint16 float2half_impl (float value, true_type)
 
template<std::float_round_style R>
uint16 float2half_impl (float value, false_type)
 
template<std::float_round_style R>
uint16 float2half (float value)
 
template<std::float_round_style R, bool S, typename T >
uint16 int2half_impl (T value)
 
template<std::float_round_style R, typename T >
uint16 int2half (T value)
 
float half2float_impl (uint16 value, true_type)
 
float half2float_impl (uint16 value, false_type)
 
float half2float (uint16 value)
 
template<std::float_round_style R, bool E, typename T >
half2int_impl (uint16 value)
 
template<std::float_round_style R, typename T >
half2int (uint16 value)
 
template<typename T >
half2int_up (uint16 value)
 
template<std::float_round_style R, bool E>
uint16 round_half_impl (uint16 value)
 
template<std::float_round_style R>
uint16 round_half (uint16 value)
 
uint16 round_half_up (uint16 value)
 
Comparison operators
template<typename T , typename U >
enable< bool, T, U >::type operator== (T x, U y)
 
template<typename T , typename U >
enable< bool, T, U >::type operator!= (T x, U y)
 
template<typename T , typename U >
enable< bool, T, U >::type operator< (T x, U y)
 
template<typename T , typename U >
enable< bool, T, U >::type operator> (T x, U y)
 
template<typename T , typename U >
enable< bool, T, U >::type operator<= (T x, U y)
 
template<typename T , typename U >
enable< bool, T, U >::type operator>= (T x, U y)
 
Arithmetic operators
template<typename T , typename U >
enable< expr, T, U >::type operator+ (T x, U y)
 
template<typename T , typename U >
enable< expr, T, U >::type operator- (T x, U y)
 
template<typename T , typename U >
enable< expr, T, U >::type operator* (T x, U y)
 
template<typename T , typename U >
enable< expr, T, U >::type operator/ (T x, U y)
 
template<typename T >
HALF_CONSTEXPR enable< T, T >::type operator+ (T arg)
 
template<typename T >
HALF_CONSTEXPR enable< T, T >::type operator- (T arg)
 
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)
 
template<typename charT , typename traits >
std::basic_istream< charT, traits > & operator>> (std::basic_istream< charT, traits > &in, half &arg)
 
Basic mathematical operations
half abs (half arg)
 
expr abs (expr arg)
 
half fabs (half arg)
 
expr fabs (expr arg)
 
expr fmod (half x, half y)
 
expr fmod (half x, expr y)
 
expr fmod (expr x, half y)
 
expr fmod (expr x, expr y)
 
expr remainder (half x, half y)
 
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)
 
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)
 
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)
 
expr fmax (half x, expr y)
 
expr fmax (expr x, half y)
 
expr fmax (expr x, expr y)
 
half fmin (half x, half y)
 
expr fmin (half x, expr y)
 
expr fmin (expr x, half y)
 
expr fmin (expr x, expr y)
 
expr fdim (half x, half y)
 
expr fdim (half x, expr y)
 
expr fdim (expr x, half y)
 
expr fdim (expr x, expr y)
 
half nanh (const char *arg)
 
Exponential functions
expr exp (half arg)
 
expr exp (expr arg)
 
expr expm1 (half arg)
 
expr expm1 (expr arg)
 
expr exp2 (half arg)
 
expr exp2 (expr arg)
 
expr log (half arg)
 
expr log (expr arg)
 
expr log10 (half arg)
 
expr log10 (expr arg)
 
expr log1p (half arg)
 
expr log1p (expr arg)
 
expr log2 (half arg)
 
expr log2 (expr arg)
 
Power functions
expr sqrt (half arg)
 
expr sqrt (expr arg)
 
expr cbrt (half arg)
 
expr cbrt (expr arg)
 
expr hypot (half x, half y)
 
expr hypot (half x, expr y)
 
expr hypot (expr x, half y)
 
expr hypot (expr x, expr y)
 
expr pow (half base, half exp)
 
expr pow (half base, expr exp)
 
expr pow (expr base, half exp)
 
expr pow (expr base, expr exp)
 
Trigonometric functions
expr sin (half arg)
 
expr sin (expr arg)
 
expr cos (half arg)
 
expr cos (expr arg)
 
expr tan (half arg)
 
expr tan (expr arg)
 
expr asin (half arg)
 
expr asin (expr arg)
 
expr acos (half arg)
 
expr acos (expr arg)
 
expr atan (half arg)
 
expr atan (expr arg)
 
expr atan2 (half x, half y)
 
expr atan2 (half x, expr y)
 
expr atan2 (expr x, half y)
 
expr atan2 (expr x, expr y)
 
Hyperbolic functions
expr sinh (half arg)
 
expr sinh (expr arg)
 
expr cosh (half arg)
 
expr cosh (expr arg)
 
expr tanh (half arg)
 
expr tanh (expr arg)
 
expr asinh (half arg)
 
expr asinh (expr arg)
 
expr acosh (half arg)
 
expr acosh (expr arg)
 
expr atanh (half arg)
 
expr atanh (expr arg)
 
Error and gamma functions
expr erf (half arg)
 
expr erf (expr arg)
 
expr erfc (half arg)
 
expr erfc (expr arg)
 
expr lgamma (half arg)
 
expr lgamma (expr arg)
 
expr tgamma (half arg)
 
expr tgamma (expr arg)
 
Rounding
half ceil (half arg)
 
half ceil (expr arg)
 
half floor (half arg)
 
half floor (expr arg)
 
half trunc (half arg)
 
half trunc (expr arg)
 
half round (half arg)
 
half round (expr arg)
 
long lround (half arg)
 
long lround (expr arg)
 
half nearbyint (half arg)
 
half nearbyint (expr arg)
 
half rint (half arg)
 
half rint (expr arg)
 
long lrint (half arg)
 
long lrint (expr arg)
 
Floating point manipulation
half frexp (half arg, int *exp)
 
half frexp (expr arg, int *exp)
 
half ldexp (half arg, int exp)
 
half ldexp (expr arg, int exp)
 
half modf (half arg, half *iptr)
 
half modf (expr arg, half *iptr)
 
half scalbn (half arg, int exp)
 
half scalbn (expr arg, int exp)
 
half scalbln (half arg, long exp)
 
half scalbln (expr arg, long exp)
 
int ilogb (half arg)
 
int ilogb (expr arg)
 
half logb (half arg)
 
half logb (expr arg)
 
half nextafter (half from, half to)
 
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)
 
half nexttoward (expr from, long double to)
 
half copysign (half x, half y)
 
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)
 
int fpclassify (expr arg)
 
bool isfinite (half arg)
 
bool isfinite (expr arg)
 
bool isinf (half arg)
 
bool isinf (expr arg)
 
bool isnan (half arg)
 
bool isnan (expr arg)
 
bool isnormal (half arg)
 
bool isnormal (expr arg)
 
bool signbit (half arg)
 
bool signbit (expr arg)
 
Comparison
bool isgreater (half x, half y)
 
bool isgreater (half x, expr y)
 
bool isgreater (expr x, half y)
 
bool isgreater (expr x, expr y)
 
bool isgreaterequal (half x, half y)
 
bool isgreaterequal (half x, expr y)
 
bool isgreaterequal (expr x, half y)
 
bool isgreaterequal (expr x, expr y)
 
bool isless (half x, half y)
 
bool isless (half x, expr y)
 
bool isless (expr x, half y)
 
bool isless (expr x, expr y)
 
bool islessequal (half x, half y)
 
bool islessequal (half x, expr y)
 
bool islessequal (expr x, half y)
 
bool islessequal (expr x, expr y)
 
bool islessgreater (half x, half y)
 
bool islessgreater (half x, expr y)
 
bool islessgreater (expr x, half y)
 
bool islessgreater (expr x, expr y)
 
bool isunordered (half x, half y)
 
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_caster< T, U >::type half_cast (U arg)
 
template<typename T , std::float_round_style R, typename U >
half_caster< T, U, R >::type half_cast (U arg)
 

Variables

HALF_CONSTEXPR_CONST binary_t binary = binary_t()
 Tag for binary construction. More...
 

Typedef Documentation

typedef unsigned short half_float::detail::uint16

Unsigned integer of (at least) 16 bits width.

typedef unsigned unsigned long ::type half_float::detail::uint32

Function Documentation

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

Absolute value.

Parameters
argoperand
Returns
absolute value of arg
expr half_float::detail::abs ( expr  arg)
inline
expr half_float::detail::acos ( half  arg)
inline

Arc cosine function.

Parameters
argfunction argument
Returns
arc cosine value of arg
expr half_float::detail::acos ( expr  arg)
inline
expr half_float::detail::acosh ( half  arg)
inline

Hyperbolic area cosine.

Parameters
argfunction argument
Returns
area cosine value of arg
expr half_float::detail::acosh ( expr  arg)
inline
expr half_float::detail::asin ( half  arg)
inline

Arc sine.

Parameters
argfunction argument
Returns
arc sine value of arg
expr half_float::detail::asin ( expr  arg)
inline
expr half_float::detail::asinh ( half  arg)
inline

Hyperbolic area sine.

Parameters
argfunction argument
Returns
area sine value of arg
expr half_float::detail::asinh ( expr  arg)
inline
expr half_float::detail::atan ( half  arg)
inline

Arc tangent function.

Parameters
argfunction argument
Returns
arc tangent value of arg
expr half_float::detail::atan ( expr  arg)
inline
expr half_float::detail::atan2 ( half  x,
half  y 
)
inline

Arc tangent function.

Parameters
xfirst argument
ysecond argument
Returns
arc tangent value
expr half_float::detail::atan2 ( half  x,
expr  y 
)
inline
expr half_float::detail::atan2 ( expr  x,
half  y 
)
inline
expr half_float::detail::atan2 ( expr  x,
expr  y 
)
inline
expr half_float::detail::atanh ( half  arg)
inline

Hyperbolic area tangent.

Parameters
argfunction argument
Returns
area tangent value of arg
expr half_float::detail::atanh ( expr  arg)
inline
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
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
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
expr half_float::detail::cbrt ( half  arg)
inline

Cubic root.

Parameters
argfunction argument
Returns
cubic root of arg
expr half_float::detail::cbrt ( expr  arg)
inline
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
half half_float::detail::ceil ( expr  arg)
inline
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
half half_float::detail::copysign ( half  x,
expr  y 
)
inline
half half_float::detail::copysign ( expr  x,
half  y 
)
inline
half half_float::detail::copysign ( expr  x,
expr  y 
)
inline
expr half_float::detail::cos ( half  arg)
inline

Cosine function.

Parameters
argfunction argument
Returns
cosine value of arg
expr half_float::detail::cos ( expr  arg)
inline
expr half_float::detail::cosh ( half  arg)
inline

Hyperbolic cosine.

Parameters
argfunction argument
Returns
hyperbolic cosine value of arg
expr half_float::detail::cosh ( expr  arg)
inline
expr half_float::detail::erf ( half  arg)
inline

Error function.

Parameters
argfunction argument
Returns
error function value of arg
expr half_float::detail::erf ( expr  arg)
inline
expr half_float::detail::erfc ( half  arg)
inline

Complementary error function.

Parameters
argfunction argument
Returns
1 minus error function value of arg
expr half_float::detail::erfc ( expr  arg)
inline
expr half_float::detail::exp ( half  arg)
inline

Exponential function.

Parameters
argfunction argument
Returns
e raised to arg
expr half_float::detail::exp ( expr  arg)
inline
expr half_float::detail::exp2 ( half  arg)
inline

Binary exponential.

Parameters
argfunction argument
Returns
2 raised to arg
expr half_float::detail::exp2 ( expr  arg)
inline
expr half_float::detail::expm1 ( half  arg)
inline

Exponential minus one.

Parameters
argfunction argument
Returns
e raised to arg subtracted by 1
expr half_float::detail::expm1 ( expr  arg)
inline
half half_float::detail::fabs ( half  arg)
inline

Absolute value.

Parameters
argoperand
Returns
absolute value of arg
expr half_float::detail::fabs ( expr  arg)
inline
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
expr half_float::detail::fdim ( half  x,
expr  y 
)
inline
expr half_float::detail::fdim ( expr  x,
half  y 
)
inline
expr half_float::detail::fdim ( expr  x,
expr  y 
)
inline
template<std::float_round_style R>
uint16 half_float::detail::float2half ( float  value)

Convert single-precision to half-precision.

Parameters
valuesingle-precision value
Returns
binary representation of half-precision value
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
template<std::float_round_style R>
uint16 half_float::detail::float2half_impl ( float  value,
false_type   
)

Convert non-IEEE single-precision to half-precision.

Parameters
valuesingle-precision value
Returns
binary representation of half-precision value
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
half half_float::detail::floor ( expr  arg)
inline
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.
expr half_float::detail::fma ( half  x,
half  y,
expr  z 
)
inline
expr half_float::detail::fma ( half  x,
expr  y,
half  z 
)
inline
expr half_float::detail::fma ( half  x,
expr  y,
expr  z 
)
inline
expr half_float::detail::fma ( expr  x,
half  y,
half  z 
)
inline
expr half_float::detail::fma ( expr  x,
half  y,
expr  z 
)
inline
expr half_float::detail::fma ( expr  x,
expr  y,
half  z 
)
inline
expr half_float::detail::fma ( expr  x,
expr  y,
expr  z 
)
inline
half half_float::detail::fmax ( half  x,
half  y 
)
inline

Maximum of half expressions.

Parameters
xfirst operand
ysecond operand
Returns
maximum of operands
expr half_float::detail::fmax ( half  x,
expr  y 
)
inline
expr half_float::detail::fmax ( expr  x,
half  y 
)
inline
expr half_float::detail::fmax ( expr  x,
expr  y 
)
inline
half half_float::detail::fmin ( half  x,
half  y 
)
inline

Minimum of half expressions.

Parameters
xfirst operand
ysecond operand
Returns
minimum of operands
expr half_float::detail::fmin ( half  x,
expr  y 
)
inline
expr half_float::detail::fmin ( expr  x,
half  y 
)
inline
expr half_float::detail::fmin ( expr  x,
expr  y 
)
inline
expr half_float::detail::fmod ( half  x,
half  y 
)
inline

Remainder of division.

Parameters
xfirst operand
ysecond operand
Returns
remainder of floating point division.
expr half_float::detail::fmod ( half  x,
expr  y 
)
inline
expr half_float::detail::fmod ( expr  x,
half  y 
)
inline
expr half_float::detail::fmod ( expr  x,
expr  y 
)
inline
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
int half_float::detail::fpclassify ( expr  arg)
inline
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)
half half_float::detail::frexp ( expr  arg,
int exp 
)
inline
float half_float::detail::half2float ( uint16  value)
inline

Convert half-precision to single-precision.

Parameters
valuebinary representation of half-precision value
Returns
single-precision value
float half_float::detail::half2float_impl ( uint16  value,
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
float half_float::detail::half2float_impl ( uint16  value,
false_type   
)
inline

Convert half-precision to non-IEEE single-precision.

Parameters
valuebinary representation of half-precision value
Returns
single-precision value
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
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
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
template<typename T , typename U >
half_caster<T,U>::type 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. Floating point types are converted via an explicit cast to/from float (using the rounding mode of the built-in single precision implementation) and thus any possible warnings due to an otherwise implicit conversion to/from float will be suppressed. Integer types 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
template<typename T , std::float_round_style R, typename U >
half_caster<T,U,R>::type 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. Floating point types are converted via an explicit cast to/from float (using the rounding mode of the built-in single precision implementation) and thus any possible warnings due to an otherwise implicit conversion to/from float will be suppressed. Integer types 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
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
expr half_float::detail::hypot ( half  x,
expr  y 
)
inline
expr half_float::detail::hypot ( expr  x,
half  y 
)
inline
expr half_float::detail::hypot ( expr  x,
expr  y 
)
inline
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
int half_float::detail::ilogb ( expr  arg)
inline
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
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
bool half_float::detail::isfinite ( half  arg)
inline

Check if finite number.

Parameters
argnumber to check
Return values
trueif neither infinity nor NaN
falseelse
bool half_float::detail::isfinite ( expr  arg)
inline
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
bool half_float::detail::isgreater ( half  x,
expr  y 
)
inline
bool half_float::detail::isgreater ( expr  x,
half  y 
)
inline
bool half_float::detail::isgreater ( expr  x,
expr  y 
)
inline
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
bool half_float::detail::isgreaterequal ( half  x,
expr  y 
)
inline
bool half_float::detail::isgreaterequal ( expr  x,
half  y 
)
inline
bool half_float::detail::isgreaterequal ( expr  x,
expr  y 
)
inline
bool half_float::detail::isinf ( half  arg)
inline

Check for infinity.

Parameters
argnumber to check
Return values
truefor positive or negative infinity
falseelse
bool half_float::detail::isinf ( expr  arg)
inline
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
bool half_float::detail::isless ( half  x,
expr  y 
)
inline
bool half_float::detail::isless ( expr  x,
half  y 
)
inline
bool half_float::detail::isless ( expr  x,
expr  y 
)
inline
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
bool half_float::detail::islessequal ( half  x,
expr  y 
)
inline
bool half_float::detail::islessequal ( expr  x,
half  y 
)
inline
bool half_float::detail::islessequal ( expr  x,
expr  y 
)
inline
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
bool half_float::detail::islessgreater ( half  x,
expr  y 
)
inline
bool half_float::detail::islessgreater ( expr  x,
half  y 
)
inline
bool half_float::detail::islessgreater ( expr  x,
expr  y 
)
inline
bool half_float::detail::isnan ( half  arg)
inline

Check for NaN.

Parameters
argnumber to check
Return values
truefor NaNs
falseelse
bool half_float::detail::isnan ( expr  arg)
inline
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
bool half_float::detail::isnormal ( expr  arg)
inline
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
bool half_float::detail::isunordered ( half  x,
expr  y 
)
inline
bool half_float::detail::isunordered ( expr  x,
half  y 
)
inline
bool half_float::detail::isunordered ( expr  x,
expr  y 
)
inline
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
half half_float::detail::ldexp ( expr  arg,
int  exp 
)
inline
expr half_float::detail::lgamma ( half  arg)
inline

Natural logarithm of gamma function.

Parameters
argfunction argument
Returns
natural logarith of gamma function for arg
expr half_float::detail::lgamma ( expr  arg)
inline
expr half_float::detail::log ( half  arg)
inline

Natural logorithm.

Parameters
argfunction argument
Returns
logarithm of arg to base e
expr half_float::detail::log ( expr  arg)
inline
expr half_float::detail::log10 ( half  arg)
inline

Common logorithm.

Parameters
argfunction argument
Returns
logarithm of arg to base 10
expr half_float::detail::log10 ( expr  arg)
inline
expr half_float::detail::log1p ( half  arg)
inline

Natural logorithm.

Parameters
argfunction argument
Returns
logarithm of arg plus 1 to base e
expr half_float::detail::log1p ( expr  arg)
inline
expr half_float::detail::log2 ( half  arg)
inline

Binary logorithm.

Parameters
argfunction argument
Returns
logarithm of arg to base 2
expr half_float::detail::log2 ( expr  arg)
inline
half half_float::detail::logb ( half  arg)
inline

Extract exponent.

Parameters
argnumber to query
Returns
floating point exponent
half half_float::detail::logb ( expr  arg)
inline
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
long half_float::detail::lrint ( expr  arg)
inline
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
long half_float::detail::lround ( expr  arg)
inline
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
half half_float::detail::modf ( expr  arg,
half iptr 
)
inline
half half_float::detail::nanh ( const char *  arg)
inline

Get NaN value.

Parameters
argdescriptive string (ignored)
Returns
quiet NaN
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
half half_float::detail::nearbyint ( expr  arg)
inline
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
half half_float::detail::nextafter ( half  from,
expr  to 
)
inline
half half_float::detail::nextafter ( expr  from,
half  to 
)
inline
half half_float::detail::nextafter ( expr  from,
expr  to 
)
inline
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
half half_float::detail::nexttoward ( expr  from,
long double  to 
)
inline
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
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
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
template<typename T >
HALF_CONSTEXPR enable<T,T>::type half_float::detail::operator+ ( arg)

Identity.

Parameters
argoperand
Returns
uncahnged operand
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
template<typename T >
HALF_CONSTEXPR enable<T,T>::type half_float::detail::operator- ( arg)

Negation.

Parameters
argoperand
Returns
negated operand
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
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
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
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
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
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
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
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
expr half_float::detail::pow ( half  base,
half  exp 
)
inline

Power function.

Parameters
basefirst argument
expsecond argument
Returns
base raised to exp
expr half_float::detail::pow ( half  base,
expr  exp 
)
inline
expr half_float::detail::pow ( expr  base,
half  exp 
)
inline
expr half_float::detail::pow ( expr  base,
expr  exp 
)
inline
expr half_float::detail::remainder ( half  x,
half  y 
)
inline

Remainder of division.

Parameters
xfirst operand
ysecond operand
Returns
remainder of floating point division.
expr half_float::detail::remainder ( half  x,
expr  y 
)
inline
expr half_float::detail::remainder ( expr  x,
half  y 
)
inline
expr half_float::detail::remainder ( expr  x,
expr  y 
)
inline
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.
expr half_float::detail::remquo ( half  x,
expr  y,
int quo 
)
inline
expr half_float::detail::remquo ( expr  x,
half  y,
int quo 
)
inline
expr half_float::detail::remquo ( expr  x,
expr  y,
int quo 
)
inline
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
half half_float::detail::rint ( expr  arg)
inline
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
half half_float::detail::round ( expr  arg)
inline
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
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
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
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
half half_float::detail::scalbln ( expr  arg,
long  exp 
)
inline
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
half half_float::detail::scalbn ( expr  arg,
int  exp 
)
inline
bool half_float::detail::signbit ( half  arg)
inline

Check sign.

Parameters
argnumber to check
Return values
truefor negative number
falsefor positive number
bool half_float::detail::signbit ( expr  arg)
inline
expr half_float::detail::sin ( half  arg)
inline

Sine function.

Parameters
argfunction argument
Returns
sine value of arg
expr half_float::detail::sin ( expr  arg)
inline
expr half_float::detail::sinh ( half  arg)
inline

Hyperbolic sine.

Parameters
argfunction argument
Returns
hyperbolic sine value of arg
expr half_float::detail::sinh ( expr  arg)
inline
expr half_float::detail::sqrt ( half  arg)
inline

Square root.

Parameters
argfunction argument
Returns
square root of arg
expr half_float::detail::sqrt ( expr  arg)
inline
expr half_float::detail::tan ( half  arg)
inline

Tangent function.

Parameters
argfunction argument
Returns
tangent value of arg
expr half_float::detail::tan ( expr  arg)
inline
expr half_float::detail::tanh ( half  arg)
inline

Hyperbolic tangent.

Parameters
argfunction argument
Returns
hyperbolic tangent value of arg
expr half_float::detail::tanh ( expr  arg)
inline
expr half_float::detail::tgamma ( half  arg)
inline

Gamma function.

Parameters
argfunction argument
Returns
gamma function value of arg
expr half_float::detail::tgamma ( expr  arg)
inline
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
half half_float::detail::trunc ( expr  arg)
inline

Variable Documentation

HALF_CONSTEXPR_CONST binary_t half_float::detail::binary = binary_t()

Tag for binary construction.