Average Error: 0.0 → 0.1
Time: 9.1s
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 r7372128 = x;
        double r7372129 = y;
        double r7372130 = 1.0;
        double r7372131 = r7372128 * r7372129;
        double r7372132 = 2.0;
        double r7372133 = r7372131 / r7372132;
        double r7372134 = r7372130 + r7372133;
        double r7372135 = r7372129 / r7372134;
        double r7372136 = r7372128 - r7372135;
        return r7372136;
}

double f(double x, double y) {
        double r7372137 = x;
        double r7372138 = y;
        double r7372139 = 1.0;
        double r7372140 = 2.0;
        double r7372141 = r7372137 / r7372140;
        double r7372142 = 1.0;
        double r7372143 = fma(r7372141, r7372138, r7372142);
        double r7372144 = r7372139 / r7372143;
        double r7372145 = r7372138 * r7372144;
        double r7372146 = r7372137 - r7372145;
        return r7372146;
}

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(\frac{x}{2}, y, 1\right)}}\]
  3. Using strategy rm
  4. Applied div-inv0.1

    \[\leadsto x - \color{blue}{y \cdot \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 2019170 +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)))))