Average Error: 11.7 → 2.3
Time: 6.2s
Precision: 64
\[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
\[x - \frac{y}{\frac{2 \cdot z - t \cdot \frac{y}{z}}{2}}\]
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
x - \frac{y}{\frac{2 \cdot z - t \cdot \frac{y}{z}}{2}}
double f(double x, double y, double z, double t) {
        double r459876 = x;
        double r459877 = y;
        double r459878 = 2.0;
        double r459879 = r459877 * r459878;
        double r459880 = z;
        double r459881 = r459879 * r459880;
        double r459882 = r459880 * r459878;
        double r459883 = r459882 * r459880;
        double r459884 = t;
        double r459885 = r459877 * r459884;
        double r459886 = r459883 - r459885;
        double r459887 = r459881 / r459886;
        double r459888 = r459876 - r459887;
        return r459888;
}

double f(double x, double y, double z, double t) {
        double r459889 = x;
        double r459890 = y;
        double r459891 = 2.0;
        double r459892 = z;
        double r459893 = r459891 * r459892;
        double r459894 = t;
        double r459895 = r459890 / r459892;
        double r459896 = r459894 * r459895;
        double r459897 = r459893 - r459896;
        double r459898 = r459897 / r459891;
        double r459899 = r459890 / r459898;
        double r459900 = r459889 - r459899;
        return r459900;
}

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

Derivation

  1. Split input into 2 regimes
  2. if t < -2.068625767123316e-285 or 1.4785505117285156e-17 < t

    1. Initial program 10.8

      \[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 associate-/l*6.2

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

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

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

      \[\leadsto x - \frac{y}{\frac{2 \cdot z - \color{blue}{\frac{t}{1} \cdot \frac{y}{z}}}{2}}\]
    10. Simplified1.8

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

    if -2.068625767123316e-285 < t < 1.4785505117285156e-17

    1. Initial program 14.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*7.9

      \[\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-inv8.0

      \[\leadsto x - \frac{y \cdot 2}{\color{blue}{\left(\left(z \cdot 2\right) \cdot z - y \cdot t\right) \cdot \frac{1}{z}}}\]
    6. Applied associate-/r*7.5

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

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

Reproduce

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