Average Error: 3.4 → 1.4
Time: 13.3s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[\left(y - 1\right) \cdot \left(z \cdot x\right) + x \cdot 1\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\left(y - 1\right) \cdot \left(z \cdot x\right) + x \cdot 1
double f(double x, double y, double z) {
        double r48654898 = x;
        double r48654899 = 1.0;
        double r48654900 = y;
        double r48654901 = r48654899 - r48654900;
        double r48654902 = z;
        double r48654903 = r48654901 * r48654902;
        double r48654904 = r48654899 - r48654903;
        double r48654905 = r48654898 * r48654904;
        return r48654905;
}

double f(double x, double y, double z) {
        double r48654906 = y;
        double r48654907 = 1.0;
        double r48654908 = r48654906 - r48654907;
        double r48654909 = z;
        double r48654910 = x;
        double r48654911 = r48654909 * r48654910;
        double r48654912 = r48654908 * r48654911;
        double r48654913 = r48654910 * r48654907;
        double r48654914 = r48654912 + r48654913;
        return r48654914;
}

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

    \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
  2. Using strategy rm
  3. Applied *-commutative3.4

    \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot \left(1 - y\right)}\right)\]
  4. Using strategy rm
  5. Applied sub-neg3.4

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

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

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

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

Reproduce

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