NVIDIA DeepStream SDK API Reference

9.2 Release
half_float Namespace Reference

Detailed Description

Main namespace for half-precision functionality.

This namespace contains all the functionality provided by the library.

Namespaces

 detail
 

Data Structures

class  half
 Half-precision floating-point type. More...
 

Function Documentation

◆ abs()

◆ acos()

half half_float::acos ( half  arg)
inline

Arc cosine function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::acos.

Parameters
argfunction argument
Returns
arc cosine value of arg
Exceptions
FE_INVALIDfor signaling NaN or if abs(arg) > 1
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3700 of file includes/half.hpp.

References abs(), half_float::detail::atan2(), half_float::detail::atan2_args(), half_float::detail::binary, half_float::detail::invalid(), and half_float::detail::signal().

◆ acosh()

half half_float::acosh ( half  arg)
inline

Hyperbolic area cosine.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::acosh.

Parameters
argfunction argument
Returns
area cosine value of arg
Exceptions
FE_INVALIDfor signaling NaN or arguments <1
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3925 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::invalid(), and half_float::detail::signal().

◆ asin()

half half_float::asin ( half  arg)
inline

Arc sine.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::asin.

Parameters
argfunction argument
Returns
arc sine value of arg
Exceptions
FE_INVALIDfor signaling NaN or if abs(arg) > 1
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3671 of file includes/half.hpp.

References abs(), half_float::detail::atan2(), half_float::detail::atan2_args(), half_float::detail::binary, half_float::detail::invalid(), and half_float::detail::signal().

◆ asinh()

half half_float::asinh ( half  arg)
inline

Hyperbolic area sine.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::asinh.

Parameters
argfunction argument
Returns
area sine value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3897 of file includes/half.hpp.

References abs(), half_float::detail::binary, and half_float::detail::signal().

◆ atan()

half half_float::atan ( half  arg)
inline

Arc tangent function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::atan.

Parameters
argfunction argument
Returns
arc tangent value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3725 of file includes/half.hpp.

References abs(), half_float::detail::atan2(), half_float::detail::binary, exp(), and half_float::detail::signal().

Referenced by TrackerVizOutput::drawUncertaintyEllipse(), rs2_deproject_pixel_to_point(), and rs2_project_point_to_pixel().

◆ atan2()

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

Arc tangent function.

This function may be 1 ULP off the correctly rounded exact result in ~0.005% of inputs for std::round_to_nearest, in ~0.1% of inputs for std::round_toward_zero and in ~0.02% of inputs for any other rounding mode.

See also: Documentation for std::atan2.

Parameters
ynumerator
xdenominator
Returns
arc tangent value
Exceptions
FE_INVALIDif x or y is signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3755 of file includes/half.hpp.

References half_float::detail::atan2(), half_float::detail::binary, and half_float::detail::signal().

◆ atanh()

half half_float::atanh ( half  arg)
inline

Hyperbolic area tangent.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::atanh.

Parameters
argfunction argument
Returns
area tangent value of arg
Exceptions
FE_INVALIDfor signaling NaN or if abs(arg) > 1
FE_DIVBYZEROfor +/-1
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3950 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::divide64(), exp(), half_float::detail::invalid(), half_float::detail::log2(), half_float::detail::pole(), and half_float::detail::signal().

◆ cbrt()

half half_float::cbrt ( half  arg)
inline

Cubic root.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::cbrt.

Parameters
argfunction argument
Returns
cubic root of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_INEXACTaccording to rounding

Definition at line 3281 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::divide64(), exp(), half_float::detail::exp2(), half_float::detail::multiply64(), half_float::detail::sign_mask(), and half_float::detail::signal().

◆ ceil()

half half_float::ceil ( half  arg)
inline

Nearest integer not less than half value.

See also: Documentation for std::ceil.

Parameters
arghalf to round
Returns
nearest integer not less than arg
Exceptions
FE_INVALIDfor signaling NaN
FE_INEXACTif value had to be rounded

Definition at line 4088 of file includes/half.hpp.

References half_float::detail::binary.

◆ copysign()

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

Take sign.

See also: Documentation for std::copysign.

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 4359 of file includes/half.hpp.

References half_float::detail::binary.

◆ cos()

half half_float::cos ( half  arg)
inline

Cosine function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::cos.

Parameters
argfunction argument
Returns
cosine value of arg
Exceptions
FE_INVALIDfor signaling NaN or infinity
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3606 of file includes/half.hpp.

