Average Error: 3.3 → 1.6
Time: 19.4s
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 r1275607 = x;
        double r1275608 = 1.0;
        double r1275609 = y;
        double r1275610 = r1275608 - r1275609;
        double r1275611 = z;
        double r1275612 = r1275610 * r1275611;
        double r1275613 = r1275608 - r1275612;
        double r1275614 = r1275607 * r1275613;
        return r1275614;
}

double f(double x, double y, double z) {
        double r1275615 = 1.0;
        double r1275616 = x;
        double r1275617 = r1275615 * r1275616;
        double r1275618 = z;
        double r1275619 = r1275616 * r1275618;
        double r1275620 = y;
        double r1275621 = r1275620 - r1275615;
        double r1275622 = r1275619 * r1275621;
        double r1275623 = r1275617 + r1275622;
        return r1275623;
}

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. Using strategy rm
  3. Applied sub-neg3.3

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

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

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

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

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

Reproduce

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