Average Error: 0.0 → 0.1
Time: 1.4s
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 r206549 = x;
        double r206550 = y;
        double r206551 = 1.0;
        double r206552 = r206549 * r206550;
        double r206553 = 2.0;
        double r206554 = r206552 / r206553;
        double r206555 = r206551 + r206554;
        double r206556 = r206550 / r206555;
        double r206557 = r206549 - r206556;
        return r206557;
}

double f(double x, double y) {
        double r206558 = x;
        double r206559 = 1.0;
        double r206560 = 0.5;
        double r206561 = 1.0;
        double r206562 = y;
        double r206563 = r206561 / r206562;
        double r206564 = fma(r206558, r206560, r206563);
        double r206565 = r206559 / r206564;
        double r206566 = r206558 - r206565;
        return r206566;
}

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

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

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

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

Reproduce

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