References abs(), half_float::detail::angle_arg(), half_float::detail::binary, half_float::detail::invalid(), half_float::detail::signal(), and half_float::detail::sincos().

Referenced by TrackerVizOutput::drawUncertaintyEllipse(), CV_FUNCS::getHanningWindow(), and sincos().

◆ cosh()

half half_float::cosh ( half  arg)
inline

Hyperbolic cosine.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::cosh.

Parameters
argfunction argument
Returns
hyperbolic cosine value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3838 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::hyperbolic_args(), and half_float::detail::signal().

◆ erf()

half half_float::erf ( half  arg)
inline

Error function.

This function may be 1 ULP off the correctly rounded exact result for any rounding mode in <0.5% of inputs.

See also: Documentation for std::erf.

Parameters
argfunction argument
Returns
error function value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3983 of file includes/half.hpp.

References abs(), half_float::detail::binary, and half_float::detail::signal().

◆ erfc()

half half_float::erfc ( half  arg)
inline

Complementary error function.

This function may be 1 ULP off the correctly rounded exact result for any rounding mode in <0.5% of inputs.

See also: Documentation for std::erfc.

Parameters
argfunction argument
Returns
1 minus error function value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4005 of file includes/half.hpp.

References abs(), half_float::detail::binary, and half_float::detail::signal().

◆ exp()

◆ exp2()

half half_float::exp2 ( half  arg)
inline

Binary exponential.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::exp2.

Parameters
argfunction argument
Returns
2 raised to arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 2988 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), and half_float::detail::signal().

◆ expm1()

half half_float::expm1 ( half  arg)
inline

Exponential minus one.

This function may be 1 ULP off the correctly rounded exact result in <0.05% of inputs for std::round_to_nearest and in <1% of inputs for any other rounding mode.

See also: Documentation for std::expm1.

Parameters
argfunction argument
Returns
e raised to arg and subtracted by 1
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3014 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::divide64(), exp(), half_float::detail::exp2(), half_float::detail::multiply64(), and half_float::detail::signal().

◆ fabs()

HALF_CONSTEXPR half half_float::fabs ( half  arg)
inline

Absolute value.

See also: Documentation for std::fabs.

Parameters
argoperand
Returns
absolute value of arg

Definition at line 2746 of file includes/half.hpp.

References half_float::detail::binary.

Referenced by abs(), nextafter(), and nexttoward().

◆ fdim()

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

Positive difference.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::fdim.

Parameters
xfirst operand
ysecond operand
Returns
x - y or 0 if difference negative
Exceptions
FE_...according to operator-(half,half)

Definition at line 2921 of file includes/half.hpp.

References half_float::detail::binary, isnan(), and half_float::detail::signal().

◆ feclearexcept()

int half_float::feclearexcept ( int  excepts)
inline

Clear exception flags.

This function works even if automatic exception flag handling is disabled, but in that case manual flag management is the only way to raise flags.

See also: Documentation for std::feclearexcept.

Parameters
exceptsOR of exceptions to clear
Return values
0all selected flags cleared successfully

Definition at line 4535 of file includes/half.hpp.

References half_float::detail::errflags().

◆ fegetexceptflag()

int half_float::fegetexceptflag ( int *  flagp,
int  excepts 
)
inline

Save exception flags.

This function works even if automatic exception flag handling is disabled, but in that case manual flag management is the only way to raise flags.

See also: Documentation for std::fegetexceptflag.

Parameters
flagpadress to store flag state at
exceptsOR of flags to save
Return values
0for success

Definition at line 4565 of file includes/half.hpp.

References half_float::detail::errflags().

◆ feraiseexcept()

int half_float::feraiseexcept ( int  excepts)
inline

Raise exception flags.

This raises the specified floating point exceptions and also invokes any additional automatic exception handling as configured with the HALF_ERRHANDLIG_... preprocessor symbols. This function works even if automatic exception flag handling is disabled, but in that case manual flag management is the only way to raise flags.

See also: Documentation for std::feraiseexcept.

Parameters
exceptsOR of exceptions to raise
Return values
0all selected exceptions raised successfully

Definition at line 4555 of file includes/half.hpp.

References half_float::detail::errflags(), and half_float::detail::raise().

Referenced by half_float::detail::raise().

◆ fesetexceptflag()

int half_float::fesetexceptflag ( const int *  flagp,
int  excepts 
)
inline

Restore exception flags.

This only copies the specified exception state (including unset flags) without incurring any additional exception handling. This function works even if automatic exception flag handling is disabled, but in that case manual flag management is the only way to raise flags.

