Average Error: 0.0 → 0.1
Time: 1.5s
Precision: 64
\[x + \frac{y}{500}\]
\[\mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)\]
x + \frac{y}{500}
\mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)
double f(double x, double y) {
        double r211926 = x;
        double r211927 = y;
        double r211928 = 500.0;
        double r211929 = r211927 / r211928;
        double r211930 = r211926 + r211929;
        return r211930;
}

double f(double x, double y) {
        double r211931 = y;
        double r211932 = 0.002;
        double r211933 = x;
        double r211934 = fma(r211931, r211932, r211933);
        return r211934;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[x + \frac{y}{500}\]
  2. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{x + 2 \cdot 10^{-3} \cdot y}\]
  3. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)}\]
  4. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)\]

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.CIE:cieLAB from colour-2.3.3, C"
  :precision binary64
  (+ x (/ y 500)))