Average Error: 4.4 → 0.2
Time: 6.6s
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} = -\infty:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.03192616381755189 \cdot 10^{-277}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.95749 \cdot 10^{-320}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.13585661832748401 \cdot 10^{290}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(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} = -\infty:\\
\;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r313322 = x;
        double r313323 = y;
        double r313324 = z;
        double r313325 = r313323 / r313324;
        double r313326 = t;
        double r313327 = 1.0;
        double r313328 = r313327 - r313324;
        double r313329 = r313326 / r313328;
        double r313330 = r313325 - r313329;
        double r313331 = r313322 * r313330;
        return r313331;
}

double f(double x, double y, double z, double t) {
        double r313332 = y;
        double r313333 = z;
        double r313334 = r313332 / r313333;
        double r313335 = t;
        double r313336 = 1.0;
        double r313337 = r313336 - r313333;
        double r313338 = r313335 / r313337;
        double r313339 = r313334 - r313338;
        double r313340 = -inf.0;
        bool r313341 = r313339 <= r313340;
        double r313342 = x;
        double r313343 = r313332 * r313337;
        double r313344 = r313333 * r313335;
        double r313345 = r313343 - r313344;
        double r313346 = 1.0;
        double r313347 = r313345 / r313346;
        double r313348 = r313342 * r313347;
        double r313349 = r313333 * r313337;
        double r313350 = r313348 / r313349;
        double r313351 = -1.0319261638175519e-277;
        bool r313352 = r313339 <= r313351;
        double r313353 = r313342 * r313339;
        double r313354 = 1.957488088823e-320;
        bool r313355 = r313339 <= r313354;
        double r313356 = r313342 * r313332;
        double r313357 = r313356 / r313333;
        double r313358 = r313335 * r313342;
        double r313359 = 2.0;
        double r313360 = pow(r313333, r313359);
        double r313361 = r313358 / r313360;
        double r313362 = r313336 * r313361;
        double r313363 = r313358 / r313333;
        double r313364 = r313362 + r313363;
        double r313365 = r313357 + r313364;
        double r313366 = 1.135856618327484e+290;
        bool r313367 = r313339 <= r313366;
        double r313368 = r313367 ? r313353 : r313350;
        double r313369 = r313355 ? r313365 : r313368;
        double r313370 = r313352 ? r313353 : r313369;
        double r313371 = r313341 ? r313350 : r313370;
        return r313371;
}

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.4
Target4.1
Herbie0.2
\[\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 (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 1.135856618327484e+290 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 53.0

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

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

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

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

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

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

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

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < -1.0319261638175519e-277 or 1.957488088823e-320 < (- (/ y z) (/ t (- 1.0 z))) < 1.135856618327484e+290

    1. Initial program 0.2

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

    if -1.0319261638175519e-277 < (- (/ y z) (/ t (- 1.0 z))) < 1.957488088823e-320

    1. Initial program 17.6

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

      \[\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. Taylor expanded around inf 0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.03192616381755189 \cdot 10^{-277}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.95749 \cdot 10^{-320}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.13585661832748401 \cdot 10^{290}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020035 
(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.623226303312042e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

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