Average Error: 0.0 → 0.1
Time: 2.2s
Precision: 64
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
\[x - \frac{1}{\mathsf{fma}\left(0.5, x, 1 \cdot \frac{1}{y}\right)}\]
x - \frac{y}{1 + \frac{x \cdot y}{2}}
x - \frac{1}{\mathsf{fma}\left(0.5, x, 1 \cdot \frac{1}{y}\right)}
double f(double x, double y) {
        double r314088 = x;
        double r314089 = y;
        double r314090 = 1.0;
        double r314091 = r314088 * r314089;
        double r314092 = 2.0;
        double r314093 = r314091 / r314092;
        double r314094 = r314090 + r314093;
        double r314095 = r314089 / r314094;
        double r314096 = r314088 - r314095;
        return r314096;
}

double f(double x, double y) {
        double r314097 = x;
        double r314098 = 1.0;
        double r314099 = 0.5;
        double r314100 = 1.0;
        double r314101 = y;
        double r314102 = r314098 / r314101;
        double r314103 = r314100 * r314102;
        double r314104 = fma(r314099, r314097, r314103);
        double r314105 = r314098 / r314104;
        double r314106 = r314097 - r314105;
        return r314106;
}

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(0.5, x, 1 \cdot \frac{1}{y}\right)}}\]
  6. Final simplification0.1

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

Reproduce

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