Average Error: 3.8 → 1.5
Time: 14.9s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[\left(z \cdot x\right) \cdot \left(y - 1\right) + x \cdot 1\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\left(z \cdot x\right) \cdot \left(y - 1\right) + x \cdot 1
double f(double x, double y, double z) {
        double r686205 = x;
        double r686206 = 1.0;
        double r686207 = y;
        double r686208 = r686206 - r686207;
        double r686209 = z;
        double r686210 = r686208 * r686209;
        double r686211 = r686206 - r686210;
        double r686212 = r686205 * r686211;
        return r686212;
}

double f(double x, double y, double z) {
        double r686213 = z;
        double r686214 = x;
        double r686215 = r686213 * r686214;
        double r686216 = y;
        double r686217 = 1.0;
        double r686218 = r686216 - r686217;
        double r686219 = r686215 * r686218;
        double r686220 = r686214 * r686217;
        double r686221 = r686219 + r686220;
        return r686221;
}

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

Original3.8
Target0.2
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \lt -1.618195973607048970493874632750554853795 \cdot 10^{50}:\\ \;\;\;\;x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\ \mathbf{elif}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \lt 3.892237649663902900973248011051357504727 \cdot 10^{134}:\\ \;\;\;\;\left(x \cdot y\right) \cdot z - \left(x \cdot z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(1 - y\right) \cdot \left(\left(-z\right) \cdot x\right)\\ \end{array}\]

Derivation

  1. Initial program 3.8

    \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
  2. Simplified3.8

    \[\leadsto \color{blue}{x \cdot \left(1 + z \cdot \left(y - 1\right)\right)}\]
  3. Using strategy rm
  4. Applied distribute-lft-in3.8

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

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

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

Reproduce

herbie shell --seed 2019196 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, J"

  :herbie-target
  (if (< (* x (- 1.0 (* (- 1.0 y) z))) -1.618195973607049e+50) (+ x (* (- 1.0 y) (* (- z) x))) (if (< (* x (- 1.0 (* (- 1.0 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1.0 y) (* (- z) x)))))

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