See also: Documentation for std::fesetexceptflag.

Parameters
flagpadress to take flag state from
exceptsOR of flags to restore
Return values
0for success

Definition at line 4576 of file includes/half.hpp.

References half_float::detail::errflags().

◆ fetestexcept()

int half_float::fetestexcept ( int  excepts)
inline

Test exception flags.

This function works even if automatic exception flag handling is disabled, but in that case manual flag management is the only way to raise flags.

See also: Documentation for std::fetestexcept.

Parameters
exceptsOR of exceptions to test
Returns
OR of selected exceptions if raised

Definition at line 4544 of file includes/half.hpp.

References half_float::detail::errflags().

◆ fethrowexcept()

void half_float::fethrowexcept ( int  excepts,
const char *  msg = "" 
)
inline

Throw C++ exceptions based on set exception flags.

This function manually throws a corresponding C++ exception if one of the specified flags is set, no matter if automatic throwing (via HALF_ERRHANDLING_THROW_...) is enabled or not. This function works even if automatic exception flag handling is disabled, but in that case manual flag management is the only way to raise flags.

Parameters
exceptsOR of exceptions to test
msgerror message to use for exception description
Exceptions
std::domain_errorif FE_INVALID or FE_DIVBYZERO is selected and set
std::overflow_errorif FE_OVERFLOW is selected and set
std::underflow_errorif FE_UNDERFLOW is selected and set
std::range_errorif FE_INEXACT is selected and set

Definition at line 4589 of file includes/half.hpp.

References half_float::detail::errflags(), FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, and FE_UNDERFLOW.

◆ floor()

half half_float::floor ( half  arg)
inline

Nearest integer not greater than half value.

See also: Documentation for std::floor.

Parameters
arghalf to round
Returns
nearest integer not greater than arg
Exceptions
FE_INVALIDfor signaling NaN
FE_INEXACTif value had to be rounded

Definition at line 4096 of file includes/half.hpp.

References half_float::detail::binary.

◆ fma()

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

Fused multiply add.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::fma.

Parameters
xfirst operand
ysecond operand
zthird operand
Returns
( x * y ) + z rounded as one operation.
Exceptions
FE_INVALIDaccording to operator*() and operator+() unless any argument is a quiet NaN and no argument is a signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding the final addition

Definition at line 2826 of file includes/half.hpp.

References half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::signal(), and absl::swap_internal::swap().

◆ fmax()

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

Maximum of half expressions.

See also: Documentation for std::fmax.

Parameters
xfirst operand
ysecond operand
Returns
maximum of operands, ignoring quiet NaNs
Exceptions
FE_INVALIDif x or y is signaling NaN

Definition at line 2895 of file includes/half.hpp.

References half_float::detail::binary, isnan(), and half_float::detail::select().

◆ fmin()

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

Minimum of half expressions.

See also: Documentation for std::fmin.

Parameters
xfirst operand
ysecond operand
Returns
minimum of operands, ignoring quiet NaNs
Exceptions
FE_INVALIDif x or y is signaling NaN

Definition at line 2907 of file includes/half.hpp.

References half_float::detail::binary, isnan(), and half_float::detail::select().

◆ fmod()

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

Remainder of division.

See also: Documentation for std::fmod.

Parameters
xfirst operand
ysecond operand
Returns
remainder of floating-point division.
Exceptions
FE_INVALIDif x is infinite or y is 0 or if x or y is signaling NaN

Definition at line 2760 of file includes/half.hpp.

References half_float::detail::binary, half_float::detail::invalid(), and half_float::detail::signal().

◆ fpclassify()

HALF_CONSTEXPR int half_float::fpclassify ( half  arg)
inline

Classify floating-point value.

See also: Documentation for std::fpclassify.

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 4374 of file includes/half.hpp.

References FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, and FP_ZERO.

◆ frexp()

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

Decompress floating-point number.

See also: Documentation for std::frexp.

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

Definition at line 4171 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), and half_float::detail::signal().

Referenced by half_float::detail::float2half_impl().

◆ half_cast() [1/2]

template<typename T , typename U >
T half_float::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 default 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 returns the argument unmodified.

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
Exceptions
FE_INVALIDif T is integer type and result is not representable as T
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4504 of file includes/half.hpp.

◆ half_cast() [2/2]

template<typename T , std::float_round_style R, typename U >
T half_float::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 specified 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 returns the argument unmodified.

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
Exceptions
FE_INVALIDif T is integer type and result is not representable as T
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4520 of file includes/half.hpp.

