Average Error: 0.2 → 0.2
Time: 15.9s
Precision: 64
\[\left(\left(x - \frac{16.0}{116.0}\right) \cdot 3.0\right) \cdot y\]
\[\mathsf{fma}\left(3.0, x, -0.41379310344827586\right) \cdot y\]
\left(\left(x - \frac{16.0}{116.0}\right) \cdot 3.0\right) \cdot y
\mathsf{fma}\left(3.0, x, -0.41379310344827586\right) \cdot y
double f(double x, double y) {
        double r33601201 = x;
        double r33601202 = 16.0;
        double r33601203 = 116.0;
        double r33601204 = r33601202 / r33601203;
        double r33601205 = r33601201 - r33601204;
        double r33601206 = 3.0;
        double r33601207 = r33601205 * r33601206;
        double r33601208 = y;
        double r33601209 = r33601207 * r33601208;
        return r33601209;
}

double f(double x, double y) {
        double r33601210 = 3.0;
        double r33601211 = x;
        double r33601212 = 0.41379310344827586;
        double r33601213 = -r33601212;
        double r33601214 = fma(r33601210, r33601211, r33601213);
        double r33601215 = y;
        double r33601216 = r33601214 * r33601215;
        return r33601216;
}

Error

Bits error versus x

Bits error versus y

Target

Original0.2
Target0.2
Herbie0.2
\[y \cdot \left(x \cdot 3.0 - 0.41379310344827586\right)\]

Derivation

  1. Initial program 0.2

    \[\left(\left(x - \frac{16.0}{116.0}\right) \cdot 3.0\right) \cdot y\]
  2. Using strategy rm
  3. Applied associate-*l*0.3

    \[\leadsto \color{blue}{\left(x - \frac{16.0}{116.0}\right) \cdot \left(3.0 \cdot y\right)}\]
  4. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{3.0 \cdot \left(x \cdot y\right) - 0.41379310344827586 \cdot y}\]
  5. Simplified0.2

    \[\leadsto \color{blue}{\left(3.0 \cdot x - 0.41379310344827586\right) \cdot y}\]
  6. Using strategy rm
  7. Applied fma-neg0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(3.0, x, -0.41379310344827586\right)} \cdot y\]
  8. Final simplification0.2

    \[\leadsto \mathsf{fma}\left(3.0, x, -0.41379310344827586\right) \cdot y\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.CIE:cieLAB from colour-2.3.3, A"

  :herbie-target
  (* y (- (* x 3.0) 0.41379310344827586))

  (* (* (- x (/ 16.0 116.0)) 3.0) y))