Average Error: 4.8 → 2.3
Time: 16.2s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) = -\infty:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \sqrt[3]{1 - z} - z \cdot \left(\left(\sqrt[3]{\frac{1}{1 - z}} \cdot t\right) \cdot \sqrt[3]{\frac{1}{1 - z}}\right)\right)}{z \cdot \sqrt[3]{1 - z}}\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \le 2.64959633226735147 \cdot 10^{200}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\frac{-1}{1 - z} \cdot x\right) + \frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) = -\infty:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \sqrt[3]{1 - z} - z \cdot \left(\left(\sqrt[3]{\frac{1}{1 - z}} \cdot t\right) \cdot \sqrt[3]{\frac{1}{1 - z}}\right)\right)}{z \cdot \sqrt[3]{1 - z}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r348010 = x;
        double r348011 = y;
        double r348012 = z;
        double r348013 = r348011 / r348012;
        double r348014 = t;
        double r348015 = 1.0;
        double r348016 = r348015 - r348012;
        double r348017 = r348014 / r348016;
        double r348018 = r348013 - r348017;
        double r348019 = r348010 * r348018;
        return r348019;
}

double f(double x, double y, double z, double t) {
        double r348020 = x;
        double r348021 = y;
        double r348022 = z;
        double r348023 = r348021 / r348022;
        double r348024 = t;
        double r348025 = 1.0;
        double r348026 = r348025 - r348022;
        double r348027 = r348024 / r348026;
        double r348028 = r348023 - r348027;
        double r348029 = r348020 * r348028;
        double r348030 = -inf.0;
        bool r348031 = r348029 <= r348030;
        double r348032 = cbrt(r348026);
        double r348033 = r348021 * r348032;
        double r348034 = 1.0;
        double r348035 = r348034 / r348026;
        double r348036 = cbrt(r348035);
        double r348037 = r348036 * r348024;
        double r348038 = r348037 * r348036;
        double r348039 = r348022 * r348038;
        double r348040 = r348033 - r348039;
        double r348041 = r348020 * r348040;
        double r348042 = r348022 * r348032;
        double r348043 = r348041 / r348042;
        double r348044 = 2.6495963322673515e+200;
        bool r348045 = r348029 <= r348044;
        double r348046 = -1.0;
        double r348047 = r348046 / r348026;
        double r348048 = r348047 * r348020;
        double r348049 = r348024 * r348048;
        double r348050 = r348020 * r348021;
        double r348051 = r348050 / r348022;
        double r348052 = r348049 + r348051;
        double r348053 = r348045 ? r348029 : r348052;
        double r348054 = r348031 ? r348043 : r348053;
        return r348054;
}

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.8
Target4.4
Herbie2.3
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt -7.62322630331204244 \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.41339449277023022 \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 (* x (- (/ y z) (/ t (- 1.0 z)))) < -inf.0

    1. Initial program 64.0

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

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

      \[\leadsto x \cdot \left(\frac{y}{z} - t \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{1}{1 - z}} \cdot \sqrt[3]{\frac{1}{1 - z}}\right) \cdot \sqrt[3]{\frac{1}{1 - z}}\right)}\right)\]
    6. Using strategy rm
    7. Applied cbrt-div64.0

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

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{t \cdot \left(\left(\sqrt[3]{\frac{1}{1 - z}} \cdot \sqrt[3]{\frac{1}{1 - z}}\right) \cdot \sqrt[3]{1}\right)}{\sqrt[3]{1 - z}}}\right)\]
    10. Applied frac-sub64.0

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

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

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

    if -inf.0 < (* x (- (/ y z) (/ t (- 1.0 z)))) < 2.6495963322673515e+200

    1. Initial program 1.6

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

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

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

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

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

      \[\leadsto x \cdot \left(\color{blue}{{\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1 - z}} \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1 - z}}\right)}^{1}} \cdot {\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1 - z}}\right)}^{1}\right)\]
    9. Applied pow-prod-down2.6

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

      \[\leadsto \color{blue}{{x}^{1}} \cdot {\left(\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1 - z}} \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1 - z}}\right) \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1 - z}}\right)}^{1}\]
    11. Applied pow-prod-down2.6

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

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

    if 2.6495963322673515e+200 < (* x (- (/ y z) (/ t (- 1.0 z))))

    1. Initial program 19.6

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

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

      \[\leadsto x \cdot \left(\frac{y}{z} - t \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{1}{1 - z}} \cdot \sqrt[3]{\frac{1}{1 - z}}\right) \cdot \sqrt[3]{\frac{1}{1 - z}}\right)}\right)\]
    6. Using strategy rm
    7. Applied sub-neg19.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) = -\infty:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \sqrt[3]{1 - z} - z \cdot \left(\left(\sqrt[3]{\frac{1}{1 - z}} \cdot t\right) \cdot \sqrt[3]{\frac{1}{1 - z}}\right)\right)}{z \cdot \sqrt[3]{1 - z}}\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \le 2.64959633226735147 \cdot 10^{200}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(\frac{-1}{1 - z} \cdot x\right) + \frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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