Average Error: 11.6 → 0.9
Time: 14.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}{1 \cdot z - 0.5 \cdot \left(\frac{t}{z} \cdot y\right)}\]
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
x - \frac{y}{1 \cdot z - 0.5 \cdot \left(\frac{t}{z} \cdot y\right)}
double f(double x, double y, double z, double t) {
        double r34551637 = x;
        double r34551638 = y;
        double r34551639 = 2.0;
        double r34551640 = r34551638 * r34551639;
        double r34551641 = z;
        double r34551642 = r34551640 * r34551641;
        double r34551643 = r34551641 * r34551639;
        double r34551644 = r34551643 * r34551641;
        double r34551645 = t;
        double r34551646 = r34551638 * r34551645;
        double r34551647 = r34551644 - r34551646;
        double r34551648 = r34551642 / r34551647;
        double r34551649 = r34551637 - r34551648;
        return r34551649;
}

double f(double x, double y, double z, double t) {
        double r34551650 = x;
        double r34551651 = y;
        double r34551652 = 1.0;
        double r34551653 = z;
        double r34551654 = r34551652 * r34551653;
        double r34551655 = 0.5;
        double r34551656 = t;
        double r34551657 = r34551656 / r34551653;
        double r34551658 = r34551657 * r34551651;
        double r34551659 = r34551655 * r34551658;
        double r34551660 = r34551654 - r34551659;
        double r34551661 = r34551651 / r34551660;
        double r34551662 = r34551650 - r34551661;
        return r34551662;
}

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

Derivation

  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. Simplified6.6

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

    \[\leadsto x - \frac{y}{\color{blue}{1 \cdot z - 0.5 \cdot \frac{t \cdot y}{z}}}\]
  4. Using strategy rm
  5. Applied associate-/l*2.1

    \[\leadsto x - \frac{y}{1 \cdot z - 0.5 \cdot \color{blue}{\frac{t}{\frac{z}{y}}}}\]
  6. Using strategy rm
  7. Applied associate-/r/0.9

    \[\leadsto x - \frac{y}{1 \cdot z - 0.5 \cdot \color{blue}{\left(\frac{t}{z} \cdot y\right)}}\]
  8. Final simplification0.9

    \[\leadsto x - \frac{y}{1 \cdot z - 0.5 \cdot \left(\frac{t}{z} \cdot y\right)}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"

  :herbie-target
  (- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z))))

  (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))