Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
error.hpp File Reference
#include <cmath>
#include <limits>

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal

Functions

template<typename Scalar>
Scalar sw::universal::AbsoluteError (const Scalar &actual, const Scalar &reference)
 Absolute error is the difference between the computed value and the reference value of a quantity.
template<typename ArgumentType, typename ReturnType = double>
ReturnType sw::universal::RelativeError (const ArgumentType &actual, const ArgumentType &reference)
 The relative error is defined as the ratio of the absolute error of the computed value to the reference value.
template<typename ArgumentType, typename ReturnType = double>
ReturnType sw::universal::LogRelativeError (const ArgumentType &actual, const ArgumentType &reference)
 The logarithmic relative error is defined as the difference of the computed value to the reference value.
template<typename ArgumentType, typename ReturnType = double>
ReturnType sw::universal::MinMaxLogNormalization (const ArgumentType &logRelativeError, const ArgumentType &maxpos, const ArgumentType &minpos)
 Normalize error on a logarithmic scale between a minimum and maximum positive range.
template<typename Real>
int sw::universal::calculateNrOfValidBits (const Real &computed, const Real &expected)
 Estimate the number of valid bits in the computed value given the expected value.