◆ hypot() [1/2]

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

Hypotenuse function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::hypot.

Parameters
xfirst argument
ysecond argument
Returns
square root of sum of squares without internal over- or underflows
Exceptions
FE_INVALIDif x or y is signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding of the final square root

Definition at line 3332 of file includes/half.hpp.

References half_float::detail::binary, half_float::detail::check_underflow(), hypot(), half_float::detail::select(), half_float::detail::signal(), sqrt(), and absl::swap_internal::swap().

Referenced by hypot().

◆ hypot() [2/2]

half half_float::hypot ( half  x,
half  y,
half  z 
)
inline

Hypotenuse function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::hypot.

Parameters
xfirst argument
ysecond argument
zthird argument
Returns
square root of sum of squares without internal over- or underflows
Exceptions
FE_INVALIDif x, y or z is signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding of the final square root

Definition at line 3378 of file includes/half.hpp.

References half_float::detail::binary, hypot(), half_float::detail::select(), half_float::detail::signal(), sqrt(), and absl::swap_internal::swap().

Referenced by hypot().

◆ ilogb()

int half_float::ilogb ( half  arg)
inline

Extract exponent.

See also: Documentation for std::ilogb.

Parameters
argnumber to query
Returns
floating-point exponent
Return values
FP_ILOGB0for zero
FP_ILOGBNANfor NaN
INT_MAXfor infinity
Exceptions
FE_INVALIDfor 0 or infinite values

Definition at line 4264 of file includes/half.hpp.

References abs(), exp(), FE_INVALID, FP_ILOGB0, FP_ILOGBNAN, and half_float::detail::raise().

◆ isfinite()

HALF_CONSTEXPR bool half_float::isfinite ( half  arg)
inline

Check if finite number.

See also: Documentation for std::isfinite.

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

Definition at line 4388 of file includes/half.hpp.

◆ isgreater()

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

Quiet comparison for greater than.

See also: Documentation for std::isgreater.

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

Definition at line 4429 of file includes/half.hpp.

References isnan().

◆ isgreaterequal()

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

Quiet comparison for greater equal.

See also: Documentation for std::isgreaterequal.

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

Definition at line 4440 of file includes/half.hpp.

References isnan().

◆ isinf()

HALF_CONSTEXPR bool half_float::isinf ( half  arg)
inline

Check for infinity.

See also: Documentation for std::isinf.

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

Definition at line 4395 of file includes/half.hpp.

Referenced by half_float::detail::builtin_isinf().

◆ isless()

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

Quiet comparison for less than.

See also: Documentation for std::isless.

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

Definition at line 4451 of file includes/half.hpp.

References isnan().

◆ islessequal()

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

Quiet comparison for less equal.

See also: Documentation for std::islessequal.

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

Definition at line 4462 of file includes/half.hpp.

References isnan().

◆ islessgreater()

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

Quiet comarison for less or greater.

See also: Documentation for std::islessgreater.

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

Definition at line 4473 of file includes/half.hpp.

References isnan().

◆ isnan()

HALF_CONSTEXPR bool half_float::isnan ( half  arg)
inline

Check for NaN.

See also: Documentation for std::isnan.

Parameters
argnumber to check
Return values
truefor NaNs
falseelse

Definition at line 4402 of file includes/half.hpp.

Referenced by half_float::detail::builtin_isnan(), fdim(), fmax(), fmin(), isgreater(), isgreaterequal(), isless(), islessequal(), islessgreater(), and isunordered().

◆ isnormal()

HALF_CONSTEXPR bool half_float::isnormal ( half  arg)
inline

Check if normal number.

See also: Documentation for std::isnormal.

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

Definition at line 4409 of file includes/half.hpp.

◆ isunordered()

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

Quiet check if unordered.

See also: Documentation for std::isunordered.

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

Definition at line 4484 of file includes/half.hpp.

References isnan().

◆ ldexp()

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

Multiply by power of two.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::ldexp.

Parameters
argnumber to modify
exppower of two to multiply with
Returns
arg multplied by 2 raised to exp
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4228 of file includes/half.hpp.

References exp(), and scalbln().

Referenced by half_float::detail::float2half_impl(), and half_float::detail::half2float_impl().

◆ lgamma()

half half_float::lgamma ( half  arg)
inline

Natural logarithm of gamma function.

This function may be 1 ULP off the correctly rounded exact result for any rounding mode in ~0.025% of inputs.

