Average Error: 0.0 → 0.0
Time: 36.7s
Precision: 64
\[0.70711 \cdot \left(\frac{2.30753 + x \cdot 0.27061}{1.0 + x \cdot \left(0.99229 + x \cdot 0.04481\right)} - x\right)\]
\[0.70711 \cdot \left(\frac{\mathsf{fma}\left(0.27061, x, 2.30753\right)}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\right)\right)\right)} - x\right)\]
0.70711 \cdot \left(\frac{2.30753 + x \cdot 0.27061}{1.0 + x \cdot \left(0.99229 + x \cdot 0.04481\right)} - x\right)
0.70711 \cdot \left(\frac{\mathsf{fma}\left(0.27061, x, 2.30753\right)}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\right)\right)\right)} - x\right)
double f(double x) {
        double r4610290 = 0.70711;
        double r4610291 = 2.30753;
        double r4610292 = x;
        double r4610293 = 0.27061;
        double r4610294 = r4610292 * r4610293;
        double r4610295 = r4610291 + r4610294;
        double r4610296 = 1.0;
        double r4610297 = 0.99229;
        double r4610298 = 0.04481;
        double r4610299 = r4610292 * r4610298;
        double r4610300 = r4610297 + r4610299;
        double r4610301 = r4610292 * r4610300;
        double r4610302 = r4610296 + r4610301;
        double r4610303 = r4610295 / r4610302;
        double r4610304 = r4610303 - r4610292;
        double r4610305 = r4610290 * r4610304;
        return r4610305;
}

double f(double x) {
        double r4610306 = 0.70711;
        double r4610307 = 0.27061;
        double r4610308 = x;
        double r4610309 = 2.30753;
        double r4610310 = fma(r4610307, r4610308, r4610309);
        double r4610311 = 0.04481;
        double r4610312 = 0.99229;
        double r4610313 = fma(r4610308, r4610311, r4610312);
        double r4610314 = 1.0;
        double r4610315 = fma(r4610308, r4610313, r4610314);
        double r4610316 = log1p(r4610315);
        double r4610317 = expm1(r4610316);
        double r4610318 = r4610310 / r4610317;
        double r4610319 = r4610318 - r4610308;
        double r4610320 = r4610306 * r4610319;
        return r4610320;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[0.70711 \cdot \left(\frac{2.30753 + x \cdot 0.27061}{1.0 + x \cdot \left(0.99229 + x \cdot 0.04481\right)} - x\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\left(\frac{\mathsf{fma}\left(0.27061, x, 2.30753\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\right)} - x\right) \cdot 0.70711}\]
  3. Using strategy rm
  4. Applied expm1-log1p-u0.0

    \[\leadsto \left(\frac{\mathsf{fma}\left(0.27061, x, 2.30753\right)}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\right)\right)\right)}} - x\right) \cdot 0.70711\]
  5. Final simplification0.0

    \[\leadsto 0.70711 \cdot \left(\frac{\mathsf{fma}\left(0.27061, x, 2.30753\right)}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\right)\right)\right)} - x\right)\]

Reproduce

herbie shell --seed 2019165 +o rules:numerics
(FPCore (x)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, B"
  (* 0.70711 (- (/ (+ 2.30753 (* x 0.27061)) (+ 1.0 (* x (+ 0.99229 (* x 0.04481))))) x)))