sigma  1.0.0
Loading...
Searching...
No Matches
sigma::detail_::rounded_transc_guarded< T > Struct Template Reference

Outward rounding for the transcendental functions. More...

#include <policies.hpp>

Inheritance diagram for sigma::detail_::rounded_transc_guarded< T >:

Public Member Functions

T exp_down (const T &x)
 A lower bound for the exponential of x.
T exp_up (const T &x)
 A upper bound for the exponential of x.
T log_down (const T &x)
 A lower bound for the natural logarithm of x.
T log_up (const T &x)
 A upper bound for the natural logarithm of x.
T sin_down (const T &x)
 A lower bound for the sine of x.
T sin_up (const T &x)
 A upper bound for the sine of x.
T cos_down (const T &x)
 A lower bound for the cosine of x.
T cos_up (const T &x)
 A upper bound for the cosine of x.
T tan_down (const T &x)
 A lower bound for the tangent of x.
T tan_up (const T &x)
 A upper bound for the tangent of x.
T asin_down (const T &x)
 A lower bound for the arcsine of x.
T asin_up (const T &x)
 A upper bound for the arcsine of x.
T acos_down (const T &x)
 A lower bound for the arccosine of x.
T acos_up (const T &x)
 A upper bound for the arccosine of x.
T atan_down (const T &x)
 A lower bound for the arctangent of x.
T atan_up (const T &x)
 A upper bound for the arctangent of x.
T sinh_down (const T &x)
 A lower bound for the hyperbolic sine of x.
T sinh_up (const T &x)
 A upper bound for the hyperbolic sine of x.
T cosh_down (const T &x)
 A lower bound for the hyperbolic cosine of x.
T cosh_up (const T &x)
 A upper bound for the hyperbolic cosine of x.
T tanh_down (const T &x)
 A lower bound for the hyperbolic tangent of x.
T tanh_up (const T &x)
 A upper bound for the hyperbolic tangent of x.
T asinh_down (const T &x)
 A lower bound for the inverse hyperbolic sine of x.
T asinh_up (const T &x)
 A upper bound for the inverse hyperbolic sine of x.
T acosh_down (const T &x)
 A lower bound for the inverse hyperbolic cosine of x.
T acosh_up (const T &x)
 A upper bound for the inverse hyperbolic cosine of x.
T atanh_down (const T &x)
 A lower bound for the inverse hyperbolic tangent of x.
T atanh_up (const T &x)
 A upper bound for the inverse hyperbolic tangent of x.

Detailed Description

template<typename T>
struct sigma::detail_::rounded_transc_guarded< T >

Outward rounding for the transcendental functions.

Boost ships three transcendental rounding policies, and all three obtain a directed rounding by switching the FPU's rounding mode around a call to the platform's libm (rounded_transc_std, rounded_transc_opp) or by trusting libm to be exact (rounded_transc_exact). None of them is safe here, for two separate reasons:

  1. libm is not required to honor the rounding mode for the transcendental functions, and a libm that ignores it makes f_down(x) and f_up(x) return the same value. The interval then claims a degenerate enclosure for an inexact result, i.e., that log is exact – which is not merely loose, it excludes the true value.
  2. Worse, a libm that partially honors the mode is actively harmful. Its internal steps each round in the requested direction, so the accumulated error can carry the final result past the correctly rounded one and out the other side. Measured on macOS, atanh() evaluated in downward mode returns a value two ulps above the correctly rounded result, so the "lower bound" is not a lower bound at all.

This policy therefore never asks libm to round: every function is evaluated in to-nearest mode, which is the mode libm implementations are actually written and tested for, and the result is then widened outward by k_error_ulps_ ulps to cover libm's error. The arithmetic operators and sqrt() keep boost's hardware-directed rounding (rounded_arith_opp), which IEEE-754 does require to be correctly rounded, so they stay exactly as tight as they were.

Every function below is named with an explicit std::. Boost's own policies reach them through the BOOST_NUMERIC_INTERVAL_using_math and _using_ahyp macros, which expand to nothing on some platforms (MSVC among them); the call is then unqualified and finds sigma's overload for Interval rather than the scalar one.

Template Parameters
TThe floating point type being rounded.

Member Function Documentation

◆ acos_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::acos_down ( const T & x)
inline

A lower bound for the arccosine of x.

Parameters
[in]xThe argument to std::acos.
Returns
A value no greater than the true value of acos(x).
Exceptions
noneNo throw guarantee.

◆ acos_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::acos_up ( const T & x)
inline

A upper bound for the arccosine of x.

Parameters
[in]xThe argument to std::acos.
Returns
A value no less than the true value of acos(x).
Exceptions
noneNo throw guarantee.

◆ acosh_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::acosh_down ( const T & x)
inline

A lower bound for the inverse hyperbolic cosine of x.

Parameters
[in]xThe argument to std::acosh.
Returns
A value no greater than the true value of acosh(x).
Exceptions
noneNo throw guarantee.

◆ acosh_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::acosh_up ( const T & x)
inline

A upper bound for the inverse hyperbolic cosine of x.

Parameters
[in]xThe argument to std::acosh.
Returns
A value no less than the true value of acosh(x).
Exceptions
noneNo throw guarantee.

◆ asin_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::asin_down ( const T & x)
inline

A lower bound for the arcsine of x.

Parameters
[in]xThe argument to std::asin.
Returns
A value no greater than the true value of asin(x).
Exceptions
noneNo throw guarantee.

◆ asin_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::asin_up ( const T & x)
inline

A upper bound for the arcsine of x.

Parameters
[in]xThe argument to std::asin.
Returns
A value no less than the true value of asin(x).
Exceptions
noneNo throw guarantee.