See also: Documentation for std::lgamma.

Parameters
argfunction argument
Returns
natural logarith of gamma function for arg
Exceptions
FE_INVALIDfor signaling NaN
FE_DIVBYZEROfor 0 or negative integer arguments
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4030 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::pole(), and half_float::detail::signal().

◆ log()

half half_float::log ( half  arg)
inline

Natural logarithm.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::log.

Parameters
argfunction argument
Returns
logarithm of arg to base e
Exceptions
FE_INVALIDfor signaling NaN or negative argument
FE_DIVBYZEROfor 0
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3067 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::log2(), half_float::detail::pole(), and half_float::detail::signal().

◆ log10()

half half_float::log10 ( half  arg)
inline

Common logarithm.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::log10.

Parameters
argfunction argument
Returns
logarithm of arg to base 10
Exceptions
FE_INVALIDfor signaling NaN or negative argument
FE_DIVBYZEROfor 0
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3095 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::log2(), half_float::detail::pole(), and half_float::detail::signal().

◆ log1p()

half half_float::log1p ( half  arg)
inline

Natural logarithm plus one.

This function may be 1 ULP off the correctly rounded exact result in <0.05% of inputs for std::round_to_nearest and in ~1% of inputs for any other rounding mode.

See also: Documentation for std::log1p.

Parameters
argfunction argument
Returns
logarithm of arg plus 1 to base e
Exceptions
FE_INVALIDfor signaling NaN or argument <-1
FE_DIVBYZEROfor -1
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3173 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::log2(), half_float::detail::pole(), and half_float::detail::signal().

◆ log2()

half half_float::log2 ( half  arg)
inline

Binary logarithm.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::log2.

Parameters
argfunction argument
Returns
logarithm of arg to base 2
Exceptions
FE_INVALIDfor signaling NaN or negative argument
FE_DIVBYZEROfor 0
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3130 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::pole(), half_float::detail::sign_mask(), and half_float::detail::signal().

◆ logb()

half half_float::logb ( half  arg)
inline

Extract exponent.

See also: Documentation for std::logb.

Parameters
argnumber to query
Returns
floating-point exponent
Exceptions
FE_INVALIDfor signaling NaN
FE_DIVBYZEROfor 0

Definition at line 4282 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::pole(), and half_float::detail::signal().

◆ lrint()

long half_float::lrint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

See also: Documentation for std::lrint.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode
Exceptions
FE_INVALIDif value is not representable as long
FE_INEXACTif value had to be rounded

Definition at line 4135 of file includes/half.hpp.

◆ lround()

long half_float::lround ( half  arg)
inline

Nearest integer.

See also: Documentation for std::lround.

Parameters
arghalf to round
Returns
nearest integer, rounded away from zero in half-way cases
Exceptions
FE_INVALIDif value is not representable as long

Definition at line 4119 of file includes/half.hpp.

◆ modf()

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

Extract integer and fractional parts.

See also: Documentation for std::modf.

Parameters
argnumber to decompress
iptraddress to store integer part at
Returns
fractional part
Exceptions
FE_INVALIDfor signaling NaN

Definition at line 4236 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), and half_float::detail::signal().

Referenced by half_float::detail::float2half_impl().

◆ nanh()

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

Get NaN value.

See also: Documentation for std::nan.

Parameters
argstring code
Returns
quiet NaN

Definition at line 2932 of file includes/half.hpp.

References half_float::detail::binary.

◆ nearbyint()

half half_float::nearbyint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

See also: Documentation for std::nearbyint.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode
Exceptions
FE_INVALIDfor signaling NaN

Definition at line 4142 of file includes/half.hpp.

References half_float::detail::binary.

◆ nextafter()

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

Next representable value.

See also: Documentation for std::nextafter.

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
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOWfor infinite result from finite argument
FE_UNDERFLOWfor subnormal result

Definition at line 4308 of file includes/half.hpp.

References half_float::detail::binary, fabs(), FE_OVERFLOW, FE_UNDERFLOW, HALF_ERRHANDLING_UNDERFLOW_TO_INEXACT, half_float::detail::raise(), and half_float::detail::signal().

◆ nexttoward()

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

Next representable value.

See also: Documentation for std::nexttoward.

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
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOWfor infinite result from finite argument
FE_UNDERFLOWfor subnormal result

Definition at line 4335 of file includes/half.hpp.

