Average Error: 4.8 → 4.2
Time: 22.2s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.59072232261827527 \cdot 10^{-182}:\\ \;\;\;\;\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}} + \left(-\frac{t}{1 - z} \cdot x\right)\\ \mathbf{elif}\;x \le 1.08342056158238069 \cdot 10^{-270}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(-\frac{t}{1 - z} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x} \cdot \left(\sqrt{x} \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;x \le -4.59072232261827527 \cdot 10^{-182}:\\
\;\;\;\;\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}} + \left(-\frac{t}{1 - z} \cdot x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r252516 = x;
        double r252517 = y;
        double r252518 = z;
        double r252519 = r252517 / r252518;
        double r252520 = t;
        double r252521 = 1.0;
        double r252522 = r252521 - r252518;
        double r252523 = r252520 / r252522;
        double r252524 = r252519 - r252523;
        double r252525 = r252516 * r252524;
        return r252525;
}

double f(double x, double y, double z, double t) {
        double r252526 = x;
        double r252527 = -4.590722322618275e-182;
        bool r252528 = r252526 <= r252527;
        double r252529 = z;
        double r252530 = cbrt(r252529);
        double r252531 = r252530 * r252530;
        double r252532 = r252526 / r252531;
        double r252533 = y;
        double r252534 = r252533 / r252530;
        double r252535 = r252532 * r252534;
        double r252536 = t;
        double r252537 = 1.0;
        double r252538 = r252537 - r252529;
        double r252539 = r252536 / r252538;
        double r252540 = r252539 * r252526;
        double r252541 = -r252540;
        double r252542 = r252535 + r252541;
        double r252543 = 1.0834205615823807e-270;
        bool r252544 = r252526 <= r252543;
        double r252545 = r252526 * r252533;
        double r252546 = r252545 / r252529;
        double r252547 = r252546 + r252541;
        double r252548 = sqrt(r252526);
        double r252549 = r252533 / r252529;
        double r252550 = r252549 - r252539;
        double r252551 = r252548 * r252550;
        double r252552 = r252548 * r252551;
        double r252553 = r252544 ? r252547 : r252552;
        double r252554 = r252528 ? r252542 : r252553;
        return r252554;
}

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
Herbie4.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 x < -4.590722322618275e-182

    1. Initial program 3.9

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{t \cdot \frac{1}{1 - z}}\right)\]
    4. Using strategy rm
    5. Applied sub-neg3.9

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\right)} + \left(-\frac{t}{1 - z} \cdot x\right)\]
    12. 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}}} + \left(-\frac{t}{1 - z} \cdot x\right)\]
    13. Simplified3.9

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

    if -4.590722322618275e-182 < x < 1.0834205615823807e-270

    1. Initial program 8.3

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

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

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

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

      \[\leadsto x \cdot \frac{y}{z} + \color{blue}{\left(-\frac{t}{1 - z} \cdot x\right)}\]
    8. Using strategy rm
    9. Applied associate-*r/3.7

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

    if 1.0834205615823807e-270 < x

    1. Initial program 4.3

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

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

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

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

Reproduce

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