Average Error: 0.0 → 0.0
Time: 13.8s
Precision: 64
\[x \cdot y + z \cdot \left(1.0 - y\right)\]
\[z \cdot 1.0 + \left(x - z\right) \cdot y\]
x \cdot y + z \cdot \left(1.0 - y\right)
z \cdot 1.0 + \left(x - z\right) \cdot y
double f(double x, double y, double z) {
        double r27206450 = x;
        double r27206451 = y;
        double r27206452 = r27206450 * r27206451;
        double r27206453 = z;
        double r27206454 = 1.0;
        double r27206455 = r27206454 - r27206451;
        double r27206456 = r27206453 * r27206455;
        double r27206457 = r27206452 + r27206456;
        return r27206457;
}

double f(double x, double y, double z) {
        double r27206458 = z;
        double r27206459 = 1.0;
        double r27206460 = r27206458 * r27206459;
        double r27206461 = x;
        double r27206462 = r27206461 - r27206458;
        double r27206463 = y;
        double r27206464 = r27206462 * r27206463;
        double r27206465 = r27206460 + r27206464;
        return r27206465;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[z - \left(z - x\right) \cdot y\]

Derivation

  1. Initial program 0.0

    \[x \cdot y + z \cdot \left(1.0 - y\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.0

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

    \[\leadsto x \cdot y + \color{blue}{\left(z \cdot 1.0 + z \cdot \left(-y\right)\right)}\]
  5. Using strategy rm
  6. Applied +-commutative0.0

    \[\leadsto x \cdot y + \color{blue}{\left(z \cdot \left(-y\right) + z \cdot 1.0\right)}\]
  7. Applied associate-+r+0.0

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

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

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

Reproduce

herbie shell --seed 2019158 
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment:bezierClip from diagrams-lib-1.3.0.3"

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

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