References half_float::detail::binary, half_float::detail::builtin_isnan(), half_float::detail::builtin_signbit(), fabs(), FE_OVERFLOW, FE_UNDERFLOW, HALF_ERRHANDLING_UNDERFLOW_TO_INEXACT, half_float::detail::raise(), and half_float::detail::signal().

◆ operator!=()

HALF_CONSTEXPR_NOERR bool half_float::operator!= ( half  x,
half  y 
)
inline

Comparison for inequality.

Parameters
xfirst operand
ysecond operand
Return values
trueif operands not equal
falseelse
Exceptions
FE_INVALIDif x or y is NaN

Definition at line 2494 of file includes/half.hpp.

References half_float::detail::compsignal().

◆ operator*()

half half_float::operator* ( half  x,
half  y 
)
inline

Multiplication.

This operation is exact to rounding for all rounding modes.

Parameters
xleft operand
yright operand
Returns
product of half expressions
Exceptions
FE_INVALIDif multiplying 0 with infinity or if x or y is signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 2635 of file includes/half.hpp.

References half_float::detail::binary, exp(), half_float::detail::invalid(), and half_float::detail::signal().

◆ operator+() [1/2]

HALF_CONSTEXPR half half_float::operator+ ( half  arg)
inline

Identity.

Parameters
argoperand
Returns
unchanged operand

Definition at line 2555 of file includes/half.hpp.

◆ operator+() [2/2]

half half_float::operator+ ( half  x,
half  y 
)
inline

Addition.

This operation is exact to rounding for all rounding modes.

Parameters
xleft operand
yright operand
Returns
sum of half expressions
Exceptions
FE_INVALIDif x and y are infinities with different signs or signaling NaNs
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 2569 of file includes/half.hpp.

References half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::signal(), and absl::swap_internal::swap().

◆ operator-() [1/2]

HALF_CONSTEXPR half half_float::operator- ( half  arg)
inline

Negation.

Parameters
argoperand
Returns
negated operand

Definition at line 2560 of file includes/half.hpp.

References half_float::detail::binary.

◆ operator-() [2/2]

half half_float::operator- ( half  x,
half  y 
)
inline

Subtraction.

This operation is exact to rounding for all rounding modes.

Parameters
xleft operand
yright operand
Returns
difference of half expressions
Exceptions
FE_INVALIDif x and y are infinities with equal signs or signaling NaNs
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 2619 of file includes/half.hpp.

References half_float::detail::binary.

◆ operator/()

half half_float::operator/ ( half  x,
half  y 
)
inline

Division.

This operation is exact to rounding for all rounding modes.

Parameters
xleft operand
yright operand
Returns
quotient of half expressions
Exceptions
FE_INVALIDif dividing 0s or infinities with each other or if x or y is signaling NaN
FE_DIVBYZEROif dividing finite value by 0
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 2668 of file includes/half.hpp.

References half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::pole(), and half_float::detail::signal().

◆ operator<()

HALF_CONSTEXPR_NOERR bool half_float::operator< ( half  x,
half  y 
)
inline

Comparison for less than.

Parameters
xfirst operand
ysecond operand
Return values
trueif x less than y
falseelse
Exceptions
FE_INVALIDif x or y is NaN

Definition at line 2505 of file includes/half.hpp.

References half_float::detail::compsignal().

◆ operator<<()

template<typename charT , typename traits >
std::basic_ostream< charT, traits > & half_float::operator<< ( std::basic_ostream< charT, traits > &  out,
half  arg 
)

Output operator.

This uses the built-in functionality for streaming out floating-point numbers.

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

Definition at line 2707 of file includes/half.hpp.

◆ operator<=()

HALF_CONSTEXPR_NOERR bool half_float::operator<= ( half  x,
half  y 
)
inline

Comparison for less equal.

Parameters
xfirst operand
ysecond operand
Return values
trueif x less equal y
falseelse
Exceptions
FE_INVALIDif x or y is NaN

Definition at line 2529 of file includes/half.hpp.

References half_float::detail::compsignal().

◆ operator==()

HALF_CONSTEXPR_NOERR bool half_float::operator== ( half  x,
half  y 
)
inline

Comparison for equality.

Parameters
xfirst operand
ysecond operand
Return values
trueif operands equal
falseelse
Exceptions
FE_INVALIDif x or y is NaN

Definition at line 2483 of file includes/half.hpp.

References half_float::detail::compsignal().

◆ operator>()

HALF_CONSTEXPR_NOERR bool half_float::operator> ( half  x,
half  y 
)
inline

Comparison for greater than.

