Average Error: 12.0 → 2.7
Time: 3.7s
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 6.41298001160430249 \cdot 10^{168} \lor \neg \left(y \le 1.7509518152818834 \cdot 10^{246}\right):\\ \;\;\;\;x - \frac{y \cdot 2}{z \cdot 2 - t \cdot \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot 2\right) \cdot \frac{z}{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}\;y \le 6.41298001160430249 \cdot 10^{168} \lor \neg \left(y \le 1.7509518152818834 \cdot 10^{246}\right):\\
\;\;\;\;x - \frac{y \cdot 2}{z \cdot 2 - t \cdot \frac{y}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r600077 = x;
        double r600078 = y;
        double r600079 = 2.0;
        double r600080 = r600078 * r600079;
        double r600081 = z;
        double r600082 = r600080 * r600081;
        double r600083 = r600081 * r600079;
        double r600084 = r600083 * r600081;
        double r600085 = t;
        double r600086 = r600078 * r600085;
        double r600087 = r600084 - r600086;
        double r600088 = r600082 / r600087;
        double r600089 = r600077 - r600088;
        return r600089;
}

double f(double x, double y, double z, double t) {
        double r600090 = y;
        double r600091 = 6.4129800116043025e+168;
        bool r600092 = r600090 <= r600091;
        double r600093 = 1.7509518152818834e+246;
        bool r600094 = r600090 <= r600093;
        double r600095 = !r600094;
        bool r600096 = r600092 || r600095;
        double r600097 = x;
        double r600098 = 2.0;
        double r600099 = r600090 * r600098;
        double r600100 = z;
        double r600101 = r600100 * r600098;
        double r600102 = t;
        double r600103 = r600090 / r600100;
        double r600104 = r600102 * r600103;
        double r600105 = r600101 - r600104;
        double r600106 = r600099 / r600105;
        double r600107 = r600097 - r600106;
        double r600108 = 2.0;
        double r600109 = pow(r600100, r600108);
        double r600110 = r600098 * r600109;
        double r600111 = r600102 * r600090;
        double r600112 = r600110 - r600111;
        double r600113 = r600100 / r600112;
        double r600114 = r600099 * r600113;
        double r600115 = r600097 - r600114;
        double r600116 = r600096 ? r600107 : r600115;
        return r600116;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < 6.4129800116043025e+168 or 1.7509518152818834e+246 < y

    1. Initial program 11.3

      \[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.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 div-sub6.3

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

      \[\leadsto x - \frac{y \cdot 2}{\color{blue}{z \cdot 2} - \frac{y \cdot t}{z}}\]
    7. Simplified2.6

      \[\leadsto x - \frac{y \cdot 2}{z \cdot 2 - \color{blue}{\frac{t \cdot y}{z}}}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity2.6

      \[\leadsto x - \frac{y \cdot 2}{z \cdot 2 - \frac{t \cdot y}{\color{blue}{1 \cdot z}}}\]
    10. Applied times-frac2.1

      \[\leadsto x - \frac{y \cdot 2}{z \cdot 2 - \color{blue}{\frac{t}{1} \cdot \frac{y}{z}}}\]
    11. Simplified2.1

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

    if 6.4129800116043025e+168 < y < 1.7509518152818834e+246

    1. Initial program 22.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 *-un-lft-identity22.0

      \[\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-frac9.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 6.41298001160430249 \cdot 10^{168} \lor \neg \left(y \le 1.7509518152818834 \cdot 10^{246}\right):\\ \;\;\;\;x - \frac{y \cdot 2}{z \cdot 2 - t \cdot \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot 2\right) \cdot \frac{z}{2 \cdot {z}^{2} - t \cdot y}\\ \end{array}\]

Reproduce

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