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

Percentage Accurate: 99.8% → 99.8%
Time: 13.9s
Alternatives: 9
Speedup: N/A×

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 9 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, 2.5× speedup?

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

\\
\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}
\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.4%

    \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
  4. Step-by-step derivation
    1. lift-fabs.f64N/A

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.5:\\ \;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\\ \mathbf{else}:\\ \;\;\;\;\left|x\right| \cdot \frac{\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right)}{\sqrt{\pi}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.5)
   (*
    (fabs x)
    (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI)))
   (*
    (fabs x)
    (/
     (*
      (* x x)
      (fma x (* x (fma (* x x) 0.047619047619047616 0.2)) 0.6666666666666666))
     (sqrt PI)))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.5) {
		tmp = fabs(x) * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)));
	} else {
		tmp = fabs(x) * (((x * x) * fma(x, (x * fma((x * x), 0.047619047619047616, 0.2)), 0.6666666666666666)) / sqrt(((double) M_PI)));
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.5)
		tmp = Float64(abs(x) * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)));
	else
		tmp = Float64(abs(x) * Float64(Float64(Float64(x * x) * fma(x, Float64(x * fma(Float64(x * x), 0.047619047619047616, 0.2)), 0.6666666666666666)) / sqrt(pi)));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.5], N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.047619047619047616 + 0.2), $MachinePrecision]), $MachinePrecision] + 0.6666666666666666), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.5:\\
\;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\\

