Average Error: 7.2 → 3.0
Time: 5.0s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.412584965026174356547481107780761150371 \cdot 10^{211}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \le -2.580684021360039689076100657919132626783 \cdot 10^{160}:\\ \;\;\;\;\frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\sqrt[3]{{\left(\frac{x}{t \cdot z - x}\right)}^{3}}}{x + 1}\\ \mathbf{elif}\;z \le -2.966830251509030236990636984311025104722 \cdot 10^{118}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \le 1.03829628730808273860363989281490107116 \cdot 10^{46}:\\ \;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\sqrt[3]{{\left(\frac{x}{t \cdot z - x}\right)}^{3}}}{x + 1}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;z \le -1.412584965026174356547481107780761150371 \cdot 10^{211}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{elif}\;z \le -2.580684021360039689076100657919132626783 \cdot 10^{160}:\\
\;\;\;\;\frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\sqrt[3]{{\left(\frac{x}{t \cdot z - x}\right)}^{3}}}{x + 1}\\

\mathbf{elif}\;z \le -2.966830251509030236990636984311025104722 \cdot 10^{118}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{elif}\;z \le 1.03829628730808273860363989281490107116 \cdot 10^{46}:\\
\;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{x + 1}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r707412 = x;
        double r707413 = y;
        double r707414 = z;
        double r707415 = r707413 * r707414;
        double r707416 = r707415 - r707412;
        double r707417 = t;
        double r707418 = r707417 * r707414;
        double r707419 = r707418 - r707412;
        double r707420 = r707416 / r707419;
        double r707421 = r707412 + r707420;
        double r707422 = 1.0;
        double r707423 = r707412 + r707422;
        double r707424 = r707421 / r707423;
        return r707424;
}

double f(double x, double y, double z, double t) {
        double r707425 = z;
        double r707426 = -1.4125849650261744e+211;
        bool r707427 = r707425 <= r707426;
        double r707428 = x;
        double r707429 = y;
        double r707430 = t;
        double r707431 = r707429 / r707430;
        double r707432 = r707428 + r707431;
        double r707433 = 1.0;
        double r707434 = r707428 + r707433;
        double r707435 = r707432 / r707434;
        double r707436 = -2.5806840213600397e+160;
        bool r707437 = r707425 <= r707436;
        double r707438 = r707430 * r707425;
        double r707439 = r707438 - r707428;
        double r707440 = r707429 / r707439;
        double r707441 = r707440 * r707425;
        double r707442 = r707441 + r707428;
        double r707443 = 1.0;
        double r707444 = r707434 * r707443;
        double r707445 = r707442 / r707444;
        double r707446 = r707428 / r707439;
        double r707447 = 3.0;
        double r707448 = pow(r707446, r707447);
        double r707449 = cbrt(r707448);
        double r707450 = r707449 / r707434;
        double r707451 = r707445 - r707450;
        double r707452 = -2.9668302515090302e+118;
        bool r707453 = r707425 <= r707452;
        double r707454 = 1.0382962873080827e+46;
        bool r707455 = r707425 <= r707454;
        double r707456 = r707429 * r707425;
        double r707457 = r707456 - r707428;
        double r707458 = r707457 / r707439;
        double r707459 = r707428 + r707458;
        double r707460 = r707443 / r707434;
        double r707461 = r707459 * r707460;
        double r707462 = r707455 ? r707461 : r707451;
        double r707463 = r707453 ? r707435 : r707462;
        double r707464 = r707437 ? r707451 : r707463;
        double r707465 = r707427 ? r707435 : r707464;
        return r707465;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.2
Target0.4
Herbie3.0
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.4125849650261744e+211 or -2.5806840213600397e+160 < z < -2.9668302515090302e+118

    1. Initial program 21.8

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Taylor expanded around inf 7.5

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1}\]

    if -1.4125849650261744e+211 < z < -2.5806840213600397e+160 or 1.0382962873080827e+46 < z

    1. Initial program 17.5

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied div-sub17.5

      \[\leadsto \frac{x + \color{blue}{\left(\frac{y \cdot z}{t \cdot z - x} - \frac{x}{t \cdot z - x}\right)}}{x + 1}\]
    4. Applied associate-+r-17.5

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

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z}{t \cdot z - x}}{x + 1} - \frac{\frac{x}{t \cdot z - x}}{x + 1}}\]
    6. Simplified6.3

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)}{\left(x + 1\right) \cdot 1}} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    7. Using strategy rm
    8. Applied fma-udef6.3

      \[\leadsto \frac{\color{blue}{\frac{y}{t \cdot z - x} \cdot z + x}}{\left(x + 1\right) \cdot 1} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    9. Using strategy rm
    10. Applied add-cbrt-cube7.2

      \[\leadsto \frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\frac{x}{\color{blue}{\sqrt[3]{\left(\left(t \cdot z - x\right) \cdot \left(t \cdot z - x\right)\right) \cdot \left(t \cdot z - x\right)}}}}{x + 1}\]
    11. Applied add-cbrt-cube30.3

      \[\leadsto \frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\frac{\color{blue}{\sqrt[3]{\left(x \cdot x\right) \cdot x}}}{\sqrt[3]{\left(\left(t \cdot z - x\right) \cdot \left(t \cdot z - x\right)\right) \cdot \left(t \cdot z - x\right)}}}{x + 1}\]
    12. Applied cbrt-undiv30.3

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

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

    if -2.9668302515090302e+118 < z < 1.0382962873080827e+46

    1. Initial program 1.0

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied div-inv1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.412584965026174356547481107780761150371 \cdot 10^{211}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \le -2.580684021360039689076100657919132626783 \cdot 10^{160}:\\ \;\;\;\;\frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\sqrt[3]{{\left(\frac{x}{t \cdot z - x}\right)}^{3}}}{x + 1}\\ \mathbf{elif}\;z \le -2.966830251509030236990636984311025104722 \cdot 10^{118}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \le 1.03829628730808273860363989281490107116 \cdot 10^{46}:\\ \;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{t \cdot z - x} \cdot z + x}{\left(x + 1\right) \cdot 1} - \frac{\sqrt[3]{{\left(\frac{x}{t \cdot z - x}\right)}^{3}}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1))

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