Average Error: 0.0 → 0.1
Time: 2.8s
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 r208666 = x;
        double r208667 = y;
        double r208668 = 1.0;
        double r208669 = r208666 * r208667;
        double r208670 = 2.0;
        double r208671 = r208669 / r208670;
        double r208672 = r208668 + r208671;
        double r208673 = r208667 / r208672;
        double r208674 = r208666 - r208673;
        return r208674;
}

double f(double x, double y) {
        double r208675 = x;
        double r208676 = 1.0;
        double r208677 = 0.5;
        double r208678 = 1.0;
        double r208679 = y;
        double r208680 = r208676 / r208679;
        double r208681 = r208678 * r208680;
        double r208682 = fma(r208677, r208675, r208681);
        double r208683 = r208676 / r208682;
        double r208684 = r208675 - r208683;
        return r208684;
}

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 2020035 +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)))))