Average Error: 16.5 → 0.0
Time: 8.8s
Precision: 64
\[x + \left(1 - x\right) \cdot \left(1 - y\right)\]
\[\mathsf{fma}\left(x, y, 1\right) - 1 \cdot y\]
x + \left(1 - x\right) \cdot \left(1 - y\right)
\mathsf{fma}\left(x, y, 1\right) - 1 \cdot y
double f(double x, double y) {
        double r376246 = x;
        double r376247 = 1.0;
        double r376248 = r376247 - r376246;
        double r376249 = y;
        double r376250 = r376247 - r376249;
        double r376251 = r376248 * r376250;
        double r376252 = r376246 + r376251;
        return r376252;
}

double f(double x, double y) {
        double r376253 = x;
        double r376254 = y;
        double r376255 = 1.0;
        double r376256 = fma(r376253, r376254, r376255);
        double r376257 = r376255 * r376254;
        double r376258 = r376256 - r376257;
        return r376258;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 16.5

    \[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(x, y, 1\right) - 1 \cdot y}\]
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019305 +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))))