Average Error: 0.1 → 0.1
Time: 3.1s
Precision: binary64
\[x \leq 0.5\]
\[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
\[\left|{\pi}^{-0.5} \cdot \mathsf{fma}\left(0.047619047619047616, {x}^{7}, \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.6666666666666666, {x}^{3}, 0.2 \cdot {x}^{5}\right)\right)\right)\right| \]
(FPCore (x)
 :precision binary64
 (fabs
  (*
   (/ 1.0 (sqrt PI))
   (+
    (+
     (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) (* (* (fabs x) (fabs x)) (fabs x))))
     (*
      (/ 1.0 5.0)
      (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x))))
    (*
     (/ 1.0 21.0)
     (*
      (* (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x)) (fabs x))
      (fabs x)))))))
(FPCore (x)
 :precision binary64
 (fabs
  (*
   (pow PI -0.5)
   (fma
    0.047619047619047616
    (pow x 7.0)
    (fma 2.0 x (fma 0.6666666666666666 (pow x 3.0) (* 0.2 (pow x 5.0))))))))
double code(double x) {
	return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * ((fabs(x) * fabs(x)) * fabs(x)))) + ((1.0 / 5.0) * ((((fabs(x) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)))) + ((1.0 / 21.0) * ((((((fabs(x) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x))))));
}
double code(double x) {
	return fabs((pow(((double) M_PI), -0.5) * fma(0.047619047619047616, pow(x, 7.0), fma(2.0, x, fma(0.6666666666666666, pow(x, 3.0), (0.2 * pow(x, 5.0)))))));
}
function code(x)
	return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * Float64(Float64(abs(x) * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 5.0) * Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 21.0) * Float64(Float64(Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x))))))
end
function code(x)
	return abs(Float64((pi ^ -0.5) * fma(0.047619047619047616, (x ^ 7.0), fma(2.0, x, fma(0.6666666666666666, (x ^ 3.0), Float64(0.2 * (x ^ 5.0)))))))
end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * N[(N[(N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Abs[N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision] + N[(2.0 * x + N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision] + N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\left|{\pi}^{-0.5} \cdot \mathsf{fma}\left(0.047619047619047616, {x}^{7}, \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.6666666666666666, {x}^{3}, 0.2 \cdot {x}^{5}\right)\right)\right)\right|

Error

Bits error versus x

Derivation

  1. Initial program 0.1

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Taylor expanded in x around 0 0.1

    \[\leadsto \left|\color{blue}{\sqrt{\frac{1}{\pi}} \cdot \left(0.047619047619047616 \cdot {\left(\left|x\right|\right)}^{7} + \left(2 \cdot \left|x\right| + \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)\right)\right)}\right| \]
  3. Applied egg-rr0.1

    \[\leadsto \left|\color{blue}{{\left(\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, \mathsf{fma}\left(2, \left|x\right|, \mathsf{fma}\left(0.6666666666666666, {\left(\left|x\right|\right)}^{3}, 0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)\right)\right)\right)}^{1}}\right| \]
  4. Applied egg-rr0.5

    \[\leadsto \left|{\color{blue}{\left(\frac{1}{\frac{\sqrt{\pi}}{\mathsf{fma}\left(0.047619047619047616, {x}^{7}, \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.6666666666666666, {x}^{3}, 0.2 \cdot {x}^{5}\right)\right)\right)}}\right)}}^{1}\right| \]
  5. Applied egg-rr0.1

    \[\leadsto \left|{\color{blue}{\left(\left({\pi}^{-0.5} \cdot 1\right) \cdot \mathsf{fma}\left(0.047619047619047616, {x}^{7}, \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.6666666666666666, {x}^{3}, 0.2 \cdot {x}^{5}\right)\right)\right)\right)}}^{1}\right| \]
  6. Final simplification0.1

    \[\leadsto \left|{\pi}^{-0.5} \cdot \mathsf{fma}\left(0.047619047619047616, {x}^{7}, \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.6666666666666666, {x}^{3}, 0.2 \cdot {x}^{5}\right)\right)\right)\right| \]

Reproduce

herbie shell --seed 2022155 
(FPCore (x)
  :name "Jmat.Real.erfi, branch x less than or equal to 0.5"
  :precision binary64
  :pre (<= x 0.5)
  (fabs (* (/ 1.0 (sqrt PI)) (+ (+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) (* (* (fabs x) (fabs x)) (fabs x)))) (* (/ 1.0 5.0) (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x)))) (* (/ 1.0 21.0) (* (* (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x)) (fabs x)) (fabs x)))))))