Define HALF_ROUND_STYLE

Define Documentation

HALF_ROUND_STYLE

Default rounding mode. This specifies the rounding mode used for all conversions between halfs and more precise types (unless using half_cast() and specifying the rounding mode directly) as well as in arithmetic operations and mathematical functions. 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

std::round_toward_zero

0

toward zero

std::round_to_nearest

1

to nearest (default)

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_to_nearest), which rounds results to the nearest representable value. It can even be set to std::numeric_limits<float>::round_style to synchronize the rounding mode with that of the built-in single-precision implementation (which is likely std::round_to_nearest, though).