Average Error: 11.8 → 1.6
Time: 21.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 r388164 = x;
        double r388165 = y;
        double r388166 = 2.0;
        double r388167 = r388165 * r388166;
        double r388168 = z;
        double r388169 = r388167 * r388168;
        double r388170 = r388168 * r388166;
        double r388171 = r388170 * r388168;
        double r388172 = t;
        double r388173 = r388165 * r388172;
        double r388174 = r388171 - r388173;
        double r388175 = r388169 / r388174;
        double r388176 = r388164 - r388175;
        return r388176;
}

double f(double x, double y, double z, double t) {
        double r388177 = z;
        double r388178 = -4.029370566057221e-26;
        bool r388179 = r388177 <= r388178;
        double r388180 = x;
        double r388181 = 2.0;
        double r388182 = r388177 * r388181;
        double r388183 = y;
        double r388184 = r388183 / r388177;
        double r388185 = t;
        double r388186 = r388184 * r388185;
        double r388187 = r388182 - r388186;
        double r388188 = r388177 / r388187;
        double r388189 = r388184 * r388181;
        double r388190 = r388188 * r388189;
        double r388191 = r388180 - r388190;
        double r388192 = 1.0;
        double r388193 = cbrt(r388183);
        double r388194 = r388193 * r388193;
        double r388195 = r388192 / r388194;
        double r388196 = r388193 / r388177;
        double r388197 = r388177 / r388196;
        double r388198 = r388195 * r388197;
        double r388199 = r388185 / r388181;
        double r388200 = r388198 - r388199;
        double r388201 = r388177 / r388200;
        double r388202 = r388180 - r388201;
        double r388203 = r388179 ? r388191 : r388202;
        return r388203;
}

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