fixed_point128 1.0.1.0
128 bit integer, fixed point and floating point arithmetic for C++20
Loading...
Searching...
No Matches
fp128::detail::flag_filter Class Reference

Reduces what a math function's internal operations raise to what its result justifies. More...

#include <float128.h>

Public Member Functions

 flag_filter () noexcept
 ~flag_filter ()
 flag_filter (const flag_filter &)=delete
flag_filter & operator= (const flag_filter &)=delete
template<typename T>
T inexact (const T &result) noexcept
 The same as operator(), for a result known to be inexact without an operation having said so: an overflow or underflow decided from the argument's range alone.
template<typename T>
T operator() (const T &result) noexcept
 Records the flags a result justifies and passes the result through.

Detailed Description

Reduces what a math function's internal operations raise to what its result justifies.

A function such as sin() is built from dozens of additions and multiplications, and those raise exceptions of their own: a series term underflows, an intermediate overflows on a path whose result does not. IEEE 754-2008 9.2 asks the function to signal as one operation would - inexact when the result is, overflow when the result overflowed, underflow when it is tiny and inexact. Constructed after a function has dealt with its special cases, which raise invalid and division by zero themselves, it sets the caller's flags aside; operator() then keeps inexact if any step raised it and derives the rest from the result. Compiles to nothing without FP128_IEEE_ENV.

Definition at line 332 of file float128.h.

Constructor & Destructor Documentation

◆ flag_filter() [1/2]

fp128::detail::flag_filter::flag_filter ( )
inlinenoexcept

Definition at line 335 of file float128.h.

◆ ~flag_filter()

fp128::detail::flag_filter::~flag_filter ( )
inline

Definition at line 342 of file float128.h.

◆ flag_filter() [2/2]

fp128::detail::flag_filter::flag_filter ( const flag_filter & )
delete

Member Function Documentation

◆ operator=()

flag_filter & fp128::detail::flag_filter::operator= ( const flag_filter & )
delete

◆ inexact()

template<typename T>
T fp128::detail::flag_filter::inexact ( const T & result)
inlinenodiscardnoexcept

The same as operator(), for a result known to be inexact without an operation having said so: an overflow or underflow decided from the argument's range alone.

Template Parameters
Tfloat128
Parameters
resultThe function's result
Returns
result

Definition at line 358 of file float128.h.

◆ operator()()

template<typename T>
T fp128::detail::flag_filter::operator() ( const T & result)
inlinenodiscardnoexcept

Records the flags a result justifies and passes the result through.

Template Parameters
Tfloat128, which is incomplete where this is declared
Parameters
resultThe function's result, from finite operands
Returns
result

Definition at line 370 of file float128.h.


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