Average Error: 0.0 → 0.1
Time: 2.8s
Precision: 64
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
\[x - \frac{1}{0.5 \cdot x + 1 \cdot \frac{1}{y}}\]
x - \frac{y}{1 + \frac{x \cdot y}{2}}
x - \frac{1}{0.5 \cdot x + 1 \cdot \frac{1}{y}}
double f(double x, double y) {
        double r300969 = x;
        double r300970 = y;
        double r300971 = 1.0;
        double r300972 = r300969 * r300970;
        double r300973 = 2.0;
        double r300974 = r300972 / r300973;
        double r300975 = r300971 + r300974;
        double r300976 = r300970 / r300975;
        double r300977 = r300969 - r300976;
        return r300977;
}

double f(double x, double y) {
        double r300978 = x;
        double r300979 = 1.0;
        double r300980 = 0.5;
        double r300981 = r300980 * r300978;
        double r300982 = 1.0;
        double r300983 = y;
        double r300984 = r300979 / r300983;
        double r300985 = r300982 * r300984;
        double r300986 = r300981 + r300985;
        double r300987 = r300979 / r300986;
        double r300988 = r300978 - r300987;
        return r300988;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
  2. Using strategy rm
  3. Applied clear-num0.1

    \[\leadsto x - \color{blue}{\frac{1}{\frac{1 + \frac{x \cdot y}{2}}{y}}}\]
  4. Taylor expanded around 0 0.1

    \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot x + 1 \cdot \frac{1}{y}}}\]
  5. Final simplification0.1

    \[\leadsto x - \frac{1}{0.5 \cdot x + 1 \cdot \frac{1}{y}}\]

Reproduce

herbie shell --seed 2020035 
(FPCore (x y)
  :name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, B"
  :precision binary64
  (- x (/ y (+ 1 (/ (* x y) 2)))))