Average Error: 3.3 → 1.6
Time: 14.3s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[\left(y - 1\right) \cdot \left(z \cdot x\right) + 1 \cdot x\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\left(y - 1\right) \cdot \left(z \cdot x\right) + 1 \cdot x
double f(double x, double y, double z) {
        double r39813703 = x;
        double r39813704 = 1.0;
        double r39813705 = y;
        double r39813706 = r39813704 - r39813705;
        double r39813707 = z;
        double r39813708 = r39813706 * r39813707;
        double r39813709 = r39813704 - r39813708;
        double r39813710 = r39813703 * r39813709;
        return r39813710;
}

double f(double x, double y, double z) {
        double r39813711 = y;
        double r39813712 = 1.0;
        double r39813713 = r39813711 - r39813712;
        double r39813714 = z;
        double r39813715 = x;
        double r39813716 = r39813714 * r39813715;
        double r39813717 = r39813713 * r39813716;
        double r39813718 = r39813712 * r39813715;
        double r39813719 = r39813717 + r39813718;
        return r39813719;
}

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.3
Target0.2
Herbie1.6
\[\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.3

    \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
  2. Taylor expanded around inf 3.3

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

    \[\leadsto \color{blue}{1 \cdot x + z \cdot \left(x \cdot y - 1 \cdot x\right)}\]
  4. Taylor expanded around inf 3.3

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

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

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

Reproduce

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