Average Error: 16.8 → 0.0
Time: 6.2s
Precision: binary64
\[x + \left(1 - x\right) \cdot \left(1 - y\right)\]
\[\left(x \cdot y + \left(-1\right) \cdot y\right) + 1\]

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 16.8

    \[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}{y \cdot \left(x - 1\right) + 1}\]
  4. Using strategy rm
  5. Applied sub-neg0.0

    \[\leadsto y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + 1\]
  6. Applied distribute-lft-in0.0

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

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

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

    \[\leadsto \left(x \cdot y + \left(-1\right) \cdot y\right) + 1\]

Reproduce

herbie shell --seed 2020182 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
  :precision binary64

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

  (+ x (* (- 1.0 x) (- 1.0 y))))