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

Percentage Accurate: 99.8% → 99.8%
Time: 13.8s
Alternatives: 16
Speedup: 3.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 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.1× speedup?

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

\\
\left|\mathsf{fma}\left(\left|x\right| \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right), \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right) \cdot \left|x\right|\right) \cdot \frac{1}{\sqrt{\pi}}\right|
\end{array}
Derivation
  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|\frac{1}{\sqrt{\pi}} \cdot \color{blue}{\mathsf{fma}\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot \left|x\right|, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right)}\right| \]
  4. Final simplification99.9%

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

Alternative 2: 99.8% accurate, 2.7× speedup?

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 2.7× speedup?

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

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

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


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

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

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

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

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

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

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

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

    if 2 < (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|\frac{1}{\sqrt{\pi}} \cdot \color{blue}{\mathsf{fma}\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot \left|x\right|, \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right)}\right| \]
    4. Applied rewrites99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot 0.047619047619047616\right) \cdot x\right) \cdot x\right) \cdot x\right)} \cdot \frac{\left|x\right|}{\sqrt{\pi}} \]
    8. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\leadsto \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot \color{blue}{\left(0.047619047619047616 \cdot \left(x \cdot x\right)\right)}\right) \cdot \frac{\left|x\right|}{\sqrt{\pi}} \]
    9. Recombined 2 regimes into one program.
    10. Final simplification99.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 2:\\ \;\;\;\;\left|\mathsf{fma}\left(\mathsf{fma}\left(0.2, x \cdot x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left(\left(0.047619047619047616 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right)\right) \cdot \frac{\left|x\right|}{\sqrt{\pi}}\\ \end{array} \]
    11. Add Preprocessing

    Alternative 4: 99.8% accurate, 2.7× speedup?

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

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

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

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

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

    Alternative 5: 99.8% accurate, 3.0× speedup?

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

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

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

    Alternative 6: 98.7% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 93.4% accurate, 3.2× speedup?

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

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

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

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

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

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

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

    Alternative 8: 93.4% accurate, 3.5× speedup?

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.2, x \cdot x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    7. Step-by-step derivation
      1. Applied rewrites94.2%

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

      Alternative 9: 93.0% accurate, 3.6× speedup?

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

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

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

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

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

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

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

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

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

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

      Alternative 10: 93.0% accurate, 3.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 11: 89.1% accurate, 4.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\mathsf{PI}\left(\right)}} \cdot \left|x\right|\right) \cdot \left(2 + \frac{2}{3} \cdot {x}^{2}\right)} \]
      7. Applied rewrites89.0%

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

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

      Alternative 12: 89.1% accurate, 4.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left|x\right| \cdot \frac{\left|\mathsf{fma}\left(\frac{2}{3} \cdot x, x, 2\right)\right|}{\sqrt{\mathsf{PI}\left(\right)}}} \]
      10. Applied rewrites88.9%

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

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

      Alternative 13: 88.7% accurate, 4.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\left|\mathsf{fma}\left(0.6666666666666666 \cdot x, x, 2\right)\right| \cdot \left|x\right|}{\sqrt{\pi}}} \]
      9. Step-by-step derivation
        1. Applied rewrites88.4%

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

        Alternative 14: 88.6% accurate, 4.6× speedup?

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

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

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

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

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

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

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

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

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

        Alternative 15: 67.7% accurate, 5.4× speedup?

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(2 \cdot \left|x\right|\right) \cdot \sqrt{\color{blue}{\frac{1}{\mathsf{PI}\left(\right)}}} \]
          8. lower-PI.f6473.3

            \[\leadsto \left(2 \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\color{blue}{\pi}}} \]
        7. Applied rewrites73.3%

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

        Alternative 16: 67.2% accurate, 6.3× speedup?

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

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

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

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

          Reproduce

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