Average Error: 0.0 → 0.0
Time: 11.4s
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 r45882070 = 1.0;
        double r45882071 = x;
        double r45882072 = r45882070 - r45882071;
        double r45882073 = y;
        double r45882074 = r45882072 * r45882073;
        double r45882075 = z;
        double r45882076 = r45882071 * r45882075;
        double r45882077 = r45882074 + r45882076;
        return r45882077;
}

double f(double x, double y, double z) {
        double r45882078 = y;
        double r45882079 = 1.0;
        double r45882080 = r45882078 * r45882079;
        double r45882081 = x;
        double r45882082 = z;
        double r45882083 = r45882082 - r45882078;
        double r45882084 = r45882081 * r45882083;
        double r45882085 = r45882080 + r45882084;
        return r45882085;
}

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)))