Average Error: 4.7 → 3.1
Time: 13.0s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.1367195932299341 \cdot 10^{+39}:\\ \;\;\;\;\frac{y}{z} \cdot x + \left(-\frac{\frac{x}{\sqrt[3]{1.0 - z}}}{\sqrt[3]{1.0 - z}}\right) \cdot \frac{t}{\sqrt[3]{1.0 - z}}\\ \mathbf{elif}\;x \le 1.9645643022852117 \cdot 10^{-224}:\\ \;\;\;\;x \cdot \frac{-t}{1.0 - z} + \frac{1}{\frac{z}{y \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-t}{1.0 - z} + \frac{y}{\sqrt[3]{z}} \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)
\begin{array}{l}
\mathbf{if}\;x \le -1.1367195932299341 \cdot 10^{+39}:\\
\;\;\;\;\frac{y}{z} \cdot x + \left(-\frac{\frac{x}{\sqrt[3]{1.0 - z}}}{\sqrt[3]{1.0 - z}}\right) \cdot \frac{t}{\sqrt[3]{1.0 - z}}\\

\mathbf{elif}\;x \le 1.9645643022852117 \cdot 10^{-224}:\\
\;\;\;\;x \cdot \frac{-t}{1.0 - z} + \frac{1}{\frac{z}{y \cdot x}}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-t}{1.0 - z} + \frac{y}{\sqrt[3]{z}} \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r21767270 = x;
        double r21767271 = y;
        double r21767272 = z;
        double r21767273 = r21767271 / r21767272;
        double r21767274 = t;
        double r21767275 = 1.0;
        double r21767276 = r21767275 - r21767272;
        double r21767277 = r21767274 / r21767276;
        double r21767278 = r21767273 - r21767277;
        double r21767279 = r21767270 * r21767278;
        return r21767279;
}

double f(double x, double y, double z, double t) {
        double r21767280 = x;
        double r21767281 = -1.1367195932299341e+39;
        bool r21767282 = r21767280 <= r21767281;
        double r21767283 = y;
        double r21767284 = z;
        double r21767285 = r21767283 / r21767284;
        double r21767286 = r21767285 * r21767280;
        double r21767287 = 1.0;
        double r21767288 = r21767287 - r21767284;
        double r21767289 = cbrt(r21767288);
        double r21767290 = r21767280 / r21767289;
        double r21767291 = r21767290 / r21767289;
        double r21767292 = -r21767291;
        double r21767293 = t;
        double r21767294 = r21767293 / r21767289;
        double r21767295 = r21767292 * r21767294;
        double r21767296 = r21767286 + r21767295;
        double r21767297 = 1.9645643022852117e-224;
        bool r21767298 = r21767280 <= r21767297;
        double r21767299 = -r21767293;
        double r21767300 = r21767299 / r21767288;
        double r21767301 = r21767280 * r21767300;
        double r21767302 = 1.0;
        double r21767303 = r21767283 * r21767280;
        double r21767304 = r21767284 / r21767303;
        double r21767305 = r21767302 / r21767304;
        double r21767306 = r21767301 + r21767305;
        double r21767307 = cbrt(r21767284);
        double r21767308 = r21767283 / r21767307;
        double r21767309 = r21767307 * r21767307;
        double r21767310 = r21767280 / r21767309;
        double r21767311 = r21767308 * r21767310;
        double r21767312 = r21767301 + r21767311;
        double r21767313 = r21767298 ? r21767306 : r21767312;
        double r21767314 = r21767282 ? r21767296 : r21767313;
        return r21767314;
}

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.7
Target4.2
Herbie3.1
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right) \lt -7.623226303312042 \cdot 10^{-196}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1.0 - z}\right)\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right) \lt 1.4133944927702302 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1.0 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1.0 - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -1.1367195932299341e+39

    1. Initial program 3.6

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

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

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

      \[\leadsto x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{\color{blue}{\left(\sqrt[3]{1.0 - z} \cdot \sqrt[3]{1.0 - z}\right) \cdot \sqrt[3]{1.0 - z}}}\right)\]
    7. Applied *-un-lft-identity3.9

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

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

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

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

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

    if -1.1367195932299341e+39 < x < 1.9645643022852117e-224

    1. Initial program 5.8

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + x \cdot \left(-\frac{t}{1.0 - z}\right)\]
    7. Using strategy rm
    8. Applied clear-num2.8

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

    if 1.9645643022852117e-224 < x

    1. Initial program 4.0

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.1367195932299341 \cdot 10^{+39}:\\ \;\;\;\;\frac{y}{z} \cdot x + \left(-\frac{\frac{x}{\sqrt[3]{1.0 - z}}}{\sqrt[3]{1.0 - z}}\right) \cdot \frac{t}{\sqrt[3]{1.0 - z}}\\ \mathbf{elif}\;x \le 1.9645643022852117 \cdot 10^{-224}:\\ \;\;\;\;x \cdot \frac{-t}{1.0 - z} + \frac{1}{\frac{z}{y \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-t}{1.0 - z} + \frac{y}{\sqrt[3]{z}} \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(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 (- 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 (- 1.0 z)))))))

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