Average Error: 0.0 → 0.0
Time: 15.9s
Precision: 64
\[\left(1 - x\right) \cdot y + x \cdot z\]
\[y \cdot 1 + x \cdot \left(z - y\right)\]
\left(1 - x\right) \cdot y + x \cdot z
y \cdot 1 + x \cdot \left(z - y\right)
double f(double x, double y, double z) {
        double r41233636 = 1.0;
        double r41233637 = x;
        double r41233638 = r41233636 - r41233637;
        double r41233639 = y;
        double r41233640 = r41233638 * r41233639;
        double r41233641 = z;
        double r41233642 = r41233637 * r41233641;
        double r41233643 = r41233640 + r41233642;
        return r41233643;
}

double f(double x, double y, double z) {
        double r41233644 = y;
        double r41233645 = 1.0;
        double r41233646 = r41233644 * r41233645;
        double r41233647 = x;
        double r41233648 = z;
        double r41233649 = r41233648 - r41233644;
        double r41233650 = r41233647 * r41233649;
        double r41233651 = r41233646 + r41233650;
        return r41233651;
}

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
\[y - x \cdot \left(y - z\right)\]

Derivation

  1. Initial program 0.0

    \[\left(1 - x\right) \cdot y + x \cdot z\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt12.3

    \[\leadsto \color{blue}{\left(\sqrt{1 - x} \cdot \sqrt{1 - x}\right)} \cdot y + x \cdot z\]
  4. Applied associate-*l*12.3

    \[\leadsto \color{blue}{\sqrt{1 - x} \cdot \left(\sqrt{1 - x} \cdot y\right)} + x \cdot z\]
  5. Taylor expanded around 0 0.0

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

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

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

Reproduce

herbie shell --seed 2019171 
(FPCore (x y z)
  :name "Diagrams.Color.HSV:lerp  from diagrams-contrib-1.3.0.5"

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

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