Average Error: 11.5 → 2.7
Time: 13.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}{1 \cdot z - \frac{0.5}{z} \cdot \left(t \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 - \frac{0.5}{z} \cdot \left(t \cdot y\right)}
double f(double x, double y, double z, double t) {
        double r16830037 = x;
        double r16830038 = y;
        double r16830039 = 2.0;
        double r16830040 = r16830038 * r16830039;
        double r16830041 = z;
        double r16830042 = r16830040 * r16830041;
        double r16830043 = r16830041 * r16830039;
        double r16830044 = r16830043 * r16830041;
        double r16830045 = t;
        double r16830046 = r16830038 * r16830045;
        double r16830047 = r16830044 - r16830046;
        double r16830048 = r16830042 / r16830047;
        double r16830049 = r16830037 - r16830048;
        return r16830049;
}

double f(double x, double y, double z, double t) {
        double r16830050 = x;
        double r16830051 = y;
        double r16830052 = -r16830051;
        double r16830053 = 1.0;
        double r16830054 = z;
        double r16830055 = r16830053 * r16830054;
        double r16830056 = 0.5;
        double r16830057 = r16830056 / r16830054;
        double r16830058 = t;
        double r16830059 = r16830058 * r16830051;
        double r16830060 = r16830057 * r16830059;
        double r16830061 = r16830055 - r16830060;
        double r16830062 = r16830052 / r16830061;
        double r16830063 = r16830050 + r16830062;
        return r16830063;
}

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

Derivation

  1. Initial program 11.5

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

    \[\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-num5.7

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

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

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

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

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

Reproduce

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