Average Error: 4.8 → 4.7
Time: 7.9s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;t \le -4.0954988046392846 \cdot 10^{121}:\\ \;\;\;\;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{elif}\;t \le 1.41243532322347605 \cdot 10^{93}:\\ \;\;\;\;x \cdot \frac{y}{z} + \frac{x \cdot \left(-t\right)}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{x \cdot \frac{y}{z}} \cdot \sqrt[3]{x \cdot \frac{y}{z}}\right) \cdot \sqrt[3]{x \cdot \frac{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}\;t \le -4.0954988046392846 \cdot 10^{121}:\\
\;\;\;\;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{elif}\;t \le 1.41243532322347605 \cdot 10^{93}:\\
\;\;\;\;x \cdot \frac{y}{z} + \frac{x \cdot \left(-t\right)}{1 - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r383655 = x;
        double r383656 = y;
        double r383657 = z;
        double r383658 = r383656 / r383657;
        double r383659 = t;
        double r383660 = 1.0;
        double r383661 = r383660 - r383657;
        double r383662 = r383659 / r383661;
        double r383663 = r383658 - r383662;
        double r383664 = r383655 * r383663;
        return r383664;
}

double f(double x, double y, double z, double t) {
        double r383665 = t;
        double r383666 = -4.0954988046392846e+121;
        bool r383667 = r383665 <= r383666;
        double r383668 = x;
        double r383669 = y;
        double r383670 = cbrt(r383669);
        double r383671 = r383670 * r383670;
        double r383672 = 1.0;
        double r383673 = r383671 / r383672;
        double r383674 = z;
        double r383675 = r383670 / r383674;
        double r383676 = 1.0;
        double r383677 = r383676 - r383674;
        double r383678 = r383665 / r383677;
        double r383679 = -r383678;
        double r383680 = fma(r383673, r383675, r383679);
        double r383681 = r383668 * r383680;
        double r383682 = 1.412435323223476e+93;
        bool r383683 = r383665 <= r383682;
        double r383684 = r383669 / r383674;
        double r383685 = r383668 * r383684;
        double r383686 = -r383665;
        double r383687 = r383668 * r383686;
        double r383688 = r383687 / r383677;
        double r383689 = r383685 + r383688;
        double r383690 = cbrt(r383685);
        double r383691 = r383690 * r383690;
        double r383692 = r383691 * r383690;
        double r383693 = r383668 * r383679;
        double r383694 = r383692 + r383693;
        double r383695 = r383683 ? r383689 : r383694;
        double r383696 = r383667 ? r383681 : r383695;
        return r383696;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.8
Target4.4
Herbie4.7
\[\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 t < -4.0954988046392846e+121

    1. Initial program 4.0

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

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

      \[\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-frac4.2

      \[\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-neg4.2

      \[\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 -4.0954988046392846e+121 < t < 1.412435323223476e+93

    1. Initial program 5.0

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}\]
    5. Using strategy rm
    6. Applied distribute-neg-frac5.0

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

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

    if 1.412435323223476e+93 < t

    1. Initial program 4.5

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.0954988046392846 \cdot 10^{121}:\\ \;\;\;\;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{elif}\;t \le 1.41243532322347605 \cdot 10^{93}:\\ \;\;\;\;x \cdot \frac{y}{z} + \frac{x \cdot \left(-t\right)}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{x \cdot \frac{y}{z}} \cdot \sqrt[3]{x \cdot \frac{y}{z}}\right) \cdot \sqrt[3]{x \cdot \frac{y}{z}} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \end{array}\]

Reproduce

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