Average Error: 0.0 → 0.0
Time: 19.4s
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 \mathsf{fma}\left(\mathsf{fma}\left(0.27061, x, 2.30753\right), \frac{1}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\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 \mathsf{fma}\left(\mathsf{fma}\left(0.27061, x, 2.30753\right), \frac{1}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.04481, 0.99229\right), 1.0\right)}, -x\right)
double f(double x) {
        double r5937127 = 0.70711;
        double r5937128 = 2.30753;
        double r5937129 = x;
        double r5937130 = 0.27061;
        double r5937131 = r5937129 * r5937130;
        double r5937132 = r5937128 + r5937131;
        double r5937133 = 1.0;
        double r5937134 = 0.99229;
        double r5937135 = 0.04481;
        double r5937136 = r5937129 * r5937135;
        double r5937137 = r5937134 + r5937136;
        double r5937138 = r5937129 * r5937137;
        double r5937139 = r5937133 + r5937138;
        double r5937140 = r5937132 / r5937139;
        double r5937141 = r5937140 - r5937129;
        double r5937142 = r5937127 * r5937141;
        return r5937142;
}

double f(double x) {
        double r5937143 = 0.70711;
        double r5937144 = 0.27061;
        double r5937145 = x;
        double r5937146 = 2.30753;
        double r5937147 = fma(r5937144, r5937145, r5937146);
        double r5937148 = 1.0;
        double r5937149 = 0.04481;
        double r5937150 = 0.99229;
        double r5937151 = fma(r5937145, r5937149, r5937150);
        double r5937152 = 1.0;
        double r5937153 = fma(r5937145, r5937151, r5937152);
        double r5937154 = r5937148 / r5937153;
        double r5937155 = -r5937145;
        double r5937156 = fma(r5937147, r5937154, r5937155);
        double r5937157 = r5937143 * r5937156;
        return r5937157;
}

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

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

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

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

Reproduce

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