Average Error: 4.6 → 4.4
Time: 41.2s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.217796665303530773920617159755679745171 \cdot 10^{63}:\\ \;\;\;\;x \cdot \left(\frac{\frac{y}{\sqrt[3]{z}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} - \frac{t}{1 - z}\right) + \left(\frac{t}{1 - z} \cdot x + \left(-x\right) \cdot \frac{t}{1 - z}\right)\\ \mathbf{elif}\;z \le 1.498822532020549452647469645076704014499 \cdot 10^{-298}:\\ \;\;\;\;\frac{x \cdot \left(\left(1 - z\right) \cdot y - t \cdot z\right)}{\left(1 - z\right) \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-t}{\sqrt[3]{1 - z}}, \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{t}{\sqrt[3]{1 - z}}\right) \cdot x + x \cdot \mathsf{fma}\left(y, \frac{1}{z}, \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right) \cdot \frac{t}{\sqrt[3]{1 - z}}\right)\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;z \le -2.217796665303530773920617159755679745171 \cdot 10^{63}:\\
\;\;\;\;x \cdot \left(\frac{\frac{y}{\sqrt[3]{z}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} - \frac{t}{1 - z}\right) + \left(\frac{t}{1 - z} \cdot x + \left(-x\right) \cdot \frac{t}{1 - z}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r18791925 = x;
        double r18791926 = y;
        double r18791927 = z;
        double r18791928 = r18791926 / r18791927;
        double r18791929 = t;
        double r18791930 = 1.0;
        double r18791931 = r18791930 - r18791927;
        double r18791932 = r18791929 / r18791931;
        double r18791933 = r18791928 - r18791932;
        double r18791934 = r18791925 * r18791933;
        return r18791934;
}

double f(double x, double y, double z, double t) {
        double r18791935 = z;
        double r18791936 = -2.2177966653035308e+63;
        bool r18791937 = r18791935 <= r18791936;
        double r18791938 = x;
        double r18791939 = y;
        double r18791940 = cbrt(r18791935);
        double r18791941 = r18791939 / r18791940;
        double r18791942 = r18791940 * r18791940;
        double r18791943 = r18791941 / r18791942;
        double r18791944 = t;
        double r18791945 = 1.0;
        double r18791946 = r18791945 - r18791935;
        double r18791947 = r18791944 / r18791946;
        double r18791948 = r18791943 - r18791947;
        double r18791949 = r18791938 * r18791948;
        double r18791950 = r18791947 * r18791938;
        double r18791951 = -r18791938;
        double r18791952 = r18791951 * r18791947;
        double r18791953 = r18791950 + r18791952;
        double r18791954 = r18791949 + r18791953;
        double r18791955 = 1.4988225320205495e-298;
        bool r18791956 = r18791935 <= r18791955;
        double r18791957 = r18791946 * r18791939;
        double r18791958 = r18791944 * r18791935;
        double r18791959 = r18791957 - r18791958;
        double r18791960 = r18791938 * r18791959;
        double r18791961 = r18791946 * r18791935;
        double r18791962 = r18791960 / r18791961;
        double r18791963 = -r18791944;
        double r18791964 = cbrt(r18791946);
        double r18791965 = r18791963 / r18791964;
        double r18791966 = 1.0;
        double r18791967 = r18791964 * r18791964;
        double r18791968 = r18791966 / r18791967;
        double r18791969 = r18791944 / r18791964;
        double r18791970 = r18791968 * r18791969;
        double r18791971 = fma(r18791965, r18791968, r18791970);
        double r18791972 = r18791971 * r18791938;
        double r18791973 = r18791966 / r18791935;
        double r18791974 = -r18791968;
        double r18791975 = r18791974 * r18791969;
        double r18791976 = fma(r18791939, r18791973, r18791975);
        double r18791977 = r18791938 * r18791976;
        double r18791978 = r18791972 + r18791977;
        double r18791979 = r18791956 ? r18791962 : r18791978;
        double r18791980 = r18791937 ? r18791954 : r18791979;
        return r18791980;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.6
Target4.2
Herbie4.4
\[\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 z < -2.2177966653035308e+63

    1. Initial program 2.4

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

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

      \[\leadsto x \cdot \left(\frac{y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}} - \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right) \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\]
    6. Applied *-un-lft-identity3.2

      \[\leadsto x \cdot \left(\frac{\color{blue}{1 \cdot y}}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}} - \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right) \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\]
    7. Applied times-frac3.2

      \[\leadsto x \cdot \left(\color{blue}{\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}} - \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right) \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\]
    8. Applied prod-diff3.2

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}, \frac{y}{\sqrt[3]{z}}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\right)}\]
    9. Applied distribute-lft-in3.2

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}, \frac{y}{\sqrt[3]{z}}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + x \cdot \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)}\]
    10. Simplified2.8

      \[\leadsto \color{blue}{x \cdot \left(\frac{\frac{y}{\sqrt[3]{z}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} - \frac{t}{1 - z}\right)} + x \cdot \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\]
    11. Simplified2.8

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

    if -2.2177966653035308e+63 < z < 1.4988225320205495e-298

    1. Initial program 7.6

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

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

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

    if 1.4988225320205495e-298 < z

    1. Initial program 4.1

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{t}{\color{blue}{\left(\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}\right) \cdot \sqrt[3]{1 - z}}}\right)\]
    4. Applied *-un-lft-identity4.4

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{\color{blue}{1 \cdot t}}{\left(\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}\right) \cdot \sqrt[3]{1 - z}}\right)\]
    5. Applied times-frac4.4

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{t}{\sqrt[3]{1 - z}}}\right)\]
    6. Applied div-inv4.4

      \[\leadsto x \cdot \left(\color{blue}{y \cdot \frac{1}{z}} - \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{t}{\sqrt[3]{1 - z}}\right)\]
    7. Applied prod-diff4.4

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(y, \frac{1}{z}, -\frac{t}{\sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right) + \mathsf{fma}\left(-\frac{t}{\sqrt[3]{1 - z}}, \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{t}{\sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right)}\]
    8. Applied distribute-lft-in4.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.217796665303530773920617159755679745171 \cdot 10^{63}:\\ \;\;\;\;x \cdot \left(\frac{\frac{y}{\sqrt[3]{z}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} - \frac{t}{1 - z}\right) + \left(\frac{t}{1 - z} \cdot x + \left(-x\right) \cdot \frac{t}{1 - z}\right)\\ \mathbf{elif}\;z \le 1.498822532020549452647469645076704014499 \cdot 10^{-298}:\\ \;\;\;\;\frac{x \cdot \left(\left(1 - z\right) \cdot y - t \cdot z\right)}{\left(1 - z\right) \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-t}{\sqrt[3]{1 - z}}, \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{t}{\sqrt[3]{1 - z}}\right) \cdot x + x \cdot \mathsf{fma}\left(y, \frac{1}{z}, \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right) \cdot \frac{t}{\sqrt[3]{1 - z}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(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)))))