Average Error: 3.0 → 0.1
Time: 12.5s
Precision: 64
\[x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \le -1.072826232890164556333944420810865892942 \cdot 10^{68}:\\ \;\;\;\;1 \cdot x + \left(\left(x \cdot z\right) \cdot y + \left(x \cdot z\right) \cdot \left(-1\right)\right)\\ \mathbf{elif}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \le 4.064296680507862258452239400400759184408 \cdot 10^{301}:\\ \;\;\;\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x + \left(\left(\left(x \cdot z\right) \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \sqrt[3]{y} + \left(x \cdot z\right) \cdot \left(-1\right)\right)\\ \end{array}\]
x \cdot \left(1 - \left(1 - y\right) \cdot z\right)
\begin{array}{l}
\mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \le -1.072826232890164556333944420810865892942 \cdot 10^{68}:\\
\;\;\;\;1 \cdot x + \left(\left(x \cdot z\right) \cdot y + \left(x \cdot z\right) \cdot \left(-1\right)\right)\\

\mathbf{elif}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \le 4.064296680507862258452239400400759184408 \cdot 10^{301}:\\
\;\;\;\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot x + \left(\left(\left(x \cdot z\right) \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \sqrt[3]{y} + \left(x \cdot z\right) \cdot \left(-1\right)\right)\\

\end{array}
double f(double x, double y, double z) {
        double r841780 = x;
        double r841781 = 1.0;
        double r841782 = y;
        double r841783 = r841781 - r841782;
        double r841784 = z;
        double r841785 = r841783 * r841784;
        double r841786 = r841781 - r841785;
        double r841787 = r841780 * r841786;
        return r841787;
}

double f(double x, double y, double z) {
        double r841788 = x;
        double r841789 = 1.0;
        double r841790 = y;
        double r841791 = r841789 - r841790;
        double r841792 = z;
        double r841793 = r841791 * r841792;
        double r841794 = r841789 - r841793;
        double r841795 = r841788 * r841794;
        double r841796 = -1.0728262328901646e+68;
        bool r841797 = r841795 <= r841796;
        double r841798 = r841789 * r841788;
        double r841799 = r841788 * r841792;
        double r841800 = r841799 * r841790;
        double r841801 = -r841789;
        double r841802 = r841799 * r841801;
        double r841803 = r841800 + r841802;
        double r841804 = r841798 + r841803;
        double r841805 = 4.0642966805078623e+301;
        bool r841806 = r841795 <= r841805;
        double r841807 = cbrt(r841790);
        double r841808 = r841807 * r841807;
        double r841809 = r841799 * r841808;
        double r841810 = r841809 * r841807;
        double r841811 = r841810 + r841802;
        double r841812 = r841798 + r841811;
        double r841813 = r841806 ? r841795 : r841812;
        double r841814 = r841797 ? r841804 : r841813;
        return r841814;
}

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.0
Target0.2
Herbie0.1
\[\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 3 regimes
  2. if (* x (- 1.0 (* (- 1.0 y) z))) < -1.0728262328901646e+68

    1. Initial program 6.1

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

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

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

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

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

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

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

    if -1.0728262328901646e+68 < (* x (- 1.0 (* (- 1.0 y) z))) < 4.0642966805078623e+301

    1. Initial program 0.1

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

    if 4.0642966805078623e+301 < (* x (- 1.0 (* (- 1.0 y) z)))

    1. Initial program 50.7

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \le -1.072826232890164556333944420810865892942 \cdot 10^{68}:\\ \;\;\;\;1 \cdot x + \left(\left(x \cdot z\right) \cdot y + \left(x \cdot z\right) \cdot \left(-1\right)\right)\\ \mathbf{elif}\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right) \le 4.064296680507862258452239400400759184408 \cdot 10^{301}:\\ \;\;\;\;x \cdot \left(1 - \left(1 - y\right) \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x + \left(\left(\left(x \cdot z\right) \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \sqrt[3]{y} + \left(x \cdot z\right) \cdot \left(-1\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019350 
(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.618195973607049e+50) (+ x (* (- 1 y) (* (- z) x))) (if (< (* x (- 1 (* (- 1 y) z))) 3.892237649663903e+134) (- (* (* x y) z) (- (* x z) x)) (+ x (* (- 1 y) (* (- z) x)))))

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