Average Error: 0.0 → 0.1
Time: 1.6s
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 r261177 = x;
        double r261178 = y;
        double r261179 = 500.0;
        double r261180 = r261178 / r261179;
        double r261181 = r261177 + r261180;
        return r261181;
}

double f(double x, double y) {
        double r261182 = y;
        double r261183 = 0.002;
        double r261184 = x;
        double r261185 = fma(r261182, r261183, r261184);
        return r261185;
}

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)))