Average Error: 0.0 → 0.1
Time: 9.3s
Precision: 64
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
\[x - y \cdot \frac{1}{\mathsf{fma}\left(\frac{x}{2}, y, 1\right)}\]
x - \frac{y}{1 + \frac{x \cdot y}{2}}
x - y \cdot \frac{1}{\mathsf{fma}\left(\frac{x}{2}, y, 1\right)}
double f(double x, double y) {
        double r230451 = x;
        double r230452 = y;
        double r230453 = 1.0;
        double r230454 = r230451 * r230452;
        double r230455 = 2.0;
        double r230456 = r230454 / r230455;
        double r230457 = r230453 + r230456;
        double r230458 = r230452 / r230457;
        double r230459 = r230451 - r230458;
        return r230459;
}

double f(double x, double y) {
        double r230460 = x;
        double r230461 = y;
        double r230462 = 1.0;
        double r230463 = 2.0;
        double r230464 = r230460 / r230463;
        double r230465 = 1.0;
        double r230466 = fma(r230464, r230461, r230465);
        double r230467 = r230462 / r230466;
        double r230468 = r230461 * r230467;
        double r230469 = r230460 - r230468;
        return r230469;
}

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

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

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

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

Reproduce

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