Average Error: 0.0 → 0.0
Time: 5.1s
Precision: 64
\[x \cdot y + z \cdot \left(1 - y\right)\]
\[x \cdot y + \left(1 \cdot z + \left(-y\right) \cdot z\right)\]
x \cdot y + z \cdot \left(1 - y\right)
x \cdot y + \left(1 \cdot z + \left(-y\right) \cdot z\right)
double f(double x, double y, double z) {
        double r697693 = x;
        double r697694 = y;
        double r697695 = r697693 * r697694;
        double r697696 = z;
        double r697697 = 1.0;
        double r697698 = r697697 - r697694;
        double r697699 = r697696 * r697698;
        double r697700 = r697695 + r697699;
        return r697700;
}

double f(double x, double y, double z) {
        double r697701 = x;
        double r697702 = y;
        double r697703 = r697701 * r697702;
        double r697704 = 1.0;
        double r697705 = z;
        double r697706 = r697704 * r697705;
        double r697707 = -r697702;
        double r697708 = r697707 * r697705;
        double r697709 = r697706 + r697708;
        double r697710 = r697703 + r697709;
        return r697710;
}

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 - y\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.0

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

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

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

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

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

Reproduce

herbie shell --seed 2020042 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment:bezierClip from diagrams-lib-1.3.0.3"
  :precision binary64

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

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