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 \mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\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 \mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\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 r358672 = x;
        double r358673 = y;
        double r358674 = z;
        double r358675 = r358673 / r358674;
        double r358676 = t;
        double r358677 = 1.0;
        double r358678 = r358677 - r358674;
        double r358679 = r358676 / r358678;
        double r358680 = r358675 - r358679;
        double r358681 = r358672 * r358680;
        return r358681;
}

double f(double x, double y, double z, double t) {
        double r358682 = z;
        double r358683 = -1.4100017685468478e-238;
        bool r358684 = r358682 <= r358683;
        double r358685 = x;
        double r358686 = y;
        double r358687 = r358682 / r358686;
        double r358688 = r358685 / r358687;
        double r358689 = -r358685;
        double r358690 = t;
        double r358691 = 1.0;
        double r358692 = r358691 - r358682;
        double r358693 = cbrt(r358692);
        double r358694 = r358690 / r358693;
        double r358695 = r358693 * r358693;
        double r358696 = r358694 / r358695;
        double r358697 = r358689 * r358696;
        double r358698 = r358688 + r358697;
        double r358699 = 4.454345374416069e-17;
        bool r358700 = r358682 <= r358699;
        double r358701 = r358685 * r358686;
        double r358702 = r358701 / r358682;
        double r358703 = r358689 * r358694;
        double r358704 = 1.0;
        double r358705 = r358704 / r358695;
        double r358706 = r358703 * r358705;
        double r358707 = r358702 + r358706;
        double r358708 = 1.0635404435626457e+273;
        bool r358709 = r358682 <= r358708;
        double r358710 = cbrt(r358686);
        double r358711 = r358710 * r358710;
        double r358712 = r358711 / r358704;
        double r358713 = r358710 / r358682;
        double r358714 = r358690 / r358692;
        double r358715 = -r358714;
        double r358716 = fma(r358712, r358713, r358715);
        double r358717 = r358685 * r358716;
        double r358718 = sqrt(r358682);
        double r358719 = r358701 / r358718;
        double r358720 = r358719 / r358718;
        double r358721 = r358720 + r358697;
        double r358722 = r358709 ? r358717 : r358721;
        double r358723 = r358700 ? r358707 : r358722;
        double r358724 = r358684 ? r358698 : r358723;
        return r358724;
}

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 *-un-lft-identity2.0

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

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

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

      \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\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 \mathsf{fma}\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\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)))))