Average Error: 4.6 → 0.7
Time: 17.9s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.007754772207803266512538059619218197951 \cdot 10^{262}:\\ \;\;\;\;\frac{t}{1 - z} \cdot \left(-x\right) + \frac{y \cdot x}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.641439917105171742816158608249412846815 \cdot 10^{-276}:\\ \;\;\;\;\sqrt[3]{\frac{y}{z} \cdot x} \cdot \left(\sqrt[3]{\frac{y}{z} \cdot x} \cdot \sqrt[3]{\frac{y}{z} \cdot x}\right) + \frac{t}{1 - z} \cdot \left(-x\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.378445478884851154192126416524790479579 \cdot 10^{-248}:\\ \;\;\;\;\left(\frac{t \cdot 1}{\frac{z}{\frac{x}{z}}} + \frac{t}{\frac{z}{x}}\right) + \frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.772874363086529249776549417961962189001 \cdot 10^{265}:\\ \;\;\;\;\sqrt[3]{\frac{y}{z} \cdot x} \cdot \left(\sqrt[3]{\frac{y}{z} \cdot x} \cdot \sqrt[3]{\frac{y}{z} \cdot x}\right) + \frac{t}{1 - z} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{1 - z} \cdot \left(-x\right) + \frac{y \cdot x}{z}\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.007754772207803266512538059619218197951 \cdot 10^{262}:\\
\;\;\;\;\frac{t}{1 - z} \cdot \left(-x\right) + \frac{y \cdot x}{z}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.641439917105171742816158608249412846815 \cdot 10^{-276}:\\
\;\;\;\;\sqrt[3]{\frac{y}{z} \cdot x} \cdot \left(\sqrt[3]{\frac{y}{z} \cdot x} \cdot \sqrt[3]{\frac{y}{z} \cdot x}\right) + \frac{t}{1 - z} \cdot \left(-x\right)\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.378445478884851154192126416524790479579 \cdot 10^{-248}:\\
\;\;\;\;\left(\frac{t \cdot 1}{\frac{z}{\frac{x}{z}}} + \frac{t}{\frac{z}{x}}\right) + \frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.772874363086529249776549417961962189001 \cdot 10^{265}:\\
\;\;\;\;\sqrt[3]{\frac{y}{z} \cdot x} \cdot \left(\sqrt[3]{\frac{y}{z} \cdot x} \cdot \sqrt[3]{\frac{y}{z} \cdot x}\right) + \frac{t}{1 - z} \cdot \left(-x\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r19642917 = x;
        double r19642918 = y;
        double r19642919 = z;
        double r19642920 = r19642918 / r19642919;
        double r19642921 = t;
        double r19642922 = 1.0;
        double r19642923 = r19642922 - r19642919;
        double r19642924 = r19642921 / r19642923;
        double r19642925 = r19642920 - r19642924;
        double r19642926 = r19642917 * r19642925;
        return r19642926;
}

double f(double x, double y, double z, double t) {
        double r19642927 = y;
        double r19642928 = z;
        double r19642929 = r19642927 / r19642928;
        double r19642930 = t;
        double r19642931 = 1.0;
        double r19642932 = r19642931 - r19642928;
        double r19642933 = r19642930 / r19642932;
        double r19642934 = r19642929 - r19642933;
        double r19642935 = -2.0077547722078033e+262;
        bool r19642936 = r19642934 <= r19642935;
        double r19642937 = x;
        double r19642938 = -r19642937;
        double r19642939 = r19642933 * r19642938;
        double r19642940 = r19642927 * r19642937;
        double r19642941 = r19642940 / r19642928;
        double r19642942 = r19642939 + r19642941;
        double r19642943 = -1.6414399171051717e-276;
        bool r19642944 = r19642934 <= r19642943;
        double r19642945 = r19642929 * r19642937;
        double r19642946 = cbrt(r19642945);
        double r19642947 = r19642946 * r19642946;
        double r19642948 = r19642946 * r19642947;
        double r19642949 = r19642948 + r19642939;
        double r19642950 = 3.378445478884851e-248;
        bool r19642951 = r19642934 <= r19642950;
        double r19642952 = r19642930 * r19642931;
        double r19642953 = r19642937 / r19642928;
        double r19642954 = r19642928 / r19642953;
        double r19642955 = r19642952 / r19642954;
        double r19642956 = r19642928 / r19642937;
        double r19642957 = r19642930 / r19642956;
        double r19642958 = r19642955 + r19642957;
        double r19642959 = r19642927 / r19642956;
        double r19642960 = r19642958 + r19642959;
        double r19642961 = 2.7728743630865292e+265;
        bool r19642962 = r19642934 <= r19642961;
        double r19642963 = r19642962 ? r19642949 : r19642942;
        double r19642964 = r19642951 ? r19642960 : r19642963;
        double r19642965 = r19642944 ? r19642949 : r19642964;
        double r19642966 = r19642936 ? r19642942 : r19642965;
        return r19642966;
}

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.6
Target4.1
Herbie0.7
\[\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 3 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -2.0077547722078033e+262 or 2.7728743630865292e+265 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 35.0

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}\]
    5. Using strategy rm
    6. Applied associate-*r/0.3

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

    if -2.0077547722078033e+262 < (- (/ y z) (/ t (- 1.0 z))) < -1.6414399171051717e-276 or 3.378445478884851e-248 < (- (/ y z) (/ t (- 1.0 z))) < 2.7728743630865292e+265

    1. Initial program 0.2

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

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

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

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

    if -1.6414399171051717e-276 < (- (/ y z) (/ t (- 1.0 z))) < 3.378445478884851e-248

    1. Initial program 14.8

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}\]
    5. Taylor expanded around inf 0.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.007754772207803266512538059619218197951 \cdot 10^{262}:\\ \;\;\;\;\frac{t}{1 - z} \cdot \left(-x\right) + \frac{y \cdot x}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.641439917105171742816158608249412846815 \cdot 10^{-276}:\\ \;\;\;\;\sqrt[3]{\frac{y}{z} \cdot x} \cdot \left(\sqrt[3]{\frac{y}{z} \cdot x} \cdot \sqrt[3]{\frac{y}{z} \cdot x}\right) + \frac{t}{1 - z} \cdot \left(-x\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.378445478884851154192126416524790479579 \cdot 10^{-248}:\\ \;\;\;\;\left(\frac{t \cdot 1}{\frac{z}{\frac{x}{z}}} + \frac{t}{\frac{z}{x}}\right) + \frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.772874363086529249776549417961962189001 \cdot 10^{265}:\\ \;\;\;\;\sqrt[3]{\frac{y}{z} \cdot x} \cdot \left(\sqrt[3]{\frac{y}{z} \cdot x} \cdot \sqrt[3]{\frac{y}{z} \cdot x}\right) + \frac{t}{1 - z} \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{1 - z} \cdot \left(-x\right) + \frac{y \cdot x}{z}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))

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