Average Error: 16.7 → 0.0
Time: 993.0ms
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 r534135 = x;
        double r534136 = 1.0;
        double r534137 = r534136 - r534135;
        double r534138 = y;
        double r534139 = r534136 - r534138;
        double r534140 = r534137 * r534139;
        double r534141 = r534135 + r534140;
        return r534141;
}

double f(double x, double y) {
        double r534142 = y;
        double r534143 = x;
        double r534144 = 1.0;
        double r534145 = r534144 * r534142;
        double r534146 = r534144 - r534145;
        double r534147 = fma(r534142, r534143, r534146);
        return r534147;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 16.7

    \[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 2020002 +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))))