Average Error: 4.5 → 0.9
Time: 13.1s
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 -5.355774644879948828569583241788949268337 \cdot 10^{176}:\\ \;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.033153833188035003825148092583447604309 \cdot 10^{-178}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.460801798284354722117173135343381919765 \cdot 10^{-293}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, \left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z}\right) + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.897737938729328806287191979521453864406 \cdot 10^{213}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{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 -5.355774644879948828569583241788949268337 \cdot 10^{176}:\\
\;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\

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

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.460801798284354722117173135343381919765 \cdot 10^{-293}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, \left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z}\right) + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r651979 = x;
        double r651980 = y;
        double r651981 = z;
        double r651982 = r651980 / r651981;
        double r651983 = t;
        double r651984 = 1.0;
        double r651985 = r651984 - r651981;
        double r651986 = r651983 / r651985;
        double r651987 = r651982 - r651986;
        double r651988 = r651979 * r651987;
        return r651988;
}

double f(double x, double y, double z, double t) {
        double r651989 = y;
        double r651990 = z;
        double r651991 = r651989 / r651990;
        double r651992 = t;
        double r651993 = 1.0;
        double r651994 = r651993 - r651990;
        double r651995 = r651992 / r651994;
        double r651996 = r651991 - r651995;
        double r651997 = -5.355774644879949e+176;
        bool r651998 = r651996 <= r651997;
        double r651999 = x;
        double r652000 = r651999 * r651989;
        double r652001 = r652000 / r651990;
        double r652002 = -r651995;
        double r652003 = r651999 * r652002;
        double r652004 = r652001 + r652003;
        double r652005 = -1.033153833188035e-178;
        bool r652006 = r651996 <= r652005;
        double r652007 = cbrt(r651989);
        double r652008 = r652007 * r652007;
        double r652009 = r652007 / r651990;
        double r652010 = fma(r652008, r652009, r652002);
        double r652011 = r652010 * r651999;
        double r652012 = 0.0;
        double r652013 = r651995 * r652012;
        double r652014 = r651999 * r652013;
        double r652015 = r652011 + r652014;
        double r652016 = 2.4608017982843547e-293;
        bool r652017 = r651996 <= r652016;
        double r652018 = r651999 / r651990;
        double r652019 = r651993 / r651990;
        double r652020 = 1.0;
        double r652021 = r652019 + r652020;
        double r652022 = r651992 * r651999;
        double r652023 = r652022 / r651990;
        double r652024 = r652021 * r652023;
        double r652025 = fma(r652018, r651989, r652024);
        double r652026 = r652025 + r652014;
        double r652027 = 3.897737938729329e+213;
        bool r652028 = r651996 <= r652027;
        double r652029 = r652028 ? r652015 : r652004;
        double r652030 = r652017 ? r652026 : r652029;
        double r652031 = r652006 ? r652015 : r652030;
        double r652032 = r651998 ? r652004 : r652031;
        return r652032;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.5
Target4.2
Herbie0.9
\[\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 3 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -5.355774644879949e+176 or 3.897737938729329e+213 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 18.0

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

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

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

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

    if -5.355774644879949e+176 < (- (/ y z) (/ t (- 1.0 z))) < -1.033153833188035e-178 or 2.4608017982843547e-293 < (- (/ y z) (/ t (- 1.0 z))) < 3.897737938729329e+213

    1. Initial program 0.2

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

      \[\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-identity0.7

      \[\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-cbrt1.3

      \[\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-frac1.3

      \[\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-diff1.3

      \[\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. Applied distribute-lft-in1.3

      \[\leadsto \color{blue}{x \cdot \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) + x \cdot \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)}\]
    9. Simplified0.8

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

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

    if -1.033153833188035e-178 < (- (/ y z) (/ t (- 1.0 z))) < 2.4608017982843547e-293

    1. Initial program 9.4

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt9.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-identity9.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-cbrt9.7

      \[\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-frac9.7

      \[\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-diff9.7

      \[\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. Applied distribute-lft-in9.7

      \[\leadsto \color{blue}{x \cdot \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) + x \cdot \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)}\]
    9. Simplified9.6

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

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + \color{blue}{x \cdot \left(\frac{t}{1 - z} \cdot 0\right)}\]
    11. Taylor expanded around inf 1.3

      \[\leadsto \color{blue}{\left(\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)\right)} + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\]
    12. Simplified1.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{z}, y, \left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z}\right)} + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -5.355774644879948828569583241788949268337 \cdot 10^{176}:\\ \;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.033153833188035003825148092583447604309 \cdot 10^{-178}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.460801798284354722117173135343381919765 \cdot 10^{-293}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, \left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z}\right) + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.897737938729328806287191979521453864406 \cdot 10^{213}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + x \cdot \left(\frac{t}{1 - z} \cdot 0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \end{array}\]

Reproduce

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