Average Error: 4.4 → 5.3
Time: 14.6s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.197549872885190239742774596655517365607 \cdot 10^{-85} \lor \neg \left(z \le 2.353922025702669359847047635010661882772 \cdot 10^{145}\right):\\ \;\;\;\;\left(x \cdot \left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)\right) \cdot \sqrt[3]{\frac{y}{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot y\right) \cdot \left(1 - z\right) + z \cdot \left(x \cdot \left(-t\right)\right)}{z \cdot \left(1 - z\right)}\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;z \le -3.197549872885190239742774596655517365607 \cdot 10^{-85} \lor \neg \left(z \le 2.353922025702669359847047635010661882772 \cdot 10^{145}\right):\\
\;\;\;\;\left(x \cdot \left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)\right) \cdot \sqrt[3]{\frac{y}{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot y\right) \cdot \left(1 - z\right) + z \cdot \left(x \cdot \left(-t\right)\right)}{z \cdot \left(1 - z\right)}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r327727 = x;
        double r327728 = y;
        double r327729 = z;
        double r327730 = r327728 / r327729;
        double r327731 = t;
        double r327732 = 1.0;
        double r327733 = r327732 - r327729;
        double r327734 = r327731 / r327733;
        double r327735 = r327730 - r327734;
        double r327736 = r327727 * r327735;
        return r327736;
}

double f(double x, double y, double z, double t) {
        double r327737 = z;
        double r327738 = -3.19754987288519e-85;
        bool r327739 = r327737 <= r327738;
        double r327740 = 2.3539220257026694e+145;
        bool r327741 = r327737 <= r327740;
        double r327742 = !r327741;
        bool r327743 = r327739 || r327742;
        double r327744 = x;
        double r327745 = y;
        double r327746 = r327745 / r327737;
        double r327747 = cbrt(r327746);
        double r327748 = r327747 * r327747;
        double r327749 = r327744 * r327748;
        double r327750 = r327749 * r327747;
        double r327751 = t;
        double r327752 = 1.0;
        double r327753 = r327752 - r327737;
        double r327754 = r327751 / r327753;
        double r327755 = -r327754;
        double r327756 = r327744 * r327755;
        double r327757 = r327750 + r327756;
        double r327758 = r327744 * r327745;
        double r327759 = r327758 * r327753;
        double r327760 = -r327751;
        double r327761 = r327744 * r327760;
        double r327762 = r327737 * r327761;
        double r327763 = r327759 + r327762;
        double r327764 = r327737 * r327753;
        double r327765 = r327763 / r327764;
        double r327766 = r327743 ? r327757 : r327765;
        return r327766;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original4.4
Target4.0
Herbie5.3
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt -7.623226303312042442144691872793570510727 \cdot 10^{-196}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt 1.413394492770230216018398633584271456447 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3.19754987288519e-85 or 2.3539220257026694e+145 < z

    1. Initial program 2.5

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Using strategy rm
    3. Applied sub-neg2.5

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt3.0

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

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

    if -3.19754987288519e-85 < z < 2.3539220257026694e+145

    1. Initial program 6.5

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}\]
    5. Using strategy rm
    6. Applied distribute-neg-frac6.5

      \[\leadsto x \cdot \frac{y}{z} + x \cdot \color{blue}{\frac{-t}{1 - z}}\]
    7. Applied associate-*r/7.4

      \[\leadsto x \cdot \frac{y}{z} + \color{blue}{\frac{x \cdot \left(-t\right)}{1 - z}}\]
    8. Applied associate-*r/4.8

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + \frac{x \cdot \left(-t\right)}{1 - z}\]
    9. Applied frac-add7.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.197549872885190239742774596655517365607 \cdot 10^{-85} \lor \neg \left(z \le 2.353922025702669359847047635010661882772 \cdot 10^{145}\right):\\ \;\;\;\;\left(x \cdot \left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)\right) \cdot \sqrt[3]{\frac{y}{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot y\right) \cdot \left(1 - z\right) + z \cdot \left(x \cdot \left(-t\right)\right)}{z \cdot \left(1 - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019212 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
  :precision binary64

  :herbie-target
  (if (< (* x (- (/ y z) (/ t (- 1 z)))) -7.62322630331204244e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.41339449277023022e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

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