eb

compression_safeguards.safeguards.eb

Error bounds that can be guaranteed by various safeguards.

Classes:

  • ErrorBound

    Different types of error bounds that can be guaranteed by various

ErrorBound

Bases: Enum

flowchart LR compression_safeguards.safeguards.eb.ErrorBound[ErrorBound] click compression_safeguards.safeguards.eb.ErrorBound href "" "compression_safeguards.safeguards.eb.ErrorBound"

Different types of error bounds that can be guaranteed by various safeguards, including:

abs class-attribute instance-attribute

abs = auto()

Absolute error bound, which guarantees that the pointwise absolute error is less than or equal to the provided bound \(\epsilon_{abs}\):

\[ |x - \hat{x}| \leq \epsilon_{abs} \]

or equivalently

\[ (x - \epsilon_{abs}) \leq \hat{x} \leq (x + \epsilon_{abs}) \]

for a finite \(\epsilon_{abs} \geq 0\).

rel class-attribute instance-attribute

rel = auto()

Relative error bound, which guarantees that the pointwise relative error is less than or equal to the provided bound \(\epsilon_{rel}\):

\[ |x - \hat{x}| \leq |x| \cdot \epsilon_{rel} \]

or equivalently

\[ (x - |x| \cdot \epsilon_{rel}) \leq \hat{x} \leq (x + |x| \cdot \epsilon_{rel}) \]

for a finite \(\epsilon_{rel} \geq 0\).

The relative error bound preserves zero values with the same bit pattern.

ratio class-attribute instance-attribute

ratio = auto()

Ratio error bound, which guarantees that the ratios between the original and the corrected values as well as their inverse ratios are less than or equal to the provided bound \(\epsilon_{ratio}\):

\[ \left\{\begin{array}{lr} 0 \quad &\text{if } x = \hat{x} = 0 \\ \inf \quad &\text{if } \text{sign}(x) \neq \text{sign}(\hat{x}) \\ |\log(|x|) - \log(|\hat{x}|)| \quad &\text{otherwise} \end{array}\right\} \leq \log(\epsilon_{ratio}) \]

or equivalently

\[ \begin{split} (x \mathbin{/} \epsilon_{ratio}) \leq \hat{x} \leq (x \cdot \epsilon_{ratio}) \quad &\text{if } x \geq 0 \\ (x \cdot \epsilon_{ratio}) \leq \hat{x} \leq (x \mathbin{/} \epsilon_{ratio}) \quad &\text{otherwise} \end{split} \]

for a finite \(\epsilon_{ratio} \geq 1\).

Since the \(\epsilon_{ratio}\) bound is finite, ratio error bound also guarantees that the sign of each corrected value matches the sign of each original value and that a corrected value is zero if and only if it is zero in the original data.

The ratio error bound is sometimes also known as a decimal error bound1 2 if the ratio is expressed as the difference in orders of magnitude. A decimal error bound of e.g. \(2\) (two orders of magnitude difference / x100 ratio) can be expressed using \(\epsilon_{ratio} = {10}^{\epsilon_{decimal}}\).

The ratio error bound can also be used to guarantee a relative-like error bound, e.g. \(\epsilon_{ratio} = 1.02\) corresponds to a \(2\%\) relative-like error bound.


  1. Gustafson, J. L., & Yonemoto, I. T. (2017). Beating floating-point at its Own Game: Posit Arithmetic. Supercomputing Frontiers and Innovations, 4(2). Available from: doi:10.14529/jsfi170206

  2. Klöwer, M., Düben, P. D., & Palmer, T. N. (2019). Posits as an alternative to floats for weather and climate models. CoNGA'19: Proceedings of the Conference for Next Generation Arithmetic 2019, 1-8. Available from: doi:10.1145/3316279.3316281