Parameters
xfirst operand
ysecond operand
Return values
trueif x greater than y
falseelse
Exceptions
FE_INVALIDif x or y is NaN

Definition at line 2517 of file includes/half.hpp.

References half_float::detail::compsignal().

◆ operator>=()

HALF_CONSTEXPR_NOERR bool half_float::operator>= ( half  x,
half  y 
)
inline

Comparison for greater equal.

Parameters
xfirst operand
ysecond operand
Return values
trueif x greater equal y
falseelse
Exceptions
FE_INVALIDif x or y is NaN

Definition at line 2541 of file includes/half.hpp.

References half_float::detail::compsignal().

◆ operator>>()

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

Input operator.

This uses the built-in functionality for streaming in floating-point numbers, specifically double precision floating point numbers (unless overridden with HALF_ARITHMETIC_TYPE). So the input string is first rounded to double precision using the underlying platform's current floating-point rounding mode before being rounded to half-precision using the library's half-precision rounding mode.

Parameters
ininput stream to read from
arghalf to read into
Returns
reference to input stream
Exceptions
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 2725 of file includes/half.hpp.

◆ pow()

half half_float::pow ( half  x,
half  y 
)
inline

Power function.

This function may be 1 ULP off the correctly rounded exact result for any rounding mode in ~0.00025% of inputs.

See also: Documentation for std::pow.

Parameters
xbase
yexponent
Returns
x raised to y
Exceptions
FE_INVALIDif x or y is signaling NaN or if x is finite an negative and y is finite and not integral
FE_DIVBYZEROif x is 0 and y is negative
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3444 of file includes/half.hpp.

References half_float::detail::binary, half_float::detail::check_underflow(), exp(), half_float::detail::invalid(), half_float::detail::multiply64(), half_float::detail::pole(), half_float::detail::select(), half_float::detail::sign_mask(), half_float::detail::signal(), and sqrt().

Referenced by TrackerVizOutput::drawUncertaintyEllipse(), CV_FUNCS::get2dGaussianPdf(), rs2_project_color_pixel_to_depth_pixel(), and rsqrt().

◆ remainder()

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

Remainder of division.

See also: Documentation for std::remainder.

Parameters
xfirst operand
ysecond operand
Returns
remainder of floating-point division.
Exceptions
FE_INVALIDif x is infinite or y is 0 or if x or y is signaling NaN

Definition at line 2781 of file includes/half.hpp.

References half_float::detail::binary, half_float::detail::invalid(), and half_float::detail::signal().

◆ remquo()

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

Remainder of division.

See also: Documentation for std::remquo.

Parameters
xfirst operand
ysecond operand
quoaddress to store some bits of quotient at
Returns
remainder of floating-point division.
Exceptions
FE_INVALIDif x is infinite or y is 0 or if x or y is signaling NaN

Definition at line 2801 of file includes/half.hpp.

References half_float::detail::binary, half_float::detail::invalid(), and half_float::detail::signal().

◆ rint()

half half_float::rint ( half  arg)
inline

Nearest integer using half's internal rounding mode.

See also: Documentation for std::rint.

Parameters
arghalf expression to round
Returns
nearest integer using default rounding mode
Exceptions
FE_INVALIDfor signaling NaN
FE_INEXACTif value had to be rounded

Definition at line 4127 of file includes/half.hpp.

References half_float::detail::binary.

◆ round()

half half_float::round ( half  arg)
inline

Nearest integer.

See also: Documentation for std::round.

Parameters
arghalf to round
Returns
nearest integer, rounded away from zero in half-way cases
Exceptions
FE_INVALIDfor signaling NaN
FE_INEXACTif value had to be rounded

Definition at line 4112 of file includes/half.hpp.

References half_float::detail::binary.

◆ rsqrt()

half half_float::rsqrt ( half  arg)
inline

Inverse square root.

This function is exact to rounding for all rounding modes and thus generally more accurate than directly computing 1 / sqrt(arg) in half-precision, in addition to also being faster.

Parameters
argfunction argument
Returns
reciprocal of square root of arg
Exceptions
FE_INVALIDfor signaling NaN and negative arguments
FE_INEXACTaccording to rounding

Definition at line 3244 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::invalid(), half_float::detail::pole(), pow(), half_float::detail::signal(), and sqrt().

◆ scalbln()

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

Multiply by power of two.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::scalbln.

Parameters
argnumber to modify
exppower of two to multiply with
Returns
arg multplied by 2 raised to exp
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4191 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), and half_float::detail::signal().

Referenced by ldexp(), and scalbn().

