Average Error: 11.5 → 1.1
Time: 21.8s
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 3.184566053188553378480244144229649534604 \cdot 10^{-59}:\\ \;\;\;\;x - \frac{z}{\frac{z}{\frac{y}{z}} - \frac{t}{2}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z}{z \cdot 2 - \frac{y}{z} \cdot t} \cdot \left(\frac{y}{z} \cdot 2\right)\\ \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 3.184566053188553378480244144229649534604 \cdot 10^{-59}:\\
\;\;\;\;x - \frac{z}{\frac{z}{\frac{y}{z}} - \frac{t}{2}}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{z}{z \cdot 2 - \frac{y}{z} \cdot t} \cdot \left(\frac{y}{z} \cdot 2\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r329426 = x;
        double r329427 = y;
        double r329428 = 2.0;
        double r329429 = r329427 * r329428;
        double r329430 = z;
        double r329431 = r329429 * r329430;
        double r329432 = r329430 * r329428;
        double r329433 = r329432 * r329430;
        double r329434 = t;
        double r329435 = r329427 * r329434;
        double r329436 = r329433 - r329435;
        double r329437 = r329431 / r329436;
        double r329438 = r329426 - r329437;
        return r329438;
}

double f(double x, double y, double z, double t) {
        double r329439 = z;
        double r329440 = 3.1845660531885534e-59;
        bool r329441 = r329439 <= r329440;
        double r329442 = x;
        double r329443 = y;
        double r329444 = r329443 / r329439;
        double r329445 = r329439 / r329444;
        double r329446 = t;
        double r329447 = 2.0;
        double r329448 = r329446 / r329447;
        double r329449 = r329445 - r329448;
        double r329450 = r329439 / r329449;
        double r329451 = r329442 - r329450;
        double r329452 = r329439 * r329447;
        double r329453 = r329444 * r329446;
        double r329454 = r329452 - r329453;
        double r329455 = r329439 / r329454;
        double r329456 = r329444 * r329447;
        double r329457 = r329455 * r329456;
        double r329458 = r329442 - r329457;
        double r329459 = r329441 ? r329451 : r329458;
        return r329459;
}

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.5
Target0.1
Herbie1.1
\[x - \frac{1}{\frac{z}{y} - \frac{\frac{t}{2}}{z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < 3.1845660531885534e-59

    1. Initial program 10.3

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

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

      \[\leadsto x - \frac{z}{\color{blue}{\frac{z}{\frac{y}{z}}} - \frac{t}{2}}\]

    if 3.1845660531885534e-59 < z

    1. Initial program 14.5

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019325 
(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)))))