Average Error: 4.6 → 2.8
Time: 4.7s
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.6819217472818379 \cdot 10^{190}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z} + \frac{x \cdot \left(-t\right)}{1 - z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.57561547149504369 \cdot 10^{-171}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{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.6819217472818379 \cdot 10^{190}:\\
\;\;\;\;1 \cdot \frac{x \cdot y}{z} + \frac{x \cdot \left(-t\right)}{1 - z}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r526607 = x;
        double r526608 = y;
        double r526609 = z;
        double r526610 = r526608 / r526609;
        double r526611 = t;
        double r526612 = 1.0;
        double r526613 = r526612 - r526609;
        double r526614 = r526611 / r526613;
        double r526615 = r526610 - r526614;
        double r526616 = r526607 * r526615;
        return r526616;
}

double f(double x, double y, double z, double t) {
        double r526617 = y;
        double r526618 = z;
        double r526619 = r526617 / r526618;
        double r526620 = t;
        double r526621 = 1.0;
        double r526622 = r526621 - r526618;
        double r526623 = r526620 / r526622;
        double r526624 = r526619 - r526623;
        double r526625 = -4.681921747281838e+190;
        bool r526626 = r526624 <= r526625;
        double r526627 = 1.0;
        double r526628 = x;
        double r526629 = r526628 * r526617;
        double r526630 = r526629 / r526618;
        double r526631 = r526627 * r526630;
        double r526632 = -r526620;
        double r526633 = r526628 * r526632;
        double r526634 = r526633 / r526622;
        double r526635 = r526631 + r526634;
        double r526636 = -2.5756154714950437e-171;
        bool r526637 = r526624 <= r526636;
        double r526638 = r526622 / r526620;
        double r526639 = r526627 / r526638;
        double r526640 = r526619 - r526639;
        double r526641 = r526628 * r526640;
        double r526642 = r526627 / r526618;
        double r526643 = r526629 * r526642;
        double r526644 = -r526623;
        double r526645 = r526628 * r526644;
        double r526646 = r526643 + r526645;
        double r526647 = r526637 ? r526641 : r526646;
        double r526648 = r526626 ? r526635 : r526647;
        return r526648;
}

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.4
Herbie2.8
\[\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))) < -4.681921747281838e+190

    1. Initial program 18.4

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

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

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

      \[\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 - z}\right)\]
    7. Applied *-un-lft-identity18.8

      \[\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 - z}\right)\]
    8. Applied times-frac18.8

      \[\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 - z}\right)\]
    9. Applied associate-*r*5.9

      \[\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 - z}\right)\]
    10. Simplified5.9

      \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{y}{\sqrt[3]{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\]
    11. Using strategy rm
    12. Applied *-un-lft-identity5.9

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{x \cdot y}{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\]
    15. Using strategy rm
    16. Applied distribute-neg-frac0.8

      \[\leadsto 1 \cdot \frac{x \cdot y}{z} + x \cdot \color{blue}{\frac{-t}{1 - z}}\]
    17. Applied associate-*r/1.2

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

    if -4.681921747281838e+190 < (- (/ y z) (/ t (- 1.0 z))) < -2.5756154714950437e-171

    1. Initial program 0.2

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

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

    if -2.5756154714950437e-171 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 4.7

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}\]
    5. Using strategy rm
    6. Applied div-inv4.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*4.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -4.6819217472818379 \cdot 10^{190}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z} + \frac{x \cdot \left(-t\right)}{1 - z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.57561547149504369 \cdot 10^{-171}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \end{array}\]

Reproduce

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