Average Error: 3.6 → 1.5
Time: 11.9s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[1 \cdot x + \left(x \cdot z\right) \cdot \left(y - 1\right)\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
1 \cdot x + \left(x \cdot z\right) \cdot \left(y - 1\right)
double f(double x, double y, double z) {
        double r651546 = x;
        double r651547 = 1.0;
        double r651548 = y;
        double r651549 = r651547 - r651548;
        double r651550 = z;
        double r651551 = r651549 * r651550;
        double r651552 = r651547 - r651551;
        double r651553 = r651546 * r651552;
        return r651553;
}

double f(double x, double y, double z) {
        double r651554 = 1.0;
        double r651555 = x;
        double r651556 = r651554 * r651555;
        double r651557 = z;
        double r651558 = r651555 * r651557;
        double r651559 = y;
        double r651560 = r651559 - r651554;
        double r651561 = r651558 * r651560;
        double r651562 = r651556 + r651561;
        return r651562;
}

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.6
Target0.3
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.6

    \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
  2. Using strategy rm
  3. Applied add-cube-cbrt3.9

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

    \[\leadsto x \cdot \left(1 - \color{blue}{\left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right) \cdot \left(\sqrt[3]{1 - y} \cdot z\right)}\right)\]
  5. Using strategy rm
  6. Applied add-cube-cbrt4.9

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

    \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(1 - \left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right) \cdot \left(\sqrt[3]{1 - y} \cdot z\right)\right)\right)}\]
  8. Simplified4.9

    \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\left(1 - z \cdot \left(1 - y\right)\right) \cdot \sqrt[3]{x}\right)}\]
  9. Taylor expanded around inf 3.6

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

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

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

Reproduce

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

  :herbie-target
  (if (< (* x (- 1 (* (- 1 y) z))) -1.618195973607049e50) (+ x (* (- 1 y) (* (- z) x))) (if (< (* x (- 1 (* (- 1 y) z))) 3.8922376496639029e134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1 y) (* (- z) x)))))

  (* x (- 1 (* (- 1 y) z))))