Average Error: 4.6 → 2.1
Time: 9.3s
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 -4.928602009194038086036205062754298231499 \cdot 10^{142} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 3.320323384323547401102295815138797212443 \cdot 10^{180}\right):\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{z}} \cdot \sqrt[3]{\frac{y}{z}}\right)\right) \cdot \sqrt[3]{\frac{y}{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \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 -4.928602009194038086036205062754298231499 \cdot 10^{142} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 3.320323384323547401102295815138797212443 \cdot 10^{180}\right):\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r295190 = x;
        double r295191 = y;
        double r295192 = z;
        double r295193 = r295191 / r295192;
        double r295194 = t;
        double r295195 = 1.0;
        double r295196 = r295195 - r295192;
        double r295197 = r295194 / r295196;
        double r295198 = r295193 - r295197;
        double r295199 = r295190 * r295198;
        return r295199;
}

double f(double x, double y, double z, double t) {
        double r295200 = y;
        double r295201 = z;
        double r295202 = r295200 / r295201;
        double r295203 = t;
        double r295204 = 1.0;
        double r295205 = r295204 - r295201;
        double r295206 = r295203 / r295205;
        double r295207 = r295202 - r295206;
        double r295208 = -4.928602009194038e+142;
        bool r295209 = r295207 <= r295208;
        double r295210 = 3.3203233843235474e+180;
        bool r295211 = r295207 <= r295210;
        double r295212 = !r295211;
        bool r295213 = r295209 || r295212;
        double r295214 = x;
        double r295215 = r295214 * r295200;
        double r295216 = 1.0;
        double r295217 = r295216 / r295201;
        double r295218 = r295215 * r295217;
        double r295219 = -r295206;
        double r295220 = r295214 * r295219;
        double r295221 = r295218 + r295220;
        double r295222 = cbrt(r295200);
        double r295223 = cbrt(r295201);
        double r295224 = r295222 / r295223;
        double r295225 = cbrt(r295202);
        double r295226 = r295224 * r295225;
        double r295227 = r295214 * r295226;
        double r295228 = r295227 * r295225;
        double r295229 = r295228 + r295220;
        double r295230 = r295213 ? r295221 : r295229;
        return r295230;
}

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.2
Herbie2.1
\[\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 (- (/ y z) (/ t (- 1.0 z))) < -4.928602009194038e+142 or 3.3203233843235474e+180 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 13.7

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

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

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

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

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

    if -4.928602009194038e+142 < (- (/ y z) (/ t (- 1.0 z))) < 3.3203233843235474e+180

    1. Initial program 1.8

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

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

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

      \[\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*2.3

      \[\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)\]
    8. Using strategy rm
    9. Applied cbrt-div2.2

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

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

Reproduce

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