Module gfx.math.approx

This module is about comparison of floating point arithmetics. Supported by this very informative article:

https

//randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Functions

NameDescription
approx(method, a, b) Check with method given at runtime with default parameters a and b can be any data sets supported by the approx template
scalarApproxRel(a, b, maxEps) Check whether the relative error between a and b is smaller than maxEps
scalarApproxRelAndAbs(a, b, maxAbs, maxEps) Check whether the relative error between a and b is smaller than maxEps. If the absolute error is less than maxAbs, the test succeeds however. This is useful when comparing against zero the result of a subtraction.
scalarApproxUlp(a, b, maxUlps) Determines if two floating point scalars are maxUlps close to each other.
scalarApproxUlpAndAbs(a, b, maxAbs, maxUlps) Determines if two floating point scalars are maxUlps close to each other. If the absolute error is less than maxAbs, the test succeeds however. This is useful when comparing against zero the result of a subtraction.
ulpDiff(a, b) Compute the ULP difference between two floating point numbers Negative result indicates that b has higher ULP value than a.

Enums

NameDescription
ApproxMethod Different methods to check if two floating point values are close to each other.

Templates

NameDescription
approx Generic template to check approx method on different sets of data.

Aliases

NameTypeDescription
approxRel approx!(ApproxMethod.rel) Compare two data sets with ApproxMethod.rel. That is call scalarApproxRel on each couple of the data sets.
approxRelAndAbs approx!(ApproxMethod.relAndAbs) Compare two data sets with ApproxMethod.relAndAbs. That is call scalarApproxRelAndAbs on each couple of the data sets.
approxUlp approx!(ApproxMethod.ulp) Compare two data sets with ApproxMethod.ulp. That is call scalarApproxUlp on each couple of the data sets.
approxUlpAndAbs approx!(ApproxMethod.ulpAndAbs) Compare two data sets with ApproxMethod.ulpAndAbs. That is call scalarApproxUlpAndAbs on each couple of the data sets.