Average Error: 12.0 → 6.5
Time: 4.4s
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 -2.57127147346290313 \cdot 10^{197}:\\ \;\;\;\;x - \left(y \cdot 2\right) \cdot 0\\ \mathbf{else}:\\ \;\;\;\;x - \left(\left(y \cdot 2\right) \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{2 \cdot {z}^{2} - t \cdot y} \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}\\ \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 -2.57127147346290313 \cdot 10^{197}:\\
\;\;\;\;x - \left(y \cdot 2\right) \cdot 0\\

\mathbf{else}:\\
\;\;\;\;x - \left(\left(y \cdot 2\right) \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{2 \cdot {z}^{2} - t \cdot y} \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r499250 = x;
        double r499251 = y;
        double r499252 = 2.0;
        double r499253 = r499251 * r499252;
        double r499254 = z;
        double r499255 = r499253 * r499254;
        double r499256 = r499254 * r499252;
        double r499257 = r499256 * r499254;
        double r499258 = t;
        double r499259 = r499251 * r499258;
        double r499260 = r499257 - r499259;
        double r499261 = r499255 / r499260;
        double r499262 = r499250 - r499261;
        return r499262;
}

double f(double x, double y, double z, double t) {
        double r499263 = z;
        double r499264 = -2.571271473462903e+197;
        bool r499265 = r499263 <= r499264;
        double r499266 = x;
        double r499267 = y;
        double r499268 = 2.0;
        double r499269 = r499267 * r499268;
        double r499270 = 0.0;
        double r499271 = r499269 * r499270;
        double r499272 = r499266 - r499271;
        double r499273 = cbrt(r499263);
        double r499274 = r499273 * r499273;
        double r499275 = 2.0;
        double r499276 = pow(r499263, r499275);
        double r499277 = r499268 * r499276;
        double r499278 = t;
        double r499279 = r499278 * r499267;
        double r499280 = r499277 - r499279;
        double r499281 = cbrt(r499280);
        double r499282 = r499281 * r499281;
        double r499283 = r499274 / r499282;
        double r499284 = r499269 * r499283;
        double r499285 = r499273 / r499281;
        double r499286 = r499284 * r499285;
        double r499287 = r499266 - r499286;
        double r499288 = r499265 ? r499272 : r499287;
        return r499288;
}

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

Original12.0
Target0.1
Herbie6.5
\[x - \frac{1}{\frac{z}{y} - \frac{\frac{t}{2}}{z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -2.571271473462903e+197

    1. Initial program 27.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 *-un-lft-identity27.9

      \[\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-frac14.4

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

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

      \[\leadsto x - \left(y \cdot 2\right) \cdot \color{blue}{\frac{z}{2 \cdot {z}^{2} - t \cdot y}}\]
    7. Taylor expanded around 0 12.0

      \[\leadsto x - \left(y \cdot 2\right) \cdot \color{blue}{0}\]

    if -2.571271473462903e+197 < z

    1. Initial program 10.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-identity10.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.2

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

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

      \[\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 add-cube-cbrt6.4

      \[\leadsto x - \left(y \cdot 2\right) \cdot \frac{z}{\color{blue}{\left(\sqrt[3]{2 \cdot {z}^{2} - t \cdot y} \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}\right) \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}}\]
    9. Applied add-cube-cbrt6.5

      \[\leadsto x - \left(y \cdot 2\right) \cdot \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{\left(\sqrt[3]{2 \cdot {z}^{2} - t \cdot y} \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}\right) \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}\]
    10. Applied times-frac6.5

      \[\leadsto x - \left(y \cdot 2\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{2 \cdot {z}^{2} - t \cdot y} \cdot \sqrt[3]{2 \cdot {z}^{2} - t \cdot y}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{2 \cdot {z}^{2} - t \cdot y}}\right)}\]
    11. Applied associate-*r*6.0

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

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

Reproduce

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