Average Error: 0.0 → 0.0
Time: 11.5s
Precision: 64
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
\[x - y \cdot \frac{1}{\mathsf{fma}\left(x, \frac{y}{2}, 1\right)}\]
x - \frac{y}{1 + \frac{x \cdot y}{2}}
x - y \cdot \frac{1}{\mathsf{fma}\left(x, \frac{y}{2}, 1\right)}
double f(double x, double y) {
        double r147104 = x;
        double r147105 = y;
        double r147106 = 1.0;
        double r147107 = r147104 * r147105;
        double r147108 = 2.0;
        double r147109 = r147107 / r147108;
        double r147110 = r147106 + r147109;
        double r147111 = r147105 / r147110;
        double r147112 = r147104 - r147111;
        return r147112;
}

double f(double x, double y) {
        double r147113 = x;
        double r147114 = y;
        double r147115 = 1.0;
        double r147116 = 2.0;
        double r147117 = r147114 / r147116;
        double r147118 = 1.0;
        double r147119 = fma(r147113, r147117, r147118);
        double r147120 = r147115 / r147119;
        double r147121 = r147114 * r147120;
        double r147122 = r147113 - r147121;
        return r147122;
}

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

    \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, \frac{y}{2}, 1\right)}}\]
  3. Using strategy rm
  4. Applied div-inv0.0

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

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

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
  :name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, B"
  (- x (/ y (+ 1.0 (/ (* x y) 2.0)))))