Core semantic modifiers
Many core functions accept one or more of these options to change what they compute or how. Each is documented below; which functions accept which is stated on the page of every function that does.
Variables | |
| constexpr auto | eve::saturated = ::rbr::flag( saturated_mode{} ) |
| Keeps the result inside the range of its type instead of wrapping or overflowing. | |
| constexpr auto | eve::pedantic = ::rbr::flag( pedantic_mode{} ) |
| Follows the corner cases of the corresponding standard function. | |
| constexpr auto | eve::numeric = ::rbr::flag( numeric_mode{} ) |
| Makes NaN lose against any definite value. | |
| constexpr auto | eve::almost = {} |
| Turns an equality or an ordering into its tolerant form. | |
| constexpr auto | eve::definitely = {} |
| Requires a strict comparison to hold by a margin. | |
| constexpr auto | eve::raw = ::rbr::flag( raw_mode{} ) |
| Performs the operation minimally, trading accuracy for speed. | |
| constexpr auto | eve::fast = ::rbr::flag( fast_mode{} ) |
| Performs the operation faster than the regular call while keeping more accuracy than raw. | |
| constexpr auto | eve::lower = ::rbr::flag( lower_mode{} ) |
| Guarantees a result no greater than the exact mathematical one. | |
| constexpr auto | eve::upper = ::rbr::flag( upper_mode{} ) |
| Guarantees a result no smaller than the exact mathematical one. | |
| constexpr auto | eve::strict = ::rbr::flag( strict_mode{} ) |
| Turns the guarantee of lower or upper into a strict inequality. | |
| constexpr auto | eve::widen = ::rbr::flag( widen_mode{} ) |
| Computes the result in the upgraded element type. | |
| constexpr auto | eve::to_nearest = ::rbr::flag( to_nearest_mode{} ) |
| Rounds to the nearest integer, ties going to the even one. | |
| constexpr auto | eve::downward = ::rbr::flag( downward_mode{} ) |
| Rounds toward \(-\infty\). | |
| constexpr auto | eve::upward = ::rbr::flag( upward_mode{} ) |
| Rounds toward \(+\infty\). | |
| constexpr auto | eve::toward_zero = ::rbr::flag( toward_zero_mode{} ) |
| Rounds toward zero. | |
| constexpr auto | eve::to_nearest_odd = ::rbr::flag( to_nearest_odd_mode{} ) |
| Rounds to the nearest integer, ties going to the odd one. | |
| constexpr auto | eve::left = ::rbr::flag( left_mode{} ) |
| Swaps the two operands before applying the operation. | |
| constexpr auto | eve::right = ::rbr::flag( right_mode{} ) |
| Applies the operation in the order the operands are written. | |
| constexpr auto | eve::spherical = ::rbr::flag( spherical_mode{} ) |
| Selects the spherical form of a Bessel function. | |
| constexpr auto | eve::cylindrical = ::rbr::flag( cylindrical_mode{} ) |
| Selects the cylindrical form of a Bessel function. | |
|
inlineconstexpr |
Turns an equality or an ordering into its tolerant form.
Written f[almost] the tolerance defaults to 3*eps(as(x)). Written f[almost = tol] it is whatever tol says, and the way it is read depends on its type:
|
inlineconstexpr |
Selects the cylindrical form of a Bessel function.
The form the undecorated call already computes, \(J_n(z)\), named so that a call site can say which of the two it wants rather than leaving it to the default. Mirror of spherical.
|
inlineconstexpr |
Requires a strict comparison to hold by a margin.
Mirror image of almost: where almost widens a test so that near misses pass, definitely narrows it so that near misses fail. is_greater[definitely = tol](x, y) holds when \(x > y + \mbox{tol}\cdot\max(|x|, |y|)\) for a floating tol, or when x exceeds the tol-th representable value after y for an integral one. Omitting tol uses 3*eps(as(x)).
|
inlineconstexpr |
Rounds toward \(-\infty\).
One of the four integer rounding modes.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Guarantees a result no greater than the exact mathematical one.
The computed value is less than or equal to the value an infinitely precise computation would give, NaN excepted. Combine with strict to make the inequality strict.
|
inlineconstexpr |
Makes NaN lose against any definite value.
Comparisons and reductions normally propagate NaN, and which operand carries it decides the result: eve::max(nan, x) is a NaN while eve::max(x, nan) is x. Under this option a NaN never wins either way, so both spellings return x.
|
inlineconstexpr |
Follows the corner cases of the corresponding standard function.
The undecorated call is free to take the shortest route the hardware offers. This option asks instead for the behaviour the C++ standard prescribes on infinities, zeroes and NaNs, which is usually slower.
|
inlineconstexpr |
Performs the operation minimally, trading accuracy for speed.
Corner cases and the last bits of accuracy are given up in exchange for the shortest code path. fast makes the opposite trade, keeping more accuracy for less of a gain.
|
inlineconstexpr |
Applies the operation in the order the operands are written.
The behaviour of an undecorated call, spelled out. It exists so that a call site pairing with left elsewhere can state which of the two it means instead of relying on the reader knowing the default.
|
inlineconstexpr |
Keeps the result inside the range of its type instead of wrapping or overflowing.
An operation that would leave the representable range returns the nearest bound rather than the value C++ would produce, so eve::abs[saturated](valmin(as<T>())) gives valmax(as<T>()) instead of wrapping back to a negative number.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Rounds to the nearest integer, ties going to the even one.
One of the four integer rounding modes.
|
inlineconstexpr |
Rounds to the nearest integer, ties going to the odd one.
Experimental, and accepted by add only.
|
inlineconstexpr |
Rounds toward zero.
One of the four integer rounding modes.
|
inlineconstexpr |
Guarantees a result no smaller than the exact mathematical one.
Mirror image of lower: the computed value is greater than or equal to the exact one, NaN excepted.
|
inlineconstexpr |
Rounds toward \(+\infty\).
One of the four integer rounding modes.
|
inlineconstexpr |
Computes the result in the upgraded element type.
The computation and its result use the type twice as wide as the parameters' element type. Returning to the original width, when needed, is left to the caller through convert.