![]() |
GlobeEngine
|
#include <utility>#include <algorithm>#include <iostream>#include <limits>#include <climits>#include <cmath>#include <cstring>Go to the source code of this file.
Namespaces | |
| half_float | |
| half_float::detail | |
| std | |
| Extensions to the C++ standard library. | |
Macros | |
| #define | HALF_GNUC_VERSION (__GNUC__*100+__GNUC_MINOR__) |
| Combined gcc version number. More... | |
| #define | HALF_CONSTEXPR |
| #define | HALF_CONSTEXPR_CONST const |
| #define | HALF_NOEXCEPT |
| #define | HALF_NOTHROW throw() |
| #define | HALF_ROUND_STYLE -1 |
| #define | HALF_ROUND_TIES_TO_EVEN 0 |
| #define | HUGE_VALH std::numeric_limits<half_float::half>::infinity() |
| #define | FP_FAST_FMAH 1 |
| #define | FP_ILOGB0 INT_MIN |
| #define | FP_ILOGBNAN INT_MAX |
| #define | FP_SUBNORMAL 0 |
| #define | FP_ZERO 1 |
| #define | FP_NAN 2 |
| #define | FP_INFINITE 3 |
| #define | FP_NORMAL 4 |
Typedefs | |
| 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. More... | |
| typedef unsigned | half_float::detail::int |
| typedef unsigned unsigned long::type | half_float::detail::uint32 |
| typedef long::type | half_float::detail::int17 |
Functions | |
Classification helpers | |
| template<typename T > | |
| bool | half_float::detail::builtin_isinf (T arg) |
| template<typename T > | |
| bool | half_float::detail::builtin_isnan (T arg) |
| template<typename T > | |
| bool | half_float::detail::builtin_signbit (T arg) |
Conversion | |
| template<std::float_round_style R> | |
| uint16 | half_float::detail::float2half_impl (float value, true_type) |
| template<std::float_round_style R> | |
| uint16 | half_float::detail::float2half_impl (float value, false_type) |
| template<std::float_round_style R> | |
| uint16 | half_float::detail::float2half (float value) |
| template<std::float_round_style R, bool S, typename T > | |
| uint16 | half_float::detail::int2half_impl (T value) |
| template<std::float_round_style R, typename T > | |
| uint16 | half_float::detail::int2half (T value) |
| float | half_float::detail::half2float_impl (uint16 value, true_type) |
| float | half_float::detail::half2float_impl (uint16 value, false_type) |
| float | half_float::detail::half2float (uint16 value) |
| template<std::float_round_style R, bool E, typename T > | |
| T | half_float::detail::half2int_impl (uint16 value) |
| template<std::float_round_style R, typename T > | |
| T | half_float::detail::half2int (uint16 value) |
| template<typename T > | |
| T | half_float::detail::half2int_up (uint16 value) |
| template<std::float_round_style R, bool E> | |
| uint16 | half_float::detail::round_half_impl (uint16 value) |
| template<std::float_round_style R> | |
| uint16 | half_float::detail::round_half (uint16 value) |
| uint16 | half_float::detail::round_half_up (uint16 value) |
Comparison operators | |
| template<typename T , typename U > | |
| enable< bool, T, U >::type | half_float::detail::operator== (T x, U y) |
| template<typename T , typename U > | |
| enable< bool, T, U >::type | half_float::detail::operator!= (T x, U y) |
| template<typename T , typename U > | |
| enable< bool, T, U >::type | half_float::detail::operator< (T x, U y) |
| template<typename T , typename U > | |
| enable< bool, T, U >::type | half_float::detail::operator> (T x, U y) |
| template<typename T , typename U > | |
| enable< bool, T, U >::type | half_float::detail::operator<= (T x, U y) |
| template<typename T , typename U > | |
| enable< bool, T, U >::type | half_float::detail::operator>= (T x, U y) |
Arithmetic operators | |
| template<typename T , typename U > | |
| enable< expr, T, U >::type | half_float::detail::operator+ (T x, U y) |
| template<typename T , typename U > | |
| enable< expr, T, U >::type | half_float::detail::operator- (T x, U y) |
| template<typename T , typename U > | |
| enable< expr, T, U >::type | half_float::detail::operator* (T x, U y) |
| template<typename T , typename U > | |
| enable< expr, T, U >::type | half_float::detail::operator/ (T x, U y) |
| template<typename T > | |
| HALF_CONSTEXPR enable< T, T >::type | half_float::detail::operator+ (T arg) |
| template<typename T > | |
| HALF_CONSTEXPR enable< T, T >::type | half_float::detail::operator- (T arg) |
Input and output | |
| 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, T arg) |
| template<typename charT , typename traits > | |
| std::basic_istream< charT, traits > & | half_float::detail::operator>> (std::basic_istream< charT, traits > &in, half &arg) |
Basic mathematical operations | |
| half | half_float::detail::abs (half arg) |
| expr | half_float::detail::abs (expr arg) |
| half | half_float::detail::fabs (half arg) |
| expr | half_float::detail::fabs (expr arg) |
| expr | half_float::detail::fmod (half x, half y) |
| expr | half_float::detail::fmod (half x, expr y) |
| expr | half_float::detail::fmod (expr x, half y) |
| expr | half_float::detail::fmod (expr x, expr y) |
| expr | half_float::detail::remainder (half x, half y) |
| expr | half_float::detail::remainder (half x, expr y) |
| expr | half_float::detail::remainder (expr x, half y) |
| expr | half_float::detail::remainder (expr x, expr y) |
| expr | half_float::detail::remquo (half x, half y, int *quo) |
| expr | half_float::detail::remquo (half x, expr y, int *quo) |
| expr | half_float::detail::remquo (expr x, half y, int *quo) |
| expr | half_float::detail::remquo (expr x, expr y, int *quo) |
| expr | half_float::detail::fma (half x, half y, half z) |
| expr | half_float::detail::fma (half x, half y, expr z) |
| expr | half_float::detail::fma (half x, expr y, half z) |
| expr | half_float::detail::fma (half x, expr y, expr z) |
| expr | half_float::detail::fma (expr x, half y, half z) |
| expr | half_float::detail::fma (expr x, half y, expr z) |
| expr | half_float::detail::fma (expr x, expr y, half z) |
| expr | half_float::detail::fma (expr x, expr y, expr z) |
| half | half_float::detail::fmax (half x, half y) |
| expr | half_float::detail::fmax (half x, expr y) |
| expr | half_float::detail::fmax (expr x, half y) |
| expr | half_float::detail::fmax (expr x, expr y) |
| half | half_float::detail::fmin (half x, half y) |
| expr | half_float::detail::fmin (half x, expr y) |
| expr | half_float::detail::fmin (expr x, half y) |
| expr | half_float::detail::fmin (expr x, expr y) |
| expr | half_float::detail::fdim (half x, half y) |
| expr | half_float::detail::fdim (half x, expr y) |
| expr | half_float::detail::fdim (expr x, half y) |
| expr | half_float::detail::fdim (expr x, expr y) |
| half | half_float::detail::nanh (const char *arg) |
Exponential functions | |
| expr | half_float::detail::exp (half arg) |
| expr | half_float::detail::exp (expr arg) |
| expr | half_float::detail::expm1 (half arg) |
| expr | half_float::detail::expm1 (expr arg) |
| expr | half_float::detail::exp2 (half arg) |
| expr | half_float::detail::exp2 (expr arg) |
| expr | half_float::detail::log (half arg) |
| expr | half_float::detail::log (expr arg) |
| expr | half_float::detail::log10 (half arg) |
| expr | half_float::detail::log10 (expr arg) |
| expr | half_float::detail::log1p (half arg) |
| expr | half_float::detail::log1p (expr arg) |
| expr | half_float::detail::log2 (half arg) |
| expr | half_float::detail::log2 (expr arg) |
Power functions | |
| expr | half_float::detail::sqrt (half arg) |
| expr | half_float::detail::sqrt (expr arg) |
| expr | half_float::detail::cbrt (half arg) |
| expr | half_float::detail::cbrt (expr arg) |
| expr | half_float::detail::hypot (half x, half y) |
| expr | half_float::detail::hypot (half x, expr y) |
| expr | half_float::detail::hypot (expr x, half y) |
| expr | half_float::detail::hypot (expr x, expr y) |
| expr | half_float::detail::pow (half base, half exp) |
| expr | half_float::detail::pow (half base, expr exp) |
| expr | half_float::detail::pow (expr base, half exp) |
| expr | half_float::detail::pow (expr base, expr exp) |
Trigonometric functions | |
| expr | half_float::detail::sin (half arg) |
| expr | half_float::detail::sin (expr arg) |
| expr | half_float::detail::cos (half arg) |
| expr | half_float::detail::cos (expr arg) |
| expr | half_float::detail::tan (half arg) |
| expr | half_float::detail::tan (expr arg) |
| expr | half_float::detail::asin (half arg) |
| expr | half_float::detail::asin (expr arg) |
| expr | half_float::detail::acos (half arg) |
| expr | half_float::detail::acos (expr arg) |
| expr | half_float::detail::atan (half arg) |
| expr | half_float::detail::atan (expr arg) |
| expr | half_float::detail::atan2 (half x, half y) |
| expr | half_float::detail::atan2 (half x, expr y) |
| expr | half_float::detail::atan2 (expr x, half y) |
| expr | half_float::detail::atan2 (expr x, expr y) |
Hyperbolic functions | |
| expr | half_float::detail::sinh (half arg) |
| expr | half_float::detail::sinh (expr arg) |
| expr | half_float::detail::cosh (half arg) |
| expr | half_float::detail::cosh (expr arg) |
| expr | half_float::detail::tanh (half arg) |
| expr | half_float::detail::tanh (expr arg) |
| expr | half_float::detail::asinh (half arg) |
| expr | half_float::detail::asinh (expr arg) |
| expr | half_float::detail::acosh (half arg) |
| expr | half_float::detail::acosh (expr arg) |
| expr | half_float::detail::atanh (half arg) |
| expr | half_float::detail::atanh (expr arg) |
Error and gamma functions | |
| expr | half_float::detail::erf (half arg) |
| expr | half_float::detail::erf (expr arg) |
| expr | half_float::detail::erfc (half arg) |
| expr | half_float::detail::erfc (expr arg) |
| expr | half_float::detail::lgamma (half arg) |
| expr | half_float::detail::lgamma (expr arg) |
| expr | half_float::detail::tgamma (half arg) |
| expr | half_float::detail::tgamma (expr arg) |
Rounding | |
| half | half_float::detail::ceil (half arg) |
| half | half_float::detail::ceil (expr arg) |
| half | half_float::detail::floor (half arg) |
| half | half_float::detail::floor (expr arg) |
| half | half_float::detail::trunc (half arg) |
| half | half_float::detail::trunc (expr arg) |
| half | half_float::detail::round (half arg) |
| half | half_float::detail::round (expr arg) |
| long | half_float::detail::lround (half arg) |
| long | half_float::detail::lround (expr arg) |
| half | half_float::detail::nearbyint (half arg) |
| half | half_float::detail::nearbyint (expr arg) |
| half | half_float::detail::rint (half arg) |
| half | half_float::detail::rint (expr arg) |
| long | half_float::detail::lrint (half arg) |
| long | half_float::detail::lrint (expr arg) |
Floating point manipulation | |
| half | half_float::detail::frexp (half arg, int *exp) |
| half | half_float::detail::frexp (expr arg, int *exp) |
| half | half_float::detail::ldexp (half arg, int exp) |
| half | half_float::detail::ldexp (expr arg, int exp) |
| half | half_float::detail::modf (half arg, half *iptr) |
| half | half_float::detail::modf (expr arg, half *iptr) |
| half | half_float::detail::scalbn (half arg, int exp) |
| half | half_float::detail::scalbn (expr arg, int exp) |
| half | half_float::detail::scalbln (half arg, long exp) |
| half | half_float::detail::scalbln (expr arg, long exp) |
| int | half_float::detail::ilogb (half arg) |
| int | half_float::detail::ilogb (expr arg) |
| half | half_float::detail::logb (half arg) |
| half | half_float::detail::logb (expr arg) |
| half | half_float::detail::nextafter (half from, half to) |
| half | half_float::detail::nextafter (half from, expr to) |
| half | half_float::detail::nextafter (expr from, half to) |
| half | half_float::detail::nextafter (expr from, expr to) |
| half | half_float::detail::nexttoward (half from, long double to) |
| half | half_float::detail::nexttoward (expr from, long double to) |
| half | half_float::detail::copysign (half x, half y) |
| half | half_float::detail::copysign (half x, expr y) |
| half | half_float::detail::copysign (expr x, half y) |
| half | half_float::detail::copysign (expr x, expr y) |
Floating point classification | |
| int | half_float::detail::fpclassify (half arg) |
| int | half_float::detail::fpclassify (expr arg) |
| bool | half_float::detail::isfinite (half arg) |
| bool | half_float::detail::isfinite (expr arg) |
| bool | half_float::detail::isinf (half arg) |
| bool | half_float::detail::isinf (expr arg) |
| bool | half_float::detail::isnan (half arg) |
| bool | half_float::detail::isnan (expr arg) |
| bool | half_float::detail::isnormal (half arg) |
| bool | half_float::detail::isnormal (expr arg) |
| bool | half_float::detail::signbit (half arg) |
| bool | half_float::detail::signbit (expr arg) |
Comparison | |
| bool | half_float::detail::isgreater (half x, half y) |
| bool | half_float::detail::isgreater (half x, expr y) |
| bool | half_float::detail::isgreater (expr x, half y) |
| bool | half_float::detail::isgreater (expr x, expr y) |
| bool | half_float::detail::isgreaterequal (half x, half y) |
| bool | half_float::detail::isgreaterequal (half x, expr y) |
| bool | half_float::detail::isgreaterequal (expr x, half y) |
| bool | half_float::detail::isgreaterequal (expr x, expr y) |
| bool | half_float::detail::isless (half x, half y) |
| bool | half_float::detail::isless (half x, expr y) |
| bool | half_float::detail::isless (expr x, half y) |
| bool | half_float::detail::isless (expr x, expr y) |
| bool | half_float::detail::islessequal (half x, half y) |
| bool | half_float::detail::islessequal (half x, expr y) |
| bool | half_float::detail::islessequal (expr x, half y) |
| bool | half_float::detail::islessequal (expr x, expr y) |
| bool | half_float::detail::islessgreater (half x, half y) |
| bool | half_float::detail::islessgreater (half x, expr y) |
| bool | half_float::detail::islessgreater (expr x, half y) |
| bool | half_float::detail::islessgreater (expr x, expr y) |
| bool | half_float::detail::isunordered (half x, half y) |
| bool | half_float::detail::isunordered (half x, expr y) |
| bool | half_float::detail::isunordered (expr x, half y) |
| bool | half_float::detail::isunordered (expr x, expr y) |
Casting | |
| template<typename T , typename U > | |
| half_caster< T, U >::type | half_float::detail::half_cast (U arg) |
| template<typename T , std::float_round_style R, typename U > | |
| half_caster< T, U, R >::type | half_float::detail::half_cast (U arg) |
Variables | |
| HALF_CONSTEXPR_CONST binary_t | half_float::detail::binary = binary_t() |
| Tag for binary construction. More... | |
Main header file for half precision functionality.
| #define FP_FAST_FMAH 1 |
Fast half-precision fma function. This symbol is only defined if the fma() function generally executes as fast as, or faster than, a separate half-precision multiplication followed by an addition. Due to the internal single-precision implementation of all arithmetic operations, this is in fact always the case.
| #define FP_ILOGB0 INT_MIN |
| #define FP_ILOGBNAN INT_MAX |
| #define FP_INFINITE 3 |
| #define FP_NAN 2 |
| #define FP_NORMAL 4 |
| #define FP_SUBNORMAL 0 |
| #define FP_ZERO 1 |
| #define HALF_CONSTEXPR |
| #define HALF_CONSTEXPR_CONST const |
| #define HALF_GNUC_VERSION (__GNUC__*100+__GNUC_MINOR__) |
Combined gcc version number.
| #define HALF_NOEXCEPT |
| #define HALF_NOTHROW throw() |
| #define HALF_ROUND_STYLE -1 |
Default rounding mode. This specifies the rounding mode used for all conversions between halfs and floats as well as for the half_cast() if not specifying a rounding mode explicitly. It can be redefined (before including half.hpp) to one of the standard rounding modes using their respective constants or the equivalent values of std::float_round_style:
std::float_round_style | value | rounding |
|---|---|---|
std::round_indeterminate | -1 | fastest (default) |
std::round_toward_zero | 0 | toward zero |
std::round_to_nearest | 1 | to nearest |
std::round_toward_infinity | 2 | toward positive infinity |
std::round_toward_neg_infinity | 3 | toward negative infinity |
By default this is set to -1 (std::round_indeterminate), which uses truncation (round toward zero, but with overflows set to infinity) and is the fastest rounding mode possible. It can even be set to std::numeric_limits<float>::round_style to synchronize the rounding mode with that of the underlying single-precision implementation.
| #define HALF_ROUND_TIES_TO_EVEN 0 |
Tie-breaking behaviour for round to nearest. This specifies if ties in round to nearest should be resolved by rounding to the nearest even value. By default this is defined to 0 resulting in the faster but slightly more biased behaviour of rounding away from zero in half-way cases (and thus equal to the round() function), but can be redefined to 1 (before including half.hpp) if more IEEE-conformant behaviour is needed.
| #define HUGE_VALH std::numeric_limits<half_float::half>::infinity() |
Value signaling overflow. In correspondence with HUGE_VAL[F|L] from <cmath> this symbol expands to a positive value signaling the overflow of an operation, in particular it just evaluates to positive infinity.