Average Error: 11.4 → 1.8
Time: 3.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}\;x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t} \le -8.95481198396809677 \cdot 10^{-26}:\\ \;\;\;\;x - \frac{y}{\frac{{\left(2 \cdot z - \frac{t \cdot y}{z}\right)}^{1}}{2}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{2 \cdot z - \frac{t}{\frac{z}{y}}}{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}\;x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t} \le -8.95481198396809677 \cdot 10^{-26}:\\
\;\;\;\;x - \frac{y}{\frac{{\left(2 \cdot z - \frac{t \cdot y}{z}\right)}^{1}}{2}}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{2 \cdot z - \frac{t}{\frac{z}{y}}}{2}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r523541 = x;
        double r523542 = y;
        double r523543 = 2.0;
        double r523544 = r523542 * r523543;
        double r523545 = z;
        double r523546 = r523544 * r523545;
        double r523547 = r523545 * r523543;
        double r523548 = r523547 * r523545;
        double r523549 = t;
        double r523550 = r523542 * r523549;
        double r523551 = r523548 - r523550;
        double r523552 = r523546 / r523551;
        double r523553 = r523541 - r523552;
        return r523553;
}

double f(double x, double y, double z, double t) {
        double r523554 = x;
        double r523555 = y;
        double r523556 = 2.0;
        double r523557 = r523555 * r523556;
        double r523558 = z;
        double r523559 = r523557 * r523558;
        double r523560 = r523558 * r523556;
        double r523561 = r523560 * r523558;
        double r523562 = t;
        double r523563 = r523555 * r523562;
        double r523564 = r523561 - r523563;
        double r523565 = r523559 / r523564;
        double r523566 = r523554 - r523565;
        double r523567 = -8.954811983968097e-26;
        bool r523568 = r523566 <= r523567;
        double r523569 = r523556 * r523558;
        double r523570 = r523562 * r523555;
        double r523571 = r523570 / r523558;
        double r523572 = r523569 - r523571;
        double r523573 = 1.0;
        double r523574 = pow(r523572, r523573);
        double r523575 = r523574 / r523556;
        double r523576 = r523555 / r523575;
        double r523577 = r523554 - r523576;
        double r523578 = r523558 / r523555;
        double r523579 = r523562 / r523578;
        double r523580 = r523569 - r523579;
        double r523581 = r523580 / r523556;
        double r523582 = r523555 / r523581;
        double r523583 = r523554 - r523582;
        double r523584 = r523568 ? r523577 : r523583;
        return r523584;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))) < -8.954811983968097e-26

    1. Initial program 2.0

      \[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*0.3

      \[\leadsto x - \color{blue}{\frac{y \cdot 2}{\frac{\left(z \cdot 2\right) \cdot z - y \cdot t}{z}}}\]
    4. Using strategy rm
    5. Applied associate-/l*0.3

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

      \[\leadsto x - \frac{y}{\color{blue}{\frac{2 \cdot z - \frac{t \cdot y}{z}}{2}}}\]
    7. Using strategy rm
    8. Applied pow10.2

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

    if -8.954811983968097e-26 < (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))))

    1. Initial program 14.9

      \[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*9.0

      \[\leadsto x - \color{blue}{\frac{y \cdot 2}{\frac{\left(z \cdot 2\right) \cdot z - y \cdot t}{z}}}\]
    4. Using strategy rm
    5. Applied associate-/l*9.0

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

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

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

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

Reproduce

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