Average Error: 0.0 → 0.0
Time: 4.0s
Precision: 64
\[x \cdot y + z \cdot \left(1.0 - y\right)\]
\[\left(z \cdot 1.0 + \left(-z\right) \cdot y\right) + x \cdot y\]
x \cdot y + z \cdot \left(1.0 - y\right)
\left(z \cdot 1.0 + \left(-z\right) \cdot y\right) + x \cdot y
double f(double x, double y, double z) {
        double r13629257 = x;
        double r13629258 = y;
        double r13629259 = r13629257 * r13629258;
        double r13629260 = z;
        double r13629261 = 1.0;
        double r13629262 = r13629261 - r13629258;
        double r13629263 = r13629260 * r13629262;
        double r13629264 = r13629259 + r13629263;
        return r13629264;
}

double f(double x, double y, double z) {
        double r13629265 = z;
        double r13629266 = 1.0;
        double r13629267 = r13629265 * r13629266;
        double r13629268 = -r13629265;
        double r13629269 = y;
        double r13629270 = r13629268 * r13629269;
        double r13629271 = r13629267 + r13629270;
        double r13629272 = x;
        double r13629273 = r13629272 * r13629269;
        double r13629274 = r13629271 + r13629273;
        return r13629274;
}

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. Final simplification0.0

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

Reproduce

herbie shell --seed 2019156 
(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))))