Average Error: 0.0 → 0.0
Time: 1.9s
Precision: 64
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
\[x - \frac{1}{\mathsf{fma}\left(x, 0.5, \frac{1}{y}\right)}\]
x - \frac{y}{1 + \frac{x \cdot y}{2}}
x - \frac{1}{\mathsf{fma}\left(x, 0.5, \frac{1}{y}\right)}
double f(double x, double y) {
        double r260122 = x;
        double r260123 = y;
        double r260124 = 1.0;
        double r260125 = r260122 * r260123;
        double r260126 = 2.0;
        double r260127 = r260125 / r260126;
        double r260128 = r260124 + r260127;
        double r260129 = r260123 / r260128;
        double r260130 = r260122 - r260129;
        return r260130;
}

double f(double x, double y) {
        double r260131 = x;
        double r260132 = 1.0;
        double r260133 = 0.5;
        double r260134 = 1.0;
        double r260135 = y;
        double r260136 = r260134 / r260135;
        double r260137 = fma(r260131, r260133, r260136);
        double r260138 = r260132 / r260137;
        double r260139 = r260131 - r260138;
        return r260139;
}

Error

Bits error versus x

Bits error versus y

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.0

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

    \[\leadsto x - \frac{1}{\color{blue}{\mathsf{fma}\left(x, 0.5, \frac{1}{y}\right)}}\]
  6. Final simplification0.0

    \[\leadsto x - \frac{1}{\mathsf{fma}\left(x, 0.5, \frac{1}{y}\right)}\]

Reproduce

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