Average Error: 4.8 → 2.2
Time: 25.4s
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 r270183 = x;
        double r270184 = y;
        double r270185 = z;
        double r270186 = r270184 / r270185;
        double r270187 = t;
        double r270188 = 1.0;
        double r270189 = r270188 - r270185;
        double r270190 = r270187 / r270189;
        double r270191 = r270186 - r270190;
        double r270192 = r270183 * r270191;
        return r270192;
}

double f(double x, double y, double z, double t) {
        double r270193 = y;
        double r270194 = z;
        double r270195 = r270193 / r270194;
        double r270196 = t;
        double r270197 = 1.0;
        double r270198 = r270197 - r270194;
        double r270199 = r270196 / r270198;
        double r270200 = r270195 - r270199;
        double r270201 = -1.2393030233748225e+162;
        bool r270202 = r270200 <= r270201;
        double r270203 = 6.822389104912753e+181;
        bool r270204 = r270200 <= r270203;
        double r270205 = !r270204;
        bool r270206 = r270202 || r270205;
        double r270207 = x;
        double r270208 = r270207 * r270193;
        double r270209 = r270208 / r270194;
        double r270210 = -r270199;
        double r270211 = r270207 * r270210;
        double r270212 = r270209 + r270211;
        double r270213 = r270207 * r270200;
        double r270214 = cbrt(r270213);
        double r270215 = r270214 * r270214;
        double r270216 = cbrt(r270193);
        double r270217 = r270216 * r270216;
        double r270218 = r270216 / r270194;
        double r270219 = fma(r270217, r270218, r270210);
        double r270220 = r270219 * r270207;
        double r270221 = 0.0;
        double r270222 = r270199 * r270221;
        double r270223 = r270222 * r270207;
        double r270224 = r270220 + r270223;
        double r270225 = cbrt(r270224);
        double r270226 = r270215 * r270225;
        double r270227 = r270206 ? r270212 : r270226;
        return r270227;
}

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)))))