Average Error: 4.9 → 3.7
Time: 7.3s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.410001768546847785046431669741847748835 \cdot 10^{-238}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\ \mathbf{elif}\;z \le 4.45434537441606907190152570875686761337 \cdot 10^{-17}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(\left(-x\right) \cdot \frac{t}{\sqrt[3]{1 - z}}\right) \cdot \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\ \mathbf{elif}\;z \le 1.063540443562645720050492503041678353316 \cdot 10^{273}:\\ \;\;\;\;x \cdot \left(\mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z} \cdot 1\right) + \frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot y}{\sqrt{z}}}{\sqrt{z}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;z \le -1.410001768546847785046431669741847748835 \cdot 10^{-238}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\

\mathbf{elif}\;z \le 4.45434537441606907190152570875686761337 \cdot 10^{-17}:\\
\;\;\;\;\frac{x \cdot y}{z} + \left(\left(-x\right) \cdot \frac{t}{\sqrt[3]{1 - z}}\right) \cdot \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\

\mathbf{elif}\;z \le 1.063540443562645720050492503041678353316 \cdot 10^{273}:\\
\;\;\;\;x \cdot \left(\mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z} \cdot 1\right) + \frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r400617 = x;
        double r400618 = y;
        double r400619 = z;
        double r400620 = r400618 / r400619;
        double r400621 = t;
        double r400622 = 1.0;
        double r400623 = r400622 - r400619;
        double r400624 = r400621 / r400623;
        double r400625 = r400620 - r400624;
        double r400626 = r400617 * r400625;
        return r400626;
}

double f(double x, double y, double z, double t) {
        double r400627 = z;
        double r400628 = -1.4100017685468478e-238;
        bool r400629 = r400627 <= r400628;
        double r400630 = x;
        double r400631 = y;
        double r400632 = r400627 / r400631;
        double r400633 = r400630 / r400632;
        double r400634 = -r400630;
        double r400635 = t;
        double r400636 = 1.0;
        double r400637 = r400636 - r400627;
        double r400638 = cbrt(r400637);
        double r400639 = r400635 / r400638;
        double r400640 = r400638 * r400638;
        double r400641 = r400639 / r400640;
        double r400642 = r400634 * r400641;
        double r400643 = r400633 + r400642;
        double r400644 = 4.454345374416069e-17;
        bool r400645 = r400627 <= r400644;
        double r400646 = r400630 * r400631;
        double r400647 = r400646 / r400627;
        double r400648 = r400634 * r400639;
        double r400649 = 1.0;
        double r400650 = r400649 / r400640;
        double r400651 = r400648 * r400650;
        double r400652 = r400647 + r400651;
        double r400653 = 1.0635404435626457e+273;
        bool r400654 = r400627 <= r400653;
        double r400655 = cbrt(r400631);
        double r400656 = r400655 * r400655;
        double r400657 = r400656 / r400649;
        double r400658 = r400655 / r400627;
        double r400659 = r400635 / r400637;
        double r400660 = r400659 * r400649;
        double r400661 = -r400660;
        double r400662 = fma(r400657, r400658, r400661);
        double r400663 = -r400649;
        double r400664 = r400663 + r400649;
        double r400665 = r400659 * r400664;
        double r400666 = r400662 + r400665;
        double r400667 = r400630 * r400666;
        double r400668 = sqrt(r400627);
        double r400669 = r400646 / r400668;
        double r400670 = r400669 / r400668;
        double r400671 = r400670 + r400642;
        double r400672 = r400654 ? r400667 : r400671;
        double r400673 = r400645 ? r400652 : r400672;
        double r400674 = r400629 ? r400643 : r400673;
        return r400674;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.9
Target4.4
Herbie3.7
\[\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 4 regimes
  2. if z < -1.4100017685468478e-238

    1. Initial program 3.6

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

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{z} + \color{blue}{\left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}}\]
    10. Using strategy rm
    11. Applied associate-*r/5.3

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

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

    if -1.4100017685468478e-238 < z < 4.454345374416069e-17

    1. Initial program 10.9

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

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{z} + \color{blue}{\left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}}\]
    10. Using strategy rm
    11. Applied associate-*r/4.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\]
    12. Using strategy rm
    13. Applied div-inv4.4

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

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

    if 4.454345374416069e-17 < z < 1.0635404435626457e+273

    1. Initial program 2.0

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\right)}\]
    8. Simplified2.5

      \[\leadsto x \cdot \left(\color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z} \cdot 1\right)} + \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\right)\]
    9. Simplified2.5

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

    if 1.0635404435626457e+273 < z

    1. Initial program 4.2

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

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{z} + \color{blue}{\left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}}\]
    10. Using strategy rm
    11. Applied associate-*r/8.6

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\]
    12. Using strategy rm
    13. Applied add-sqr-sqrt8.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.410001768546847785046431669741847748835 \cdot 10^{-238}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\ \mathbf{elif}\;z \le 4.45434537441606907190152570875686761337 \cdot 10^{-17}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(\left(-x\right) \cdot \frac{t}{\sqrt[3]{1 - z}}\right) \cdot \frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\ \mathbf{elif}\;z \le 1.063540443562645720050492503041678353316 \cdot 10^{273}:\\ \;\;\;\;x \cdot \left(\mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z} \cdot 1\right) + \frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot y}{\sqrt{z}}}{\sqrt{z}} + \left(-x\right) \cdot \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019353 +o rules:numerics
(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)))))