Average Error: 3.6 → 3.6
Time: 10.5s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[x \cdot \left(z \cdot \left(y - 1\right) + 1\right)\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
x \cdot \left(z \cdot \left(y - 1\right) + 1\right)
double f(double x, double y, double z) {
        double r592748 = x;
        double r592749 = 1.0;
        double r592750 = y;
        double r592751 = r592749 - r592750;
        double r592752 = z;
        double r592753 = r592751 * r592752;
        double r592754 = r592749 - r592753;
        double r592755 = r592748 * r592754;
        return r592755;
}

double f(double x, double y, double z) {
        double r592756 = x;
        double r592757 = z;
        double r592758 = y;
        double r592759 = 1.0;
        double r592760 = r592758 - r592759;
        double r592761 = r592757 * r592760;
        double r592762 = r592761 + r592759;
        double r592763 = r592756 * r592762;
        return r592763;
}

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.2
Herbie3.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. Split input into 2 regimes
  2. if z < -7.801101333405402e-55 or 5.2427137483546105e-19 < z

    1. Initial program 7.8

      \[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
    2. Using strategy rm
    3. Applied sub-neg7.8

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

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

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

    if -7.801101333405402e-55 < z < 5.2427137483546105e-19

    1. Initial program 0.1

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

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

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

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

      \[\leadsto x \cdot 1 + \left(x \cdot z\right) \cdot \color{blue}{\left(y + \left(-1\right)\right)}\]
    8. Applied distribute-rgt-in3.0

      \[\leadsto x \cdot 1 + \color{blue}{\left(y \cdot \left(x \cdot z\right) + \left(-1\right) \cdot \left(x \cdot z\right)\right)}\]
    9. Applied associate-+r+3.0

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

      \[\leadsto \color{blue}{x \cdot \left(z \cdot y + 1\right)} + \left(-1\right) \cdot \left(x \cdot z\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.6

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

Reproduce

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