Average Error: 11.5 → 1.1
Time: 23.0s
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 r328559 = x;
        double r328560 = y;
        double r328561 = 2.0;
        double r328562 = r328560 * r328561;
        double r328563 = z;
        double r328564 = r328562 * r328563;
        double r328565 = r328563 * r328561;
        double r328566 = r328565 * r328563;
        double r328567 = t;
        double r328568 = r328560 * r328567;
        double r328569 = r328566 - r328568;
        double r328570 = r328564 / r328569;
        double r328571 = r328559 - r328570;
        return r328571;
}

double f(double x, double y, double z, double t) {
        double r328572 = z;
        double r328573 = 3.1845660531885534e-59;
        bool r328574 = r328572 <= r328573;
        double r328575 = x;
        double r328576 = y;
        double r328577 = r328576 / r328572;
        double r328578 = r328572 / r328577;
        double r328579 = t;
        double r328580 = 2.0;
        double r328581 = r328579 / r328580;
        double r328582 = r328578 - r328581;
        double r328583 = r328572 / r328582;
        double r328584 = r328575 - r328583;
        double r328585 = r328572 * r328580;
        double r328586 = r328577 * r328579;
        double r328587 = r328585 - r328586;
        double r328588 = r328572 / r328587;
        double r328589 = r328577 * r328580;
        double r328590 = r328588 * r328589;
        double r328591 = r328575 - r328590;
        double r328592 = r328574 ? r328584 : r328591;
        return r328592;
}

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