Average Error: 4.5 → 2.8
Time: 41.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 -7.184791027573155919376164615359797817295 \cdot 10^{-118}:\\ \;\;\;\;x \cdot \left(\left(\frac{y}{z} + \left(-\frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right) + \mathsf{fma}\left(\frac{t}{\sqrt[3]{1 - z}}, \frac{-1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.024572517521794287635362455359361531033 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{t \cdot x}{{z}^{2}}, \frac{t \cdot x}{z}\right) + \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.318070341412534558447546258900730304576 \cdot 10^{307}:\\ \;\;\;\;x \cdot \left(\left(\frac{y}{z} + \left(-\frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right) + \mathsf{fma}\left(\frac{t}{\sqrt[3]{1 - z}}, \frac{-1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \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 -7.184791027573155919376164615359797817295 \cdot 10^{-118}:\\
\;\;\;\;x \cdot \left(\left(\frac{y}{z} + \left(-\frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right) + \mathsf{fma}\left(\frac{t}{\sqrt[3]{1 - z}}, \frac{-1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right)\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r385276 = x;
        double r385277 = y;
        double r385278 = z;
        double r385279 = r385277 / r385278;
        double r385280 = t;
        double r385281 = 1.0;
        double r385282 = r385281 - r385278;
        double r385283 = r385280 / r385282;
        double r385284 = r385279 - r385283;
        double r385285 = r385276 * r385284;
        return r385285;
}

double f(double x, double y, double z, double t) {
        double r385286 = y;
        double r385287 = z;
        double r385288 = r385286 / r385287;
        double r385289 = t;
        double r385290 = 1.0;
        double r385291 = r385290 - r385287;
        double r385292 = r385289 / r385291;
        double r385293 = r385288 - r385292;
        double r385294 = -7.184791027573156e-118;
        bool r385295 = r385293 <= r385294;
        double r385296 = x;
        double r385297 = cbrt(r385291);
        double r385298 = r385289 / r385297;
        double r385299 = r385297 * r385297;
        double r385300 = r385298 / r385299;
        double r385301 = -r385300;
        double r385302 = r385288 + r385301;
        double r385303 = -1.0;
        double r385304 = r385303 / r385299;
        double r385305 = fma(r385298, r385304, r385300);
        double r385306 = r385302 + r385305;
        double r385307 = r385296 * r385306;
        double r385308 = 1.0245725175217943e-208;
        bool r385309 = r385293 <= r385308;
        double r385310 = r385289 * r385296;
        double r385311 = 2.0;
        double r385312 = pow(r385287, r385311);
        double r385313 = r385310 / r385312;
        double r385314 = r385310 / r385287;
        double r385315 = fma(r385290, r385313, r385314);
        double r385316 = r385296 * r385286;
        double r385317 = r385316 / r385287;
        double r385318 = r385315 + r385317;
        double r385319 = 2.3180703414125346e+307;
        bool r385320 = r385293 <= r385319;
        double r385321 = r385320 ? r385307 : r385317;
        double r385322 = r385309 ? r385318 : r385321;
        double r385323 = r385295 ? r385307 : r385322;
        return r385323;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.5
Target4.0
Herbie2.8
\[\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))) < -7.184791027573156e-118 or 1.0245725175217943e-208 < (- (/ y z) (/ t (- 1.0 z))) < 2.3180703414125346e+307

    1. Initial program 2.3

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

      \[\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-identity2.6

      \[\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-frac2.6

      \[\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. Applied add-sqr-sqrt30.3

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

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

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

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

    if -7.184791027573156e-118 < (- (/ y z) (/ t (- 1.0 z))) < 1.0245725175217943e-208

    1. Initial program 6.2

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Taylor expanded around inf 4.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)}\]
    3. Simplified4.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{t \cdot x}{{z}^{2}}, \frac{t \cdot x}{z}\right) + \frac{x \cdot y}{z}}\]

    if 2.3180703414125346e+307 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 63.0

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Taylor expanded around 0 1.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -7.184791027573155919376164615359797817295 \cdot 10^{-118}:\\ \;\;\;\;x \cdot \left(\left(\frac{y}{z} + \left(-\frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right) + \mathsf{fma}\left(\frac{t}{\sqrt[3]{1 - z}}, \frac{-1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.024572517521794287635362455359361531033 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{t \cdot x}{{z}^{2}}, \frac{t \cdot x}{z}\right) + \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.318070341412534558447546258900730304576 \cdot 10^{307}:\\ \;\;\;\;x \cdot \left(\left(\frac{y}{z} + \left(-\frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right) + \mathsf{fma}\left(\frac{t}{\sqrt[3]{1 - z}}, \frac{-1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}, \frac{\frac{t}{\sqrt[3]{1 - z}}}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 +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.62322630331204244e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.41339449277023022e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

  (* x (- (/ y z) (/ t (- 1 z)))))