Average Error: 16.9 → 0.0
Time: 1.8s
Precision: 64
\[x + \left(1 - x\right) \cdot \left(1 - y\right)\]
\[\mathsf{fma}\left(y, x, 1 - 1 \cdot y\right)\]
x + \left(1 - x\right) \cdot \left(1 - y\right)
\mathsf{fma}\left(y, x, 1 - 1 \cdot y\right)
double f(double x, double y) {
        double r2177 = x;
        double r2178 = 1.0;
        double r2179 = r2178 - r2177;
        double r2180 = y;
        double r2181 = r2178 - r2180;
        double r2182 = r2179 * r2181;
        double r2183 = r2177 + r2182;
        return r2183;
}

double f(double x, double y) {
        double r2184 = y;
        double r2185 = x;
        double r2186 = 1.0;
        double r2187 = r2186 * r2184;
        double r2188 = r2186 - r2187;
        double r2189 = fma(r2184, r2185, r2188);
        return r2189;
}

Error

Bits error versus x

Bits error versus y

Target

Original16.9
Target0.0
Herbie0.0
\[y \cdot x - \left(y - 1\right)\]

Derivation

  1. Initial program 16.9

    \[x + \left(1 - x\right) \cdot \left(1 - y\right)\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(x \cdot y + 1\right) - 1 \cdot y}\]
  3. Simplified0.0

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

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

Reproduce

herbie shell --seed 2020025 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (- (* y x) (- y 1))

  (+ x (* (- 1 x) (- 1 y))))