Average Error: 11.8 → 1.6
Time: 20.6s
Precision: 64
\[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.029370566057220718522966826872882938935 \cdot 10^{-26}:\\ \;\;\;\;x - \frac{z}{z \cdot 2 - \frac{y}{z} \cdot t} \cdot \left(\frac{y}{z} \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{z}{\frac{\sqrt[3]{y}}{z}} - \frac{t}{2}}\\ \end{array}\]
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
\begin{array}{l}
\mathbf{if}\;z \le -4.029370566057220718522966826872882938935 \cdot 10^{-26}:\\
\;\;\;\;x - \frac{z}{z \cdot 2 - \frac{y}{z} \cdot t} \cdot \left(\frac{y}{z} \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{z}{\frac{\sqrt[3]{y}}{z}} - \frac{t}{2}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r1055397 = x;
        double r1055398 = y;
        double r1055399 = 2.0;
        double r1055400 = r1055398 * r1055399;
        double r1055401 = z;
        double r1055402 = r1055400 * r1055401;
        double r1055403 = r1055401 * r1055399;
        double r1055404 = r1055403 * r1055401;
        double r1055405 = t;
        double r1055406 = r1055398 * r1055405;
        double r1055407 = r1055404 - r1055406;
        double r1055408 = r1055402 / r1055407;
        double r1055409 = r1055397 - r1055408;
        return r1055409;
}

double f(double x, double y, double z, double t) {
        double r1055410 = z;
        double r1055411 = -4.029370566057221e-26;
        bool r1055412 = r1055410 <= r1055411;
        double r1055413 = x;
        double r1055414 = 2.0;
        double r1055415 = r1055410 * r1055414;
        double r1055416 = y;
        double r1055417 = r1055416 / r1055410;
        double r1055418 = t;
        double r1055419 = r1055417 * r1055418;
        double r1055420 = r1055415 - r1055419;
        double r1055421 = r1055410 / r1055420;
        double r1055422 = r1055417 * r1055414;
        double r1055423 = r1055421 * r1055422;
        double r1055424 = r1055413 - r1055423;
        double r1055425 = 1.0;
        double r1055426 = cbrt(r1055416);
        double r1055427 = r1055426 * r1055426;
        double r1055428 = r1055425 / r1055427;
        double r1055429 = r1055426 / r1055410;
        double r1055430 = r1055410 / r1055429;
        double r1055431 = r1055428 * r1055430;
        double r1055432 = r1055418 / r1055414;
        double r1055433 = r1055431 - r1055432;
        double r1055434 = r1055410 / r1055433;
        double r1055435 = r1055413 - r1055434;
        double r1055436 = r1055412 ? r1055424 : r1055435;
        return r1055436;
}

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

Original11.8
Target0.1
Herbie1.6
\[x - \frac{1}{\frac{z}{y} - \frac{\frac{t}{2}}{z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -4.029370566057221e-26

    1. Initial program 17.7

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
    2. Simplified6.2

      \[\leadsto \color{blue}{x - \frac{z}{\frac{z \cdot z}{y} - \frac{t}{2}}}\]
    3. Using strategy rm
    4. Applied associate-/l*2.4

      \[\leadsto x - \frac{z}{\color{blue}{\frac{z}{\frac{y}{z}}} - \frac{t}{2}}\]
    5. Using strategy rm
    6. Applied frac-sub3.2

      \[\leadsto x - \frac{z}{\color{blue}{\frac{z \cdot 2 - \frac{y}{z} \cdot t}{\frac{y}{z} \cdot 2}}}\]
    7. Applied associate-/r/0.8

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

    if -4.029370566057221e-26 < z

    1. Initial program 9.6

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
    2. Simplified2.6

      \[\leadsto \color{blue}{x - \frac{z}{\frac{z \cdot z}{y} - \frac{t}{2}}}\]
    3. Using strategy rm
    4. Applied associate-/l*0.8

      \[\leadsto x - \frac{z}{\color{blue}{\frac{z}{\frac{y}{z}}} - \frac{t}{2}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity0.8

      \[\leadsto x - \frac{z}{\frac{z}{\frac{y}{\color{blue}{1 \cdot z}}} - \frac{t}{2}}\]
    7. Applied add-cube-cbrt0.9

      \[\leadsto x - \frac{z}{\frac{z}{\frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{1 \cdot z}} - \frac{t}{2}}\]
    8. Applied times-frac0.9

      \[\leadsto x - \frac{z}{\frac{z}{\color{blue}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{z}}} - \frac{t}{2}}\]
    9. Applied *-un-lft-identity0.9

      \[\leadsto x - \frac{z}{\frac{\color{blue}{1 \cdot z}}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{z}} - \frac{t}{2}}\]
    10. Applied times-frac1.9

      \[\leadsto x - \frac{z}{\color{blue}{\frac{1}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}} \cdot \frac{z}{\frac{\sqrt[3]{y}}{z}}} - \frac{t}{2}}\]
    11. Simplified1.9

      \[\leadsto x - \frac{z}{\color{blue}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}}} \cdot \frac{z}{\frac{\sqrt[3]{y}}{z}} - \frac{t}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.029370566057220718522966826872882938935 \cdot 10^{-26}:\\ \;\;\;\;x - \frac{z}{z \cdot 2 - \frac{y}{z} \cdot t} \cdot \left(\frac{y}{z} \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{z}{\frac{\sqrt[3]{y}}{z}} - \frac{t}{2}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 
(FPCore (x y z t)
  :name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
  :precision binary64

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

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