Jmat.Real.erfi, branch x less than or equal to 0.5

Percentage Accurate: 99.8% → 99.8%
Time: 14.7s
Alternatives: 8
Speedup: 3.0×

Specification

?
\[x \leq 0.5\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\ t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\ \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
        (t_1 (* (* t_0 (fabs x)) (fabs x))))
   (fabs
    (*
     (/ 1.0 (sqrt PI))
     (+
      (+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
      (* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
	double t_0 = (fabs(x) * fabs(x)) * fabs(x);
	double t_1 = (t_0 * fabs(x)) * fabs(x);
	return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
	double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
	double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
	return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x):
	t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x)
	t_1 = (t_0 * math.fabs(x)) * math.fabs(x)
	return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x)
	t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x))
	t_1 = Float64(Float64(t_0 * abs(x)) * abs(x))
	return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x))))))
end
function tmp = code(x)
	t_0 = (abs(x) * abs(x)) * abs(x);
	t_1 = (t_0 * abs(x)) * abs(x);
	tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x))))));
end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, 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] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\ t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\ \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
        (t_1 (* (* t_0 (fabs x)) (fabs x))))
   (fabs
    (*
     (/ 1.0 (sqrt PI))
     (+
      (+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
      (* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
	double t_0 = (fabs(x) * fabs(x)) * fabs(x);
	double t_1 = (t_0 * fabs(x)) * fabs(x);
	return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
	double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
	double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
	return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x):
	t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x)
	t_1 = (t_0 * math.fabs(x)) * math.fabs(x)
	return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x)
	t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x))
	t_1 = Float64(Float64(t_0 * abs(x)) * abs(x))
	return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x))))))
end
function tmp = code(x)
	t_0 = (abs(x) * abs(x)) * abs(x);
	t_1 = (t_0 * abs(x)) * abs(x);
	tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x))))));
end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, 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] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}

Alternative 1: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, \mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right), 0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)\right)\right| \end{array} \]
(FPCore (x)
 :precision binary64
 (fabs
  (*
   (/ 1.0 (sqrt PI))
   (fma
    0.047619047619047616
    (pow (fabs x) 7.0)
    (fma
     (fabs x)
     (fma x (* x 0.6666666666666666) 2.0)
     (* 0.2 (pow (fabs x) 5.0)))))))
double code(double x) {
	return fabs(((1.0 / sqrt(((double) M_PI))) * fma(0.047619047619047616, pow(fabs(x), 7.0), fma(fabs(x), fma(x, (x * 0.6666666666666666), 2.0), (0.2 * pow(fabs(x), 5.0))))));
}
function code(x)
	return abs(Float64(Float64(1.0 / sqrt(pi)) * fma(0.047619047619047616, (abs(x) ^ 7.0), fma(abs(x), fma(x, Float64(x * 0.6666666666666666), 2.0), Float64(0.2 * (abs(x) ^ 5.0))))))
end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(0.047619047619047616 * N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(x * N[(x * 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] + N[(0.2 * N[Power[N[Abs[x], $MachinePrecision], 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, \mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right), 0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\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. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left(\frac{1}{21} \cdot {\left(\left|x\right|\right)}^{7} + \left(\frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5} + \left(\frac{2}{3} \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right)\right)}\right| \]
  4. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5} + \left(\frac{2}{3} \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right)}\right| \]
    2. lower-pow.f64N/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, \color{blue}{{\left(\left|x\right|\right)}^{7}}, \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5} + \left(\frac{2}{3} \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right)\right| \]
    3. lower-fabs.f64N/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\color{blue}{\left(\left|x\right|\right)}}^{7}, \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5} + \left(\frac{2}{3} \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right)\right| \]
    4. +-commutativeN/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \color{blue}{\left(\frac{2}{3} \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right) + \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5}}\right)\right| \]
    5. +-commutativeN/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \color{blue}{\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot {\left(\left|x\right|\right)}^{3}\right)} + \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5}\right)\right| \]
    6. unpow3N/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \color{blue}{\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)}\right) + \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5}\right)\right| \]
    7. associate-*r*N/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \left(2 \cdot \left|x\right| + \color{blue}{\left(\frac{2}{3} \cdot \left(\left|x\right| \cdot \left|x\right|\right)\right) \cdot \left|x\right|}\right) + \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5}\right)\right| \]
    8. distribute-rgt-outN/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \color{blue}{\left|x\right| \cdot \left(2 + \frac{2}{3} \cdot \left(\left|x\right| \cdot \left|x\right|\right)\right)} + \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5}\right)\right| \]
    9. lower-fma.f64N/A

      \[\leadsto \left|\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, \color{blue}{\mathsf{fma}\left(\left|x\right|, 2 + \frac{2}{3} \cdot \left(\left|x\right| \cdot \left|x\right|\right), \frac{1}{5} \cdot {\left(\left|x\right|\right)}^{5}\right)}\right)\right| \]
  5. Applied rewrites99.9%

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \color{blue}{\mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, \mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right), 0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)\right)}\right| \]
  6. Add Preprocessing

Alternative 2: 99.8% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\ \left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(\left(x \cdot x\right) \cdot t\_0, 0.047619047619047616 \cdot \left|x\right|, \mathsf{fma}\left(\left|x\right|, 0.2 \cdot t\_0, \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right| \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (* x (* x (* x x)))))
   (fabs
    (*
     (/ 1.0 (sqrt PI))
     (fma
      (* (* x x) t_0)
      (* 0.047619047619047616 (fabs x))
      (fma
       (fabs x)
       (* 0.2 t_0)
       (* (fabs x) (fma 0.6666666666666666 (* x x) 2.0))))))))
double code(double x) {
	double t_0 = x * (x * (x * x));
	return fabs(((1.0 / sqrt(((double) M_PI))) * fma(((x * x) * t_0), (0.047619047619047616 * fabs(x)), fma(fabs(x), (0.2 * t_0), (fabs(x) * fma(0.6666666666666666, (x * x), 2.0))))));
}
function code(x)
	t_0 = Float64(x * Float64(x * Float64(x * x)))
	return abs(Float64(Float64(1.0 / sqrt(pi)) * fma(Float64(Float64(x * x) * t_0), Float64(0.047619047619047616 * abs(x)), fma(abs(x), Float64(0.2 * t_0), Float64(abs(x) * fma(0.6666666666666666, Float64(x * x), 2.0))))))
end
code[x_] := Block[{t$95$0 = N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(0.047619047619047616 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(0.2 * t$95$0), $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(\left(x \cdot x\right) \cdot t\_0, 0.047619047619047616 \cdot \left|x\right|, \mathsf{fma}\left(\left|x\right|, 0.2 \cdot t\_0, \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right|
\end{array}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\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. Add Preprocessing
  3. Applied rewrites99.8%

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \color{blue}{\mathsf{fma}\left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), \left|x\right| \cdot 0.047619047619047616, \mathsf{fma}\left(\left|x\right|, 0.2 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)}\right| \]
  4. Final simplification99.8%

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), 0.047619047619047616 \cdot \left|x\right|, \mathsf{fma}\left(\left|x\right|, 0.2 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right| \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2024230 
(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)))))))