\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \frac{\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right)}{\sqrt{\pi}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fabs.f64 x) < 0.5

    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.2%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{5}, \frac{2}{3}\right)}, 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      10. lower-*.f6499.5

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.2}, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}} \]
    11. Applied rewrites99.5%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]

    if 0.5 < (fabs.f64 x)

    1. Initial program 99.9%

      \[\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.9%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{x}^{6} \cdot \left(\frac{1}{21} + \left(\frac{\frac{2}{3}}{{x}^{4}} + \frac{1}{5} \cdot \frac{1}{{x}^{2}}\right)\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
    10. Applied rewrites99.8%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right)}}{\sqrt{\pi}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.5:\\ \;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\\ \mathbf{else}:\\ \;\;\;\;\left|x\right| \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right)\right)\right)\right)}{\sqrt{\pi}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.5)
   (*
    (fabs x)
    (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI)))
   (*
    (fabs x)
    (/
     (* x (* x (* x (* x (fma (* x x) 0.047619047619047616 0.2)))))
     (sqrt PI)))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.5) {
		tmp = fabs(x) * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)));
	} else {
		tmp = fabs(x) * ((x * (x * (x * (x * fma((x * x), 0.047619047619047616, 0.2))))) / sqrt(((double) M_PI)));
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.5)
		tmp = Float64(abs(x) * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)));
	else
		tmp = Float64(abs(x) * Float64(Float64(x * Float64(x * Float64(x * Float64(x * fma(Float64(x * x), 0.047619047619047616, 0.2))))) / sqrt(pi)));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.5], N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[(N[(x * N[(x * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.047619047619047616 + 0.2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.5:\\
\;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\\

\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right)\right)\right)\right)}{\sqrt{\pi}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fabs.f64 x) < 0.5

    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.2%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{5}, \frac{2}{3}\right)}, 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      10. lower-*.f6499.5

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.2}, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}} \]
    11. Applied rewrites99.5%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]

    if 0.5 < (fabs.f64 x)

    1. Initial program 99.9%

      \[\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.9%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{x}^{6} \cdot \left(\frac{1}{21} + \frac{1}{5} \cdot \frac{1}{{x}^{2}}\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
    10. Applied rewrites99.4%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right)\right)\right)\right)}}{\sqrt{\pi}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 99.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.5:\\ \;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\\ \mathbf{else}:\\ \;\;\;\;\left|x\right| \cdot \frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.047619047619047616\right)\right)}{\sqrt{\pi}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.5)
   (*
    (fabs x)
    (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI)))
   (*
    (fabs x)
    (/ (* (* x (* x x)) (* x (* (* x x) 0.047619047619047616))) (sqrt PI)))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.5) {
		tmp = fabs(x) * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)));
	} else {
		tmp = fabs(x) * (((x * (x * x)) * (x * ((x * x) * 0.047619047619047616))) / sqrt(((double) M_PI)));
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.5)
		tmp = Float64(abs(x) * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)));
	else
		tmp = Float64(abs(x) * Float64(Float64(Float64(x * Float64(x * x)) * Float64(x * Float64(Float64(x * x) * 0.047619047619047616))) / sqrt(pi)));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.5], N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * N[(N[(x * x), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.5:\\
\;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\\

\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.047619047619047616\right)\right)}{\sqrt{\pi}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fabs.f64 x) < 0.5

    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.2%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{5}, \frac{2}{3}\right)}, 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      10. lower-*.f6499.5

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.2}, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}} \]
    11. Applied rewrites99.5%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]

    if 0.5 < (fabs.f64 x)

    1. Initial program 99.9%

      \[\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.9%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\frac{1}{21} \cdot {x}^{6}}}{\sqrt{\mathsf{PI}\left(\right)}} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{x}^{6} \cdot \frac{1}{21}}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      2. metadata-evalN/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{\color{blue}{\left(2 \cdot 3\right)}} \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      3. pow-sqrN/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\left({x}^{3} \cdot {x}^{3}\right)} \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      4. cube-prodN/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{\left(x \cdot x\right)}^{3}} \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      5. unpow2N/A

        \[\leadsto \left|x\right| \cdot \frac{{\color{blue}{\left({x}^{2}\right)}}^{3} \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      6. cube-unmultN/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\left({x}^{2} \cdot \left({x}^{2} \cdot {x}^{2}\right)\right)} \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      7. pow-sqrN/A

        \[\leadsto \left|x\right| \cdot \frac{\left({x}^{2} \cdot \color{blue}{{x}^{\left(2 \cdot 2\right)}}\right) \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      8. metadata-evalN/A

        \[\leadsto \left|x\right| \cdot \frac{\left({x}^{2} \cdot {x}^{\color{blue}{4}}\right) \cdot \frac{1}{21}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      9. associate-*r*N/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{x}^{2} \cdot \left({x}^{4} \cdot \frac{1}{21}\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      10. *-commutativeN/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{2} \cdot \color{blue}{\left(\frac{1}{21} \cdot {x}^{4}\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      11. metadata-evalN/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{2} \cdot \left(\frac{1}{21} \cdot {x}^{\color{blue}{\left(2 \cdot 2\right)}}\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      12. pow-sqrN/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{2} \cdot \left(\frac{1}{21} \cdot \color{blue}{\left({x}^{2} \cdot {x}^{2}\right)}\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. associate-*l*N/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{2} \cdot \color{blue}{\left(\left(\frac{1}{21} \cdot {x}^{2}\right) \cdot {x}^{2}\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      14. *-commutativeN/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \left(\frac{1}{21} \cdot {x}^{2}\right)\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      15. unpow2N/A

        \[\leadsto \left|x\right| \cdot \frac{{x}^{2} \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \left(\frac{1}{21} \cdot {x}^{2}\right)\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      16. associate-*l*N/A

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

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\left({x}^{2} \cdot x\right) \cdot \left(x \cdot \left(\frac{1}{21} \cdot {x}^{2}\right)\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      18. unpow2N/A

        \[\leadsto \left|x\right| \cdot \frac{\left(\color{blue}{\left(x \cdot x\right)} \cdot x\right) \cdot \left(x \cdot \left(\frac{1}{21} \cdot {x}^{2}\right)\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      19. unpow3N/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{x}^{3}} \cdot \left(x \cdot \left(\frac{1}{21} \cdot {x}^{2}\right)\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      20. lower-*.f64N/A

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{{x}^{3} \cdot \left(x \cdot \left(\frac{1}{21} \cdot {x}^{2}\right)\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
    11. Applied rewrites98.5%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.047619047619047616\right)\right)}}{\sqrt{\pi}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 99.8% accurate, 3.0× speedup?

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

\\
\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}
\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.4%

    \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
  4. Step-by-step derivation
    1. lift-fabs.f64N/A

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

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

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

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

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

    \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
  6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
    13. lower-*.f6499.8

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

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

Alternative 6: 93.1% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.5:\\ \;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left(\left(x \cdot x\right) \cdot 0.2\right) \cdot \left(x \cdot \left(x \cdot \left|x\right|\right)\right)}{\sqrt{\pi}}\right|\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.5)
   (* (fabs x) (/ (fma 0.6666666666666666 (* x x) 2.0) (sqrt PI)))
   (fabs (/ (* (* (* x x) 0.2) (* x (* x (fabs x)))) (sqrt PI)))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.5) {
		tmp = fabs(x) * (fma(0.6666666666666666, (x * x), 2.0) / sqrt(((double) M_PI)));
	} else {
		tmp = fabs(((((x * x) * 0.2) * (x * (x * fabs(x)))) / sqrt(((double) M_PI))));
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.5)
		tmp = Float64(abs(x) * Float64(fma(0.6666666666666666, Float64(x * x), 2.0) / sqrt(pi)));
	else
		tmp = abs(Float64(Float64(Float64(Float64(x * x) * 0.2) * Float64(x * Float64(x * abs(x)))) / sqrt(pi)));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.5], N[(N[Abs[x], $MachinePrecision] * N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(N[(N[(x * x), $MachinePrecision] * 0.2), $MachinePrecision] * N[(x * N[(x * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.5:\\
\;\;\;\;\left|x\right| \cdot \frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(\left(x \cdot x\right) \cdot 0.2\right) \cdot \left(x \cdot \left(x \cdot \left|x\right|\right)\right)}{\sqrt{\pi}}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fabs.f64 x) < 0.5

    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.2%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{2}{3}, {x}^{2}, 2\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      3. unpow2N/A

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(\frac{2}{3}, \color{blue}{x \cdot x}, 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      4. lower-*.f6499.4

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(0.6666666666666666, \color{blue}{x \cdot x}, 2\right)}{\sqrt{\pi}} \]
    8. Applied rewrites99.4%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}}{\sqrt{\pi}} \]

    if 0.5 < (fabs.f64 x)

    1. Initial program 99.9%

      \[\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.9%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Taylor expanded in x around 0

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

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

        \[\leadsto \left|\frac{\left|x\right| \cdot 2 + {x}^{2} \cdot \color{blue}{\left(\frac{2}{3} \cdot \left|x\right| + \frac{1}{5} \cdot \left({x}^{2} \cdot \left|x\right|\right)\right)}}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
      3. distribute-lft-inN/A

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

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

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

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

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

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

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

        \[\leadsto \left|\frac{\left|x\right| \cdot 2 + \left|x\right| \cdot \left(\frac{2}{3} \cdot {x}^{2} + \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{5}}\right)}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
      11. pow-sqrN/A

        \[\leadsto \left|\frac{\left|x\right| \cdot 2 + \left|x\right| \cdot \left(\frac{2}{3} \cdot {x}^{2} + \color{blue}{{x}^{\left(2 \cdot 2\right)}} \cdot \frac{1}{5}\right)}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
      12. metadata-evalN/A

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

        \[\leadsto \left|\frac{\left|x\right| \cdot 2 + \left|x\right| \cdot \left(\frac{2}{3} \cdot {x}^{2} + \color{blue}{\frac{1}{5} \cdot {x}^{4}}\right)}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
    6. Applied rewrites82.5%

      \[\leadsto \left|\frac{\color{blue}{\left|x\right| \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}}\right| \]
    7. Taylor expanded in x around inf

      \[\leadsto \left|\frac{\frac{1}{5} \cdot \color{blue}{\left({x}^{4} \cdot \left|x\right|\right)}}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
    8. Step-by-step derivation
      1. Applied rewrites82.5%

        \[\leadsto \left|\frac{\left(\left(x \cdot x\right) \cdot 0.2\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot \left|x\right|\right)\right)}}{\sqrt{\pi}}\right| \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 7: 93.2% accurate, 3.6× speedup?

    \[\begin{array}{l} \\ \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}} \end{array} \]
    (FPCore (x)
     :precision binary64
     (*
      (fabs x)
      (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI))))
    double code(double x) {
    	return fabs(x) * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)));
    }
    
    function code(x)
    	return Float64(abs(x) * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))
    end
    
    code[x_] := N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}
    \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.4%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{21}, \frac{1}{5}\right), \frac{2}{3}\right), 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      13. lower-*.f6499.8

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

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}}{\sqrt{\pi}} \]
    9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{5}, \frac{2}{3}\right)}, 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      10. lower-*.f6493.6

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.2}, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}} \]
    11. Applied rewrites93.6%

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

    Alternative 8: 88.8% accurate, 4.6× speedup?

    \[\begin{array}{l} \\ \left|x\right| \cdot \frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}} \end{array} \]
    (FPCore (x)
     :precision binary64
     (* (fabs x) (/ (fma 0.6666666666666666 (* x x) 2.0) (sqrt PI))))
    double code(double x) {
    	return fabs(x) * (fma(0.6666666666666666, (x * x), 2.0) / sqrt(((double) M_PI)));
    }
    
    function code(x)
    	return Float64(abs(x) * Float64(fma(0.6666666666666666, Float64(x * x), 2.0) / sqrt(pi)))
    end
    
    code[x_] := N[(N[Abs[x], $MachinePrecision] * N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|x\right| \cdot \frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}
    \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.4%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

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

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

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{2}{3}, {x}^{2}, 2\right)}}{\sqrt{\mathsf{PI}\left(\right)}} \]
      3. unpow2N/A

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(\frac{2}{3}, \color{blue}{x \cdot x}, 2\right)}{\sqrt{\mathsf{PI}\left(\right)}} \]
      4. lower-*.f6488.7

        \[\leadsto \left|x\right| \cdot \frac{\mathsf{fma}\left(0.6666666666666666, \color{blue}{x \cdot x}, 2\right)}{\sqrt{\pi}} \]
    8. Applied rewrites88.7%

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}}{\sqrt{\pi}} \]
    9. Add Preprocessing

    Alternative 9: 67.0% accurate, 6.3× speedup?

    \[\begin{array}{l} \\ \left|x\right| \cdot \frac{2}{\sqrt{\pi}} \end{array} \]
    (FPCore (x) :precision binary64 (* (fabs x) (/ 2.0 (sqrt PI))))
    double code(double x) {
    	return fabs(x) * (2.0 / sqrt(((double) M_PI)));
    }
    
    public static double code(double x) {
    	return Math.abs(x) * (2.0 / Math.sqrt(Math.PI));
    }
    
    def code(x):
    	return math.fabs(x) * (2.0 / math.sqrt(math.pi))
    
    function code(x)
    	return Float64(abs(x) * Float64(2.0 / sqrt(pi)))
    end
    
    function tmp = code(x)
    	tmp = abs(x) * (2.0 / sqrt(pi));
    end
    
    code[x_] := N[(N[Abs[x], $MachinePrecision] * N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|x\right| \cdot \frac{2}{\sqrt{\pi}}
    \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.4%

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2, x \cdot \left(x \cdot \left(x \cdot x\right)\right), 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right), \left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}}\right| \]
    4. Step-by-step derivation
      1. lift-fabs.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)}{\sqrt{\pi}}} \]
    6. Taylor expanded in x around 0

      \[\leadsto \left|x\right| \cdot \frac{\color{blue}{2}}{\sqrt{\mathsf{PI}\left(\right)}} \]
    7. Step-by-step derivation
      1. Applied rewrites66.5%

        \[\leadsto \left|x\right| \cdot \frac{\color{blue}{2}}{\sqrt{\pi}} \]
      2. Add Preprocessing

      Reproduce

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