Average Error: 0.2 → 0.2
Time: 2.1s
Precision: 64
\[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y\]
\[y \cdot \mathsf{fma}\left(3, x, -0.413793103448275856\right)\]
\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y
y \cdot \mathsf{fma}\left(3, x, -0.413793103448275856\right)
double f(double x, double y) {
        double r871878 = x;
        double r871879 = 16.0;
        double r871880 = 116.0;
        double r871881 = r871879 / r871880;
        double r871882 = r871878 - r871881;
        double r871883 = 3.0;
        double r871884 = r871882 * r871883;
        double r871885 = y;
        double r871886 = r871884 * r871885;
        return r871886;
}

double f(double x, double y) {
        double r871887 = y;
        double r871888 = 3.0;
        double r871889 = x;
        double r871890 = 0.41379310344827586;
        double r871891 = -r871890;
        double r871892 = fma(r871888, r871889, r871891);
        double r871893 = r871887 * r871892;
        return r871893;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 0.2

    \[\left(\left(x - \frac{16}{116}\right) \cdot 3\right) \cdot y\]
  2. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{3 \cdot \left(x \cdot y\right) - 0.413793103448275856 \cdot y}\]
  3. Simplified0.2

    \[\leadsto \color{blue}{y \cdot \left(3 \cdot x - 0.413793103448275856\right)}\]
  4. Using strategy rm
  5. Applied fma-neg0.2

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

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

Reproduce

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

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

  (* (* (- x (/ 16 116)) 3) y))