Average Error: 12.0 → 1.1
Time: 12.5s
Precision: 64
\[x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}\]
\[x + \frac{-y}{z \cdot 1 - \left(\frac{t}{z} \cdot 0.5\right) \cdot y}\]
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
x + \frac{-y}{z \cdot 1 - \left(\frac{t}{z} \cdot 0.5\right) \cdot y}
double f(double x, double y, double z, double t) {
        double r18507466 = x;
        double r18507467 = y;
        double r18507468 = 2.0;
        double r18507469 = r18507467 * r18507468;
        double r18507470 = z;
        double r18507471 = r18507469 * r18507470;
        double r18507472 = r18507470 * r18507468;
        double r18507473 = r18507472 * r18507470;
        double r18507474 = t;
        double r18507475 = r18507467 * r18507474;
        double r18507476 = r18507473 - r18507475;
        double r18507477 = r18507471 / r18507476;
        double r18507478 = r18507466 - r18507477;
        return r18507478;
}

double f(double x, double y, double z, double t) {
        double r18507479 = x;
        double r18507480 = y;
        double r18507481 = -r18507480;
        double r18507482 = z;
        double r18507483 = 1.0;
        double r18507484 = r18507482 * r18507483;
        double r18507485 = t;
        double r18507486 = r18507485 / r18507482;
        double r18507487 = 0.5;
        double r18507488 = r18507486 * r18507487;
        double r18507489 = r18507488 * r18507480;
        double r18507490 = r18507484 - r18507489;
        double r18507491 = r18507481 / r18507490;
        double r18507492 = r18507479 + r18507491;
        return r18507492;
}

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

Derivation

  1. Initial program 12.0

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z \cdot 2}{\mathsf{fma}\left(-y, t, \left(z \cdot 2\right) \cdot z\right)}, -y, x\right)}\]
  3. Using strategy rm
  4. Applied clear-num6.3

    \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{\mathsf{fma}\left(-y, t, \left(z \cdot 2\right) \cdot z\right)}{z \cdot 2}}}, -y, x\right)\]
  5. Taylor expanded around 0 2.7

    \[\leadsto \mathsf{fma}\left(\frac{1}{\color{blue}{1 \cdot z - 0.5 \cdot \frac{t \cdot y}{z}}}, -y, x\right)\]
  6. Using strategy rm
  7. Applied fma-udef2.7

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

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

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

Reproduce

herbie shell --seed 2019171 +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)))))