◆ scalbn()

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

Multiply by power of two.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::scalbn.

Parameters
argnumber to modify
exppower of two to multiply with
Returns
arg multplied by 2 raised to exp
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4217 of file includes/half.hpp.

References exp(), and scalbln().

◆ signbit()

HALF_CONSTEXPR bool half_float::signbit ( half  arg)
inline

Check sign.

See also: Documentation for std::signbit.

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

Definition at line 4416 of file includes/half.hpp.

Referenced by half_float::detail::builtin_signbit().

◆ sin()

half half_float::sin ( half  arg)
inline

Sine function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::sin.

Parameters
argfunction argument
Returns
sine value of arg
Exceptions
FE_INVALIDfor signaling NaN or infinity
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3573 of file includes/half.hpp.

References abs(), half_float::detail::angle_arg(), half_float::detail::binary, half_float::detail::invalid(), half_float::detail::signal(), and half_float::detail::sincos().

Referenced by TrackerVizOutput::drawUncertaintyEllipse(), and sincos().

◆ sincos()

void half_float::sincos ( half  arg,
half *  sin,
half *  cos 
)
inline

Compute sine and cosine simultaneously.

This returns the same results as sin() and cos() but is faster than calling each function individually.

This function is exact to rounding for all rounding modes.

Parameters
argfunction argument
sinvariable to take sine of arg
cosvariable to take cosine of arg
Exceptions
FE_INVALIDfor signaling NaN or infinity
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3508 of file includes/half.hpp.

References abs(), half_float::detail::angle_arg(), half_float::detail::binary, cos(), half_float::detail::invalid(), half_float::detail::signal(), sin(), and half_float::detail::sincos().

◆ sinh()

half half_float::sinh ( half  arg)
inline

Hyperbolic sine.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::sinh.

Parameters
argfunction argument
Returns
hyperbolic sine value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3810 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::hyperbolic_args(), and half_float::detail::signal().

◆ sqrt()

half half_float::sqrt ( half  arg)
inline

Square root.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::sqrt.

Parameters
argfunction argument
Returns
square root of arg
Exceptions
FE_INVALIDfor signaling NaN and negative arguments
FE_INEXACTaccording to rounding

Definition at line 3223 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::invalid(), and half_float::detail::signal().

Referenced by hypot(), pow(), and rsqrt().

◆ tan()

half half_float::tan ( half  arg)
inline

Tangent function.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::tan.

Parameters
argfunction argument
Returns
tangent value of arg
Exceptions
FE_INVALIDfor signaling NaN or infinity
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3634 of file includes/half.hpp.

References abs(), half_float::detail::angle_arg(), half_float::detail::binary, exp(), half_float::detail::invalid(), half_float::detail::sign_mask(), half_float::detail::signal(), and half_float::detail::sincos().

Referenced by rs2_deproject_pixel_to_point(), and rs2_project_point_to_pixel().

◆ tanh()

half half_float::tanh ( half  arg)
inline

Hyperbolic tangent.

This function is exact to rounding for all rounding modes.

See also: Documentation for std::tanh.

Parameters
argfunction argument
Returns
hyperbolic tangent value of arg
Exceptions
FE_INVALIDfor signaling NaN
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 3865 of file includes/half.hpp.

References abs(), half_float::detail::binary, exp(), half_float::detail::hyperbolic_args(), and half_float::detail::signal().

◆ tgamma()

half half_float::tgamma ( half  arg)
inline

Gamma function.

This function may be 1 ULP off the correctly rounded exact result for any rounding mode in <0.25% of inputs.

See also: Documentation for std::tgamma.

Parameters
argfunction argument
Returns
gamma function value of arg
Exceptions
FE_INVALIDfor signaling NaN, negative infinity or negative integer arguments
FE_DIVBYZEROfor 0
FE_OVERFLOW,...UNDERFLOW,...INEXACTaccording to rounding

Definition at line 4055 of file includes/half.hpp.

References abs(), half_float::detail::binary, half_float::detail::invalid(), half_float::detail::pole(), and half_float::detail::signal().

◆ trunc()

half half_float::trunc ( half  arg)
inline

Nearest integer not greater in magnitude than half value.

See also: Documentation for std::trunc.

Parameters
arghalf to round
Returns
nearest integer not greater in magnitude than arg
Exceptions
FE_INVALIDfor signaling NaN
FE_INEXACTif value had to be rounded

Definition at line 4104 of file includes/half.hpp.

References half_float::detail::binary.