◆ asinh_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::asinh_down ( const T & x)
inline

A lower bound for the inverse hyperbolic sine of x.

Parameters
[in]xThe argument to std::asinh.
Returns
A value no greater than the true value of asinh(x).
Exceptions
noneNo throw guarantee.

◆ asinh_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::asinh_up ( const T & x)
inline

A upper bound for the inverse hyperbolic sine of x.

Parameters
[in]xThe argument to std::asinh.
Returns
A value no less than the true value of asinh(x).
Exceptions
noneNo throw guarantee.

◆ atan_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::atan_down ( const T & x)
inline

A lower bound for the arctangent of x.

Parameters
[in]xThe argument to std::atan.
Returns
A value no greater than the true value of atan(x).
Exceptions
noneNo throw guarantee.

◆ atan_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::atan_up ( const T & x)
inline

A upper bound for the arctangent of x.

Parameters
[in]xThe argument to std::atan.
Returns
A value no less than the true value of atan(x).
Exceptions
noneNo throw guarantee.

◆ atanh_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::atanh_down ( const T & x)
inline

A lower bound for the inverse hyperbolic tangent of x.

Parameters
[in]xThe argument to std::atanh.
Returns
A value no greater than the true value of atanh(x).
Exceptions
noneNo throw guarantee.

◆ atanh_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::atanh_up ( const T & x)
inline

A upper bound for the inverse hyperbolic tangent of x.

Parameters
[in]xThe argument to std::atanh.
Returns
A value no less than the true value of atanh(x).
Exceptions
noneNo throw guarantee.

◆ cos_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::cos_down ( const T & x)
inline

A lower bound for the cosine of x.

Parameters
[in]xThe argument to std::cos.
Returns
A value no greater than the true value of cos(x).
Exceptions
noneNo throw guarantee.

◆ cos_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::cos_up ( const T & x)
inline

A upper bound for the cosine of x.

Parameters
[in]xThe argument to std::cos.
Returns
A value no less than the true value of cos(x).
Exceptions
noneNo throw guarantee.

◆ cosh_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::cosh_down ( const T & x)
inline

A lower bound for the hyperbolic cosine of x.

Parameters
[in]xThe argument to std::cosh.
Returns
A value no greater than the true value of cosh(x).
Exceptions
noneNo throw guarantee.

◆ cosh_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::cosh_up ( const T & x)
inline

A upper bound for the hyperbolic cosine of x.

Parameters
[in]xThe argument to std::cosh.
Returns
A value no less than the true value of cosh(x).
Exceptions
noneNo throw guarantee.

◆ exp_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::exp_down ( const T & x)
inline

A lower bound for the exponential of x.

Parameters
[in]xThe argument to std::exp.
Returns
A value no greater than the true value of exp(x).
Exceptions
noneNo throw guarantee.

◆ exp_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::exp_up ( const T & x)
inline

A upper bound for the exponential of x.

Parameters
[in]xThe argument to std::exp.
Returns
A value no less than the true value of exp(x).
Exceptions
noneNo throw guarantee.

◆ log_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::log_down ( const T & x)
inline

A lower bound for the natural logarithm of x.

Parameters
[in]xThe argument to std::log.
Returns
A value no greater than the true value of log(x).
Exceptions
noneNo throw guarantee.

◆ log_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::log_up ( const T & x)
inline

A upper bound for the natural logarithm of x.

Parameters
[in]xThe argument to std::log.
Returns
A value no less than the true value of log(x).
Exceptions
noneNo throw guarantee.

◆ sin_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::sin_down ( const T & x)
inline

A lower bound for the sine of x.

Parameters
[in]xThe argument to std::sin.
Returns
A value no greater than the true value of sin(x).
Exceptions
noneNo throw guarantee.

◆ sin_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::sin_up ( const T & x)
inline

A upper bound for the sine of x.

Parameters
[in]xThe argument to std::sin.
Returns
A value no less than the true value of sin(x).
Exceptions
noneNo throw guarantee.

◆ sinh_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::sinh_down ( const T & x)
inline

A lower bound for the hyperbolic sine of x.

Parameters
[in]xThe argument to std::sinh.
Returns
A value no greater than the true value of sinh(x).
Exceptions
noneNo throw guarantee.

◆ sinh_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::sinh_up ( const T & x)
inline

A upper bound for the hyperbolic sine of x.

Parameters
[in]xThe argument to std::sinh.
Returns
A value no less than the true value of sinh(x).
Exceptions
noneNo throw guarantee.

◆ tan_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::tan_down ( const T & x)
inline

A lower bound for the tangent of x.

Parameters
[in]xThe argument to std::tan.
Returns
A value no greater than the true value of tan(x).
Exceptions
noneNo throw guarantee.

◆ tan_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::tan_up ( const T & x)
inline

A upper bound for the tangent of x.

Parameters
[in]xThe argument to std::tan.
Returns
A value no less than the true value of tan(x).
Exceptions
noneNo throw guarantee.

◆ tanh_down()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::tanh_down ( const T & x)
inline

A lower bound for the hyperbolic tangent of x.

Parameters
[in]xThe argument to std::tanh.
Returns
A value no greater than the true value of tanh(x).
Exceptions
noneNo throw guarantee.

◆ tanh_up()

template<typename T>
T sigma::detail_::rounded_transc_guarded< T >::tanh_up ( const T & x)
inline

A upper bound for the hyperbolic tangent of x.

Parameters
[in]xThe argument to std::tanh.
Returns
A value no less than the true value of tanh(x).
Exceptions
noneNo throw guarantee.

The documentation for this struct was generated from the following file: