Average Error: 11.2 → 6.6
Time: 5.2s
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}\;y \le -4.5484033292263474 \cdot 10^{-198}:\\ \;\;\;\;{\left(x - \left(y \cdot 2\right) \cdot \frac{z}{2 \cdot {z}^{2} - t \cdot y}\right)}^{1}\\ \mathbf{elif}\;y \le 3.8543500664540839 \cdot 10^{-267}:\\ \;\;\;\;x - 0\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot 2}{\frac{\left(z \cdot 2\right) \cdot z - y \cdot t}{z}}\\ \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}\;y \le -4.5484033292263474 \cdot 10^{-198}:\\
\;\;\;\;{\left(x - \left(y \cdot 2\right) \cdot \frac{z}{2 \cdot {z}^{2} - t \cdot y}\right)}^{1}\\

\mathbf{elif}\;y \le 3.8543500664540839 \cdot 10^{-267}:\\
\;\;\;\;x - 0\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r517576 = x;
        double r517577 = y;
        double r517578 = 2.0;
        double r517579 = r517577 * r517578;
        double r517580 = z;
        double r517581 = r517579 * r517580;
        double r517582 = r517580 * r517578;
        double r517583 = r517582 * r517580;
        double r517584 = t;
        double r517585 = r517577 * r517584;
        double r517586 = r517583 - r517585;
        double r517587 = r517581 / r517586;
        double r517588 = r517576 - r517587;
        return r517588;
}

double f(double x, double y, double z, double t) {
        double r517589 = y;
        double r517590 = -4.5484033292263474e-198;
        bool r517591 = r517589 <= r517590;
        double r517592 = x;
        double r517593 = 2.0;
        double r517594 = r517589 * r517593;
        double r517595 = z;
        double r517596 = 2.0;
        double r517597 = pow(r517595, r517596);
        double r517598 = r517593 * r517597;
        double r517599 = t;
        double r517600 = r517599 * r517589;
        double r517601 = r517598 - r517600;
        double r517602 = r517595 / r517601;
        double r517603 = r517594 * r517602;
        double r517604 = r517592 - r517603;
        double r517605 = 1.0;
        double r517606 = pow(r517604, r517605);
        double r517607 = 3.854350066454084e-267;
        bool r517608 = r517589 <= r517607;
        double r517609 = 0.0;
        double r517610 = r517592 - r517609;
        double r517611 = r517595 * r517593;
        double r517612 = r517611 * r517595;
        double r517613 = r517589 * r517599;
        double r517614 = r517612 - r517613;
        double r517615 = r517614 / r517595;
        double r517616 = r517594 / r517615;
        double r517617 = r517592 - r517616;
        double r517618 = r517608 ? r517610 : r517617;
        double r517619 = r517591 ? r517606 : r517618;
        return r517619;
}

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

Derivation

  1. Split input into 3 regimes
  2. if y < -4.5484033292263474e-198

    1. Initial program 11.5

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.5

      \[\leadsto x - \frac{\left(y \cdot 2\right) \cdot z}{\color{blue}{1 \cdot \left(\left(z \cdot 2\right) \cdot z - y \cdot t\right)}}\]
    4. Applied times-frac6.6

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

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

      \[\leadsto x - \left(y \cdot 2\right) \cdot \color{blue}{\frac{z}{2 \cdot {z}^{2} - t \cdot y}}\]
    7. Using strategy rm
    8. Applied pow16.6

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

    if -4.5484033292263474e-198 < y < 3.854350066454084e-267

    1. Initial program 8.2

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
    2. Taylor expanded around 0 5.1

      \[\leadsto x - \color{blue}{0}\]

    if 3.854350066454084e-267 < y

    1. Initial program 11.6

      \[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
    2. Using strategy rm
    3. Applied associate-/l*6.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.5484033292263474 \cdot 10^{-198}:\\ \;\;\;\;{\left(x - \left(y \cdot 2\right) \cdot \frac{z}{2 \cdot {z}^{2} - t \cdot y}\right)}^{1}\\ \mathbf{elif}\;y \le 3.8543500664540839 \cdot 10^{-267}:\\ \;\;\;\;x - 0\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot 2}{\frac{\left(z \cdot 2\right) \cdot z - y \cdot t}{z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(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)))))