Average Error: 4.8 → 2.2
Time: 22.6s
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 -1.239303023374822547398658364536819064295 \cdot 10^{162} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 6.822389104912753269888011375509159370512 \cdot 10^{181}\right):\\ \;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + \left(\frac{t}{1 - z} \cdot 0\right) \cdot x}\\ \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 -1.239303023374822547398658364536819064295 \cdot 10^{162} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 6.822389104912753269888011375509159370512 \cdot 10^{181}\right):\\
\;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r289117 = x;
        double r289118 = y;
        double r289119 = z;
        double r289120 = r289118 / r289119;
        double r289121 = t;
        double r289122 = 1.0;
        double r289123 = r289122 - r289119;
        double r289124 = r289121 / r289123;
        double r289125 = r289120 - r289124;
        double r289126 = r289117 * r289125;
        return r289126;
}

double f(double x, double y, double z, double t) {
        double r289127 = y;
        double r289128 = z;
        double r289129 = r289127 / r289128;
        double r289130 = t;
        double r289131 = 1.0;
        double r289132 = r289131 - r289128;
        double r289133 = r289130 / r289132;
        double r289134 = r289129 - r289133;
        double r289135 = -1.2393030233748225e+162;
        bool r289136 = r289134 <= r289135;
        double r289137 = 6.822389104912753e+181;
        bool r289138 = r289134 <= r289137;
        double r289139 = !r289138;
        bool r289140 = r289136 || r289139;
        double r289141 = x;
        double r289142 = r289141 * r289127;
        double r289143 = r289142 / r289128;
        double r289144 = -r289133;
        double r289145 = r289141 * r289144;
        double r289146 = r289143 + r289145;
        double r289147 = r289141 * r289134;
        double r289148 = cbrt(r289147);
        double r289149 = r289148 * r289148;
        double r289150 = cbrt(r289127);
        double r289151 = r289150 * r289150;
        double r289152 = r289150 / r289128;
        double r289153 = fma(r289151, r289152, r289144);
        double r289154 = r289153 * r289141;
        double r289155 = 0.0;
        double r289156 = r289133 * r289155;
        double r289157 = r289156 * r289141;
        double r289158 = r289154 + r289157;
        double r289159 = cbrt(r289158);
        double r289160 = r289149 * r289159;
        double r289161 = r289140 ? r289146 : r289160;
        return r289161;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.8
Target4.5
Herbie2.2
\[\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 2 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -1.2393030233748225e+162 or 6.822389104912753e+181 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 15.9

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

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

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

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

    if -1.2393030233748225e+162 < (- (/ y z) (/ t (- 1.0 z))) < 6.822389104912753e+181

    1. Initial program 1.6

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

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

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{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)}\]
    6. Applied *-un-lft-identity2.5

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{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)}\]
    7. Applied add-cube-cbrt2.5

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{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)}\]
    8. Applied times-frac2.5

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{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)}\]
    9. Applied prod-diff2.5

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{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)}}\]
    10. Applied distribute-lft-in2.5

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{\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)}}\]
    11. Simplified2.5

      \[\leadsto \left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{\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)}\]
    12. Simplified2.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -1.239303023374822547398658364536819064295 \cdot 10^{162} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 6.822389104912753269888011375509159370512 \cdot 10^{181}\right):\\ \;\;\;\;\frac{x \cdot y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)} \cdot \sqrt[3]{x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\sqrt[3]{y} \cdot \sqrt[3]{y}, \frac{\sqrt[3]{y}}{z}, -\frac{t}{1 - z}\right) \cdot x + \left(\frac{t}{1 - z} \cdot 0\right) \cdot x}\\ \end{array}\]

Reproduce

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