Average Error: 3.3 → 1.6
Time: 11.8s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[\left(-\left(x \cdot z\right) \cdot \left(1 - y\right)\right) + x \cdot 1\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\left(-\left(x \cdot z\right) \cdot \left(1 - y\right)\right) + x \cdot 1
double f(double x, double y, double z) {
        double r681140 = x;
        double r681141 = 1.0;
        double r681142 = y;
        double r681143 = r681141 - r681142;
        double r681144 = z;
        double r681145 = r681143 * r681144;
        double r681146 = r681141 - r681145;
        double r681147 = r681140 * r681146;
        return r681147;
}

double f(double x, double y, double z) {
        double r681148 = x;
        double r681149 = z;
        double r681150 = r681148 * r681149;
        double r681151 = 1.0;
        double r681152 = y;
        double r681153 = r681151 - r681152;
        double r681154 = r681150 * r681153;
        double r681155 = -r681154;
        double r681156 = r681148 * r681151;
        double r681157 = r681155 + r681156;
        return r681157;
}

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. Using strategy rm
  6. Applied distribute-rgt-neg-in3.3

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

    \[\leadsto x \cdot 1 + \color{blue}{\left(x \cdot \left(1 - y\right)\right) \cdot \left(-z\right)}\]
  8. Using strategy rm
  9. Applied add-cube-cbrt4.0

    \[\leadsto x \cdot 1 + \left(x \cdot \color{blue}{\left(\left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right) \cdot \sqrt[3]{1 - y}\right)}\right) \cdot \left(-z\right)\]
  10. Applied associate-*r*4.0

    \[\leadsto x \cdot 1 + \color{blue}{\left(\left(x \cdot \left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)\right) \cdot \sqrt[3]{1 - y}\right)} \cdot \left(-z\right)\]
  11. Using strategy rm
  12. Applied pow14.0

    \[\leadsto x \cdot 1 + \left(\left(x \cdot \left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)\right) \cdot \sqrt[3]{1 - y}\right) \cdot \color{blue}{{\left(-z\right)}^{1}}\]
  13. Applied pow14.0

    \[\leadsto x \cdot 1 + \left(\left(x \cdot \left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)\right) \cdot \color{blue}{{\left(\sqrt[3]{1 - y}\right)}^{1}}\right) \cdot {\left(-z\right)}^{1}\]
  14. Applied pow14.0

    \[\leadsto x \cdot 1 + \left(\left(x \cdot \left(\sqrt[3]{1 - y} \cdot \color{blue}{{\left(\sqrt[3]{1 - y}\right)}^{1}}\right)\right) \cdot {\left(\sqrt[3]{1 - y}\right)}^{1}\right) \cdot {\left(-z\right)}^{1}\]
  15. Applied pow14.0

    \[\leadsto x \cdot 1 + \left(\left(x \cdot \left(\color{blue}{{\left(\sqrt[3]{1 - y}\right)}^{1}} \cdot {\left(\sqrt[3]{1 - y}\right)}^{1}\right)\right) \cdot {\left(\sqrt[3]{1 - y}\right)}^{1}\right) \cdot {\left(-z\right)}^{1}\]
  16. Applied pow-prod-down4.0

    \[\leadsto x \cdot 1 + \left(\left(x \cdot \color{blue}{{\left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{1 - y}\right)}^{1}\right) \cdot {\left(-z\right)}^{1}\]
  17. Applied pow14.0

    \[\leadsto x \cdot 1 + \left(\left(\color{blue}{{x}^{1}} \cdot {\left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)}^{1}\right) \cdot {\left(\sqrt[3]{1 - y}\right)}^{1}\right) \cdot {\left(-z\right)}^{1}\]
  18. Applied pow-prod-down4.0

    \[\leadsto x \cdot 1 + \left(\color{blue}{{\left(x \cdot \left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)\right)}^{1}} \cdot {\left(\sqrt[3]{1 - y}\right)}^{1}\right) \cdot {\left(-z\right)}^{1}\]
  19. Applied pow-prod-down4.0

    \[\leadsto x \cdot 1 + \color{blue}{{\left(\left(x \cdot \left(\sqrt[3]{1 - y} \cdot \sqrt[3]{1 - y}\right)\right) \cdot \sqrt[3]{1 - y}\right)}^{1}} \cdot {\left(-z\right)}^{1}\]
  20. Applied pow-prod-down4.0

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

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

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

Reproduce

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