Implementation details. More...
Classes | |
struct | binary_specialized |
Wrapper for binary half-precision functions needing specialization for individual argument types. More... | |
struct | binary_specialized< half, half > |
struct | binary_t |
Tag type for binary construction. More... | |
struct | bits |
Type traits for floating point bits. More... | |
struct | bits< const T > |
struct | bits< const volatile T > |
struct | bits< double > |
Unsigned integer of (at least) 64 bits width. More... | |
struct | bits< float > |
Unsigned integer of (at least) 32 bits width. More... | |
struct | bits< volatile T > |
struct | bool_type |
Helper for tag dispatching. More... | |
struct | conditional |
Conditional type. More... | |
struct | conditional< false, T, F > |
struct | enable |
SFINAE helper for generic half-precision functions. More... | |
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 |
Temporary half-precision expression. More... | |
struct | functions |
Wrapper implementing unspecialized half-precision functions. More... | |
struct | half_caster |
Helper class for half casts. More... | |
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 |
Return type for specialized generic 2-argument half-precision functions. More... | |
struct | result< half, half > |
struct | unary_specialized |
Wrapper for unary half-precision functions needing specialization for individual argument types. More... | |
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... | |
Variables | |
const binary_t | binary = binary_t() |
Tag for binary construction. 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, false_type) |
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 > | |
T | half2float_impl (uint16 value, T,...) |
Convert half-precision to non-IEEE floating point. More... | |
template<typename T > | |
T | half2float (uint16 value) |
Convert half-precision to floating point. More... | |
template<std::float_round_style R, bool E, typename T > | |
T | half2int_impl (uint16 value) |
Convert half-precision floating point to integer. More... | |
template<std::float_round_style R, typename T > | |
T | half2int (uint16 value) |
Convert half-precision floating point to integer. More... | |
template<typename T > | |
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... | |
template<std::float_round_style R, typename T > | |
uint16 | float2half_impl (T value,...) |
Convert non-IEEE floating point to half-precision. More... | |
Implementation details.
typedef bool_type< true > half_float::detail::true_type |
typedef bool_type< false > half_float::detail::false_type |
typedef unsigned short half_float::detail::uint16 |
Unsigned integer of (at least) 16 bits width.
bool half_float::detail::builtin_isinf | ( | T | arg | ) |
Check for infinity.
T | argument type (builtin floating point type) |
arg | value to query |
true | if infinity |
false | else |
bool half_float::detail::builtin_isnan | ( | T | arg | ) |
Check for NaN.
T | argument type (builtin floating point type) |
arg | value to query |
true | if not a number |
false | else |
bool half_float::detail::builtin_signbit | ( | T | arg | ) |
Check sign.
T | argument type (builtin floating point type) |
arg | value to query |
true | if signbit set |
false | else |
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.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
value | single-precision value |
uint16 half_float::detail::float2half_impl | ( | double | value, |
true_type | |||
) |
Convert IEEE double-precision to half-precision.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
value | double-precision value |
uint16 half_float::detail::float2half_impl | ( | T | value, |
false_type | |||
) |
Convert non-IEEE floating point to half-precision.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
T | source type (builtin floating point type) |
value | floating point value |
uint16 half_float::detail::float2half | ( | T | value | ) |
Convert floating point to half-precision.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
T | source type (builtin floating point type) |
value | floating point value |
uint16 half_float::detail::int2half_impl | ( | T | value | ) |
Convert integer to half-precision floating point.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
S | true if value negative, false else |
T | type to convert (builtin integer type) |
value | non-negative integral value |
uint16 half_float::detail::int2half | ( | T | value | ) |
Convert integer to half-precision floating point.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
T | type to convert (builtin integer type) |
value | integral value |
Convert half-precision to IEEE single-precision.
Credit for this goes to Jeroen van der Zijp.
value | binary representation of half-precision value |
Convert half-precision to IEEE double-precision.
value | binary representation of half-precision value |
T half_float::detail::half2float_impl | ( | uint16 | value, |
T | , | ||
... | |||
) |
Convert half-precision to non-IEEE floating point.
T | type to convert to (builtin integer type) |
value | binary representation of half-precision value |
T half_float::detail::half2float | ( | uint16 | value | ) |
Convert half-precision to floating point.
T | type to convert to (builtin integer type) |
value | binary representation of half-precision value |
T half_float::detail::half2int_impl | ( | uint16 | value | ) |
Convert half-precision floating point to integer.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
E | true for round to even, false for round away from zero |
T | type to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits) |
value | binary representation of half-precision value |
R | rounding mode to use, std::round_indeterminate for fastest rounding |
E | true for round to even, false for round away from zero |
T | type to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits) |
value | binary representation of half-precision value |
T half_float::detail::half2int | ( | uint16 | value | ) |
Convert half-precision floating point to integer.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
T | type to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits) |
value | binary representation of half-precision value |
R | rounding mode to use, std::round_indeterminate for fastest rounding |
T | type to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits) |
value | binary representation of half-precision value |
T half_float::detail::half2int_up | ( | uint16 | value | ) |
Convert half-precision floating point to integer using round-to-nearest-away-from-zero.
T | type to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits) |
value | binary representation of half-precision value |
T | type to convert to (buitlin integer type with at least 16 bits precision, excluding any implicit sign bits) |
value | binary representation of half-precision value |
uint16 half_float::detail::round_half_impl | ( | uint16 | value | ) |
Round half-precision number to nearest integer value.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
E | true for round to even, false for round away from zero |
value | binary representation of half-precision value |
Round half-precision number to nearest integer value.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
value | binary representation of half-precision value |
Round half-precision number to nearest integer value using round-to-nearest-away-from-zero.
value | binary representation of half-precision value |
enable< bool, T, U >::type half_float::detail::operator== | ( | T | x, |
U | y | ||
) |
Comparison for equality.
x | first operand |
y | second operand |
true | if operands equal |
false | else |
enable< bool, T, U >::type half_float::detail::operator!= | ( | T | x, |
U | y | ||
) |
Comparison for inequality.
x | first operand |
y | second operand |
true | if operands not equal |
false | else |
enable< bool, T, U >::type half_float::detail::operator< | ( | T | x, |
U | y | ||
) |
Comparison for less than.
x | first operand |
y | second operand |
true | if x less than y |
false | else |
enable< bool, T, U >::type half_float::detail::operator> | ( | T | x, |
U | y | ||
) |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
enable< bool, T, U >::type half_float::detail::operator<= | ( | T | x, |
U | y | ||
) |
Comparison for less equal.
x | first operand |
y | second operand |
true | if x less equal y |
false | else |
enable< bool, T, U >::type half_float::detail::operator>= | ( | T | x, |
U | y | ||
) |
Comparison for greater equal.
x | first operand |
y | second operand |
true | if x greater equal y |
false | else |
enable< expr, T, U >::type half_float::detail::operator+ | ( | T | x, |
U | y | ||
) |
Add halfs.
x | left operand |
y | right operand |
enable< expr, T, U >::type half_float::detail::operator- | ( | T | x, |
U | y | ||
) |
Subtract halfs.
x | left operand |
y | right operand |
enable< expr, T, U >::type half_float::detail::operator* | ( | T | x, |
U | y | ||
) |
Multiply halfs.
x | left operand |
y | right operand |
enable< expr, T, U >::type half_float::detail::operator/ | ( | T | x, |
U | y | ||
) |
Divide halfs.
x | left operand |
y | right operand |
enable< T, T >::type half_float::detail::operator+ | ( | T | arg | ) |
Identity.
arg | operand |
enable< T, T >::type half_float::detail::operator- | ( | T | arg | ) |
Negation.
arg | operand |
enable< std::basic_ostream< charT, traits > &, T >::type half_float::detail::operator<< | ( | std::basic_ostream< charT, traits > & | out, |
T | arg | ||
) |
Output operator.
out | output stream to write into |
arg | half expression to write |
std::basic_istream< charT, traits > & half_float::detail::operator>> | ( | std::basic_istream< charT, traits > & | in, |
half & | arg | ||
) |
Input operator.
in | input stream to read from |
arg | half to read into |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Remainder of division.
x | first operand |
y | second operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Remainder of division.
x | first operand |
y | second operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Remainder of division.
x | first operand |
y | second operand |
quo | address to store some bits of quotient at |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Fused multiply add.
x | first operand |
y | second operand |
z | third operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Maximum of half expressions.
x | first operand |
y | second operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Minimum of half expressions.
x | first operand |
y | second operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Positive difference.
x | first operand |
y | second operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
Absolute value.
arg | operand |
|
inline |
Get NaN value.
Exponential function.
arg | function argument |
Exponential function.
arg | function argument |
Exponential minus one.
arg | function argument |
Exponential function.
arg | function argument |
Binary exponential.
arg | function argument |
Exponential function.
arg | function argument |
Natural logorithm.
arg | function argument |
Exponential function.
arg | function argument |
Common logorithm.
arg | function argument |
Exponential function.
arg | function argument |
Natural logorithm.
arg | function argument |
Exponential function.
arg | function argument |
Binary logorithm.
arg | function argument |
Exponential function.
arg | function argument |
Square root.
arg | function argument |
Square root.
arg | function argument |
Cubic root.
arg | function argument |
Square root.
arg | function argument |
Hypotenuse function.
x | first argument |
y | second argument |
Square root.
arg | function argument |
Square root.
arg | function argument |
Square root.
arg | function argument |
Power function.
base | first argument |
exp | second argument |
Square root.
arg | function argument |
Square root.
arg | function argument |
Square root.
arg | function argument |
Sine function.
arg | function argument |
Sine function.
arg | function argument |
Cosine function.
arg | function argument |
Sine function.
arg | function argument |
Tangent function.
arg | function argument |
Sine function.
arg | function argument |
Arc sine.
arg | function argument |
Sine function.
arg | function argument |
Arc cosine function.
arg | function argument |
Sine function.
arg | function argument |
Arc tangent function.
arg | function argument |
Sine function.
arg | function argument |
Arc tangent function.
x | first argument |
y | second argument |
Sine function.
arg | function argument |
Sine function.
arg | function argument |
Sine function.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Hyperbolic cosine.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Hyperbolic tangent.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Hyperbolic area sine.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Hyperbolic area cosine.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Hyperbolic area tangent.
arg | function argument |
Hyperbolic sine.
arg | function argument |
Error function.
arg | function argument |
Error function.
arg | function argument |
Complementary error function.
arg | function argument |
Error function.
arg | function argument |
Natural logarithm of gamma function.
arg | function argument |
Error function.
arg | function argument |
Gamma function.
arg | function argument |
Error function.
arg | function argument |
Nearest integer not less than half value.
arg | half to round |
Nearest integer not less than half value.
arg | half to round |
Nearest integer not greater than half value.
arg | half to round |
Nearest integer not less than half value.
arg | half to round |
Nearest integer not greater in magnitude than half value.
arg | half to round |
Nearest integer not less than half value.
arg | half to round |
Nearest integer.
arg | half to round |
Nearest integer not less than half value.
arg | half to round |
|
inline |
Nearest integer.
arg | half to round |
|
inline |
Nearest integer not less than half value.
arg | half to round |
Nearest integer using half's internal rounding mode.
arg | half expression to round |
Nearest integer not less than half value.
arg | half to round |
Nearest integer using half's internal rounding mode.
arg | half expression to round |
Nearest integer not less than half value.
arg | half to round |
|
inline |
Nearest integer using half's internal rounding mode.
arg | half expression to round |
|
inline |
Nearest integer not less than half value.
arg | half to round |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Multiply by power of two.
arg | number to modify |
exp | power of two to multiply with |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Extract integer and fractional parts.
arg | number to decompress |
iptr | address to store integer part at |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Multiply by power of two.
arg | number to modify |
exp | power of two to multiply with |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Multiply by power of two.
arg | number to modify |
exp | power of two to multiply with |
arg | number to modify |
exp | power of two to multiply with |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Extract exponent.
arg | number to query |
FP_ILOGB0 | for zero |
FP_ILOGBNAN | for NaN |
MAX_INT | for infinity |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Extract exponent.
arg | number to query |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Next representable value.
from | value to compute next representable value for |
to | direction towards which to compute next value |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Next representable value.
from | value to compute next representable value for |
to | direction towards which to compute next value |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Take sign.
x | value to change sign for |
y | value to take sign from |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Decompress floating point number.
arg | number to decompress |
exp | address to store exponent at |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
|
inline |
Check if finite number.
arg | number to check |
true | if neither infinity nor NaN |
false | else |
|
inline |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
|
inline |
Check for infinity.
arg | number to check |
true | for positive or negative infinity |
false | else |
|
inline |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
|
inline |
Check for NaN.
arg | number to check |
true | for NaNs |
false | else |
|
inline |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
|
inline |
Check if normal number.
arg | number to check |
true | if normal number |
false | if either subnormal, zero, infinity or NaN |
|
inline |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
|
inline |
Check sign.
arg | number to check |
true | for negative number |
false | for positive number |
|
inline |
Classify floating point value.
arg | number to classify |
FP_ZERO | for positive and negative zero |
FP_SUBNORMAL | for subnormal numbers |
FP_INFINITY | for positive and negative infinity |
FP_NAN | for NaNs |
FP_NORMAL | for all other (normal) values |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater equal.
x | first operand |
y | second operand |
true | if x greater equal y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for less than.
x | first operand |
y | second operand |
true | if x less than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for less equal.
x | first operand |
y | second operand |
true | if x less equal y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comarison for less or greater.
x | first operand |
y | second operand |
true | if either less or greater |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Check if unordered.
x | first operand |
y | second operand |
true | if unordered (one or two NaN operands) |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
Comparison for greater than.
x | first operand |
y | second operand |
true | if x greater than y |
false | else |
T half_float::detail::half_cast | ( | U | 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.
T | destination type (half or built-in arithmetic type) |
U | source type (half or built-in arithmetic type) |
arg | value to cast |
T half_float::detail::half_cast | ( | U | 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.
T | destination type (half or built-in arithmetic type) |
R | rounding mode to use. |
U | source type (half or built-in arithmetic type) |
arg | value to cast |
uint16 half_float::detail::float2half_impl | ( | T | value, |
... | |||
) |
Convert non-IEEE floating point to half-precision.
R | rounding mode to use, std::round_indeterminate for fastest rounding |
T | source type (builtin floating point type) |
value | floating point value |