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

Percentage Accurate: 99.8% → 99.9%
Time: 12.8s
Alternatives: 14
Speedup: 3.6×

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 14 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.9% accurate, 2.6× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Simplified99.9%

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

Alternative 2: 72.2% accurate, 3.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot {x}^{7}\right)\right|\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right) + {x}^{2} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right) + 0.6666666666666666 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)\right)}\right| \]
    5. Simplified99.6%

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

      \[\leadsto \left|\color{blue}{\sqrt{\frac{1}{\pi}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)}\right| \]
    7. Step-by-step derivation
      1. rem-exp-log99.5%

        \[\leadsto \left|\sqrt{\frac{1}{\color{blue}{e^{\log \pi}}}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      2. rec-exp99.5%

        \[\leadsto \left|\sqrt{\color{blue}{e^{-\log \pi}}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      3. unpow1/299.5%

        \[\leadsto \left|\color{blue}{{\left(e^{-\log \pi}\right)}^{0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      4. exp-prod99.5%

        \[\leadsto \left|\color{blue}{e^{\left(-\log \pi\right) \cdot 0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      5. distribute-lft-neg-out99.5%

        \[\leadsto \left|e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      6. distribute-rgt-neg-in99.5%

        \[\leadsto \left|e^{\color{blue}{\log \pi \cdot \left(-0.5\right)}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      7. metadata-eval99.5%

        \[\leadsto \left|e^{\log \pi \cdot \color{blue}{-0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      8. exp-to-pow99.5%

        \[\leadsto \left|\color{blue}{{\pi}^{-0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      9. unpow399.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(0.6666666666666666 \cdot \color{blue}{\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)} + 2 \cdot \left|x\right|\right)\right| \]
      10. sqr-abs99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(0.6666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \left|x\right|\right) + 2 \cdot \left|x\right|\right)\right| \]
      11. unpow299.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(0.6666666666666666 \cdot \left(\color{blue}{{x}^{2}} \cdot \left|x\right|\right) + 2 \cdot \left|x\right|\right)\right| \]
      12. associate-*r*99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot {x}^{2}\right) \cdot \left|x\right|} + 2 \cdot \left|x\right|\right)\right| \]
      13. distribute-rgt-out99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \color{blue}{\left(\left|x\right| \cdot \left(0.6666666666666666 \cdot {x}^{2} + 2\right)\right)}\right| \]
      14. fma-define99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(\left|x\right| \cdot \color{blue}{\mathsf{fma}\left(0.6666666666666666, {x}^{2}, 2\right)}\right)\right| \]
    8. Simplified99.5%

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

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot \left({x}^{4} \cdot \left|x\right|\right)} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    5. Step-by-step derivation
      1. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left({x}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      2. pow-sqr98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{\left({x}^{2} \cdot {x}^{2}\right)} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      3. unpow298.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      4. sqr-abs98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)}\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      5. associate-*l*98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{\left(\left({x}^{2} \cdot \left|x\right|\right) \cdot \left|x\right|\right)} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      6. unpow298.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\left(\color{blue}{\left(x \cdot x\right)} \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      7. sqr-abs98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\left(\color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)} \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      8. unpow398.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\color{blue}{{\left(\left|x\right|\right)}^{3}} \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      9. pow-plus98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{{\left(\left|x\right|\right)}^{\left(3 + 1\right)}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      10. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left({\left(\left|x\right|\right)}^{\color{blue}{4}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      11. pow-plus98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \color{blue}{{\left(\left|x\right|\right)}^{\left(4 + 1\right)}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      12. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{\color{blue}{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    6. Simplified98.8%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {\left(\left|x\right|\right)}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    7. Taylor expanded in x around 0 98.9%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot \color{blue}{\left({x}^{6} \cdot \left|x\right|\right)}\right)\right| \]
    8. Step-by-step derivation
      1. rem-square-sqrt0.0%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot \left({x}^{6} \cdot \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right)\right| \]
      2. fabs-sqr0.0%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot \left({x}^{6} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}\right)\right)\right| \]
      3. rem-square-sqrt29.7%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot \left({x}^{6} \cdot \color{blue}{x}\right)\right)\right| \]
      4. pow-plus29.7%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot \color{blue}{{x}^{\left(6 + 1\right)}}\right)\right| \]
      5. metadata-eval29.7%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot {x}^{\color{blue}{7}}\right)\right| \]
    9. Simplified29.7%

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

Alternative 3: 72.2% accurate, 3.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right) + {x}^{2} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right) + 0.6666666666666666 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)\right)}\right| \]
    5. Simplified99.6%

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

      \[\leadsto \left|\color{blue}{\sqrt{\frac{1}{\pi}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)}\right| \]
    7. Step-by-step derivation
      1. rem-exp-log99.5%

        \[\leadsto \left|\sqrt{\frac{1}{\color{blue}{e^{\log \pi}}}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      2. rec-exp99.5%

        \[\leadsto \left|\sqrt{\color{blue}{e^{-\log \pi}}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      3. unpow1/299.5%

        \[\leadsto \left|\color{blue}{{\left(e^{-\log \pi}\right)}^{0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      4. exp-prod99.5%

        \[\leadsto \left|\color{blue}{e^{\left(-\log \pi\right) \cdot 0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      5. distribute-lft-neg-out99.5%

        \[\leadsto \left|e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      6. distribute-rgt-neg-in99.5%

        \[\leadsto \left|e^{\color{blue}{\log \pi \cdot \left(-0.5\right)}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      7. metadata-eval99.5%

        \[\leadsto \left|e^{\log \pi \cdot \color{blue}{-0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      8. exp-to-pow99.5%

        \[\leadsto \left|\color{blue}{{\pi}^{-0.5}} \cdot \left(0.6666666666666666 \cdot {\left(\left|x\right|\right)}^{3} + 2 \cdot \left|x\right|\right)\right| \]
      9. unpow399.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(0.6666666666666666 \cdot \color{blue}{\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)} + 2 \cdot \left|x\right|\right)\right| \]
      10. sqr-abs99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(0.6666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \left|x\right|\right) + 2 \cdot \left|x\right|\right)\right| \]
      11. unpow299.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(0.6666666666666666 \cdot \left(\color{blue}{{x}^{2}} \cdot \left|x\right|\right) + 2 \cdot \left|x\right|\right)\right| \]
      12. associate-*r*99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot {x}^{2}\right) \cdot \left|x\right|} + 2 \cdot \left|x\right|\right)\right| \]
      13. distribute-rgt-out99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \color{blue}{\left(\left|x\right| \cdot \left(0.6666666666666666 \cdot {x}^{2} + 2\right)\right)}\right| \]
      14. fma-define99.5%

        \[\leadsto \left|{\pi}^{-0.5} \cdot \left(\left|x\right| \cdot \color{blue}{\mathsf{fma}\left(0.6666666666666666, {x}^{2}, 2\right)}\right)\right| \]
    8. Simplified99.5%

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

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot \left({x}^{4} \cdot \left|x\right|\right)} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    5. Step-by-step derivation
      1. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left({x}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      2. pow-sqr98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{\left({x}^{2} \cdot {x}^{2}\right)} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      3. unpow298.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      4. sqr-abs98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)}\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      5. associate-*l*98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{\left(\left({x}^{2} \cdot \left|x\right|\right) \cdot \left|x\right|\right)} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      6. unpow298.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\left(\color{blue}{\left(x \cdot x\right)} \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      7. sqr-abs98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\left(\color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)} \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      8. unpow398.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\color{blue}{{\left(\left|x\right|\right)}^{3}} \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      9. pow-plus98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{{\left(\left|x\right|\right)}^{\left(3 + 1\right)}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      10. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left({\left(\left|x\right|\right)}^{\color{blue}{4}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      11. pow-plus98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \color{blue}{{\left(\left|x\right|\right)}^{\left(4 + 1\right)}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      12. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{\color{blue}{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    6. Simplified98.8%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {\left(\left|x\right|\right)}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. pow198.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{{\left(0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)}^{1}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      2. add-sqr-sqrt0.0%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({\left(0.2 \cdot {\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)}^{5}\right)}^{1} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      3. fabs-sqr0.0%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({\left(0.2 \cdot {\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{5}\right)}^{1} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      4. add-sqr-sqrt29.5%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({\left(0.2 \cdot {\color{blue}{x}}^{5}\right)}^{1} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    8. Applied egg-rr29.5%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{{\left(0.2 \cdot {x}^{5}\right)}^{1}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    9. Step-by-step derivation
      1. unpow129.5%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {x}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    10. Simplified29.5%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {x}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.2%

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

Alternative 4: 71.8% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (* (fabs x) (fabs (/ (+ 2.0 (* 0.2 (pow x 4.0))) (sqrt PI))))
   (fabs
    (*
     (/ 1.0 (sqrt PI))
     (+
      (* 0.2 (pow x 5.0))
      (*
       0.047619047619047616
       (* (* x x) (* (* x x) (* (fabs x) (* x x))))))))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = fabs(x) * fabs(((2.0 + (0.2 * pow(x, 4.0))) / sqrt(((double) M_PI))));
	} else {
		tmp = fabs(((1.0 / sqrt(((double) M_PI))) * ((0.2 * pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (fabs(x) * (x * x))))))));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = Math.abs(x) * Math.abs(((2.0 + (0.2 * Math.pow(x, 4.0))) / Math.sqrt(Math.PI)));
	} else {
		tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((0.2 * Math.pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (Math.abs(x) * (x * x))))))));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = math.fabs(x) * math.fabs(((2.0 + (0.2 * math.pow(x, 4.0))) / math.sqrt(math.pi)))
	else:
		tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * ((0.2 * math.pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (math.fabs(x) * (x * x))))))))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = Float64(abs(x) * abs(Float64(Float64(2.0 + Float64(0.2 * (x ^ 4.0))) / sqrt(pi))));
	else
		tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(0.2 * (x ^ 5.0)) + Float64(0.047619047619047616 * Float64(Float64(x * x) * Float64(Float64(x * x) * Float64(abs(x) * Float64(x * x))))))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (abs(x) <= 0.2)
		tmp = abs(x) * abs(((2.0 + (0.2 * (x ^ 4.0))) / sqrt(pi)));
	else
		tmp = abs(((1.0 / sqrt(pi)) * ((0.2 * (x ^ 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (abs(x) * (x * x))))))));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(2.0 + N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|\\


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

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

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

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

      \[\leadsto \left|x\right| \cdot \left|\frac{0.2 \cdot {x}^{4} + \color{blue}{2}}{\sqrt{\pi}}\right| \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot \left({x}^{4} \cdot \left|x\right|\right)} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    5. Step-by-step derivation
      1. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left({x}^{\color{blue}{\left(2 \cdot 2\right)}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      2. pow-sqr98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{\left({x}^{2} \cdot {x}^{2}\right)} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      3. unpow298.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      4. sqr-abs98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left({x}^{2} \cdot \color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)}\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      5. associate-*l*98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{\left(\left({x}^{2} \cdot \left|x\right|\right) \cdot \left|x\right|\right)} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      6. unpow298.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\left(\color{blue}{\left(x \cdot x\right)} \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      7. sqr-abs98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\left(\color{blue}{\left(\left|x\right| \cdot \left|x\right|\right)} \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      8. unpow398.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\left(\color{blue}{{\left(\left|x\right|\right)}^{3}} \cdot \left|x\right|\right) \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      9. pow-plus98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left(\color{blue}{{\left(\left|x\right|\right)}^{\left(3 + 1\right)}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      10. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \left({\left(\left|x\right|\right)}^{\color{blue}{4}} \cdot \left|x\right|\right) + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      11. pow-plus98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot \color{blue}{{\left(\left|x\right|\right)}^{\left(4 + 1\right)}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      12. metadata-eval98.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{\color{blue}{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    6. Simplified98.8%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {\left(\left|x\right|\right)}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. pow198.8%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{{\left(0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)}^{1}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      2. add-sqr-sqrt0.0%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({\left(0.2 \cdot {\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)}^{5}\right)}^{1} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      3. fabs-sqr0.0%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({\left(0.2 \cdot {\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{5}\right)}^{1} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
      4. add-sqr-sqrt29.5%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({\left(0.2 \cdot {\color{blue}{x}}^{5}\right)}^{1} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    8. Applied egg-rr29.5%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{{\left(0.2 \cdot {x}^{5}\right)}^{1}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    9. Step-by-step derivation
      1. unpow129.5%

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {x}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
    10. Simplified29.5%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\color{blue}{0.2 \cdot {x}^{5}} + 0.047619047619047616 \cdot \left(\left(\left(\left|x\right| \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.9% accurate, 3.6× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Simplified99.9%

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

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

      \[\leadsto \left|x\right| \cdot \left|\frac{{x}^{4} \cdot \left(0.2 + 0.047619047619047616 \cdot \color{blue}{\left(x \cdot x\right)}\right) + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right| \]
  6. Applied egg-rr99.9%

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

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

Alternative 6: 98.7% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\ \mathbf{else}:\\ \;\;\;\;0.047619047619047616 \cdot \left|{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)\right|\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (* (fabs x) (fabs (/ (+ 2.0 (* 0.2 (pow x 4.0))) (sqrt PI))))
   (*
    0.047619047619047616
    (fabs (* (pow x 6.0) (* (fabs x) (sqrt (/ 1.0 PI))))))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = fabs(x) * fabs(((2.0 + (0.2 * pow(x, 4.0))) / sqrt(((double) M_PI))));
	} else {
		tmp = 0.047619047619047616 * fabs((pow(x, 6.0) * (fabs(x) * sqrt((1.0 / ((double) M_PI))))));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = Math.abs(x) * Math.abs(((2.0 + (0.2 * Math.pow(x, 4.0))) / Math.sqrt(Math.PI)));
	} else {
		tmp = 0.047619047619047616 * Math.abs((Math.pow(x, 6.0) * (Math.abs(x) * Math.sqrt((1.0 / Math.PI)))));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = math.fabs(x) * math.fabs(((2.0 + (0.2 * math.pow(x, 4.0))) / math.sqrt(math.pi)))
	else:
		tmp = 0.047619047619047616 * math.fabs((math.pow(x, 6.0) * (math.fabs(x) * math.sqrt((1.0 / math.pi)))))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = Float64(abs(x) * abs(Float64(Float64(2.0 + Float64(0.2 * (x ^ 4.0))) / sqrt(pi))));
	else
		tmp = Float64(0.047619047619047616 * abs(Float64((x ^ 6.0) * Float64(abs(x) * sqrt(Float64(1.0 / pi))))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (abs(x) <= 0.2)
		tmp = abs(x) * abs(((2.0 + (0.2 * (x ^ 4.0))) / sqrt(pi)));
	else
		tmp = 0.047619047619047616 * abs(((x ^ 6.0) * (abs(x) * sqrt((1.0 / pi)))));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(2.0 + N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.047619047619047616 * N[Abs[N[(N[Power[x, 6.0], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\

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


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

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

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

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

      \[\leadsto \left|x\right| \cdot \left|\frac{0.2 \cdot {x}^{4} + \color{blue}{2}}{\sqrt{\pi}}\right| \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Step-by-step derivation
      1. associate-*l*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
    6. Simplified98.3%

      \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
    7. Taylor expanded in x around 0 98.2%

      \[\leadsto \color{blue}{\left|0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)\right|} \]
    8. Step-by-step derivation
      1. fabs-mul98.2%

        \[\leadsto \color{blue}{\left|0.047619047619047616\right| \cdot \left|\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right|} \]
      2. metadata-eval98.2%

        \[\leadsto \color{blue}{0.047619047619047616} \cdot \left|\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right| \]
      3. associate-*l*98.3%

        \[\leadsto 0.047619047619047616 \cdot \left|\color{blue}{{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    9. Simplified98.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\ \mathbf{else}:\\ \;\;\;\;0.047619047619047616 \cdot \left|{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.8% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.047619047619047616 \cdot \left|{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)\right|\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (log1p (expm1 (* x (* 2.0 (pow PI -0.5)))))
   (*
    0.047619047619047616
    (fabs (* (pow x 6.0) (* (fabs x) (sqrt (/ 1.0 PI))))))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = log1p(expm1((x * (2.0 * pow(((double) M_PI), -0.5)))));
	} else {
		tmp = 0.047619047619047616 * fabs((pow(x, 6.0) * (fabs(x) * sqrt((1.0 / ((double) M_PI))))));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = Math.log1p(Math.expm1((x * (2.0 * Math.pow(Math.PI, -0.5)))));
	} else {
		tmp = 0.047619047619047616 * Math.abs((Math.pow(x, 6.0) * (Math.abs(x) * Math.sqrt((1.0 / Math.PI)))));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = math.log1p(math.expm1((x * (2.0 * math.pow(math.pi, -0.5)))))
	else:
		tmp = 0.047619047619047616 * math.fabs((math.pow(x, 6.0) * (math.fabs(x) * math.sqrt((1.0 / math.pi)))))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = log1p(expm1(Float64(x * Float64(2.0 * (pi ^ -0.5)))));
	else
		tmp = Float64(0.047619047619047616 * abs(Float64((x ^ 6.0) * Float64(abs(x) * sqrt(Float64(1.0 / pi))))));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Log[1 + N[(Exp[N[(x * N[(2.0 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(0.047619047619047616 * N[Abs[N[(N[Power[x, 6.0], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\

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


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    5. Step-by-step derivation
      1. fabs-mul99.2%

        \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
      2. metadata-eval99.2%

        \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
      3. inv-pow99.2%

        \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
      4. sqrt-pow199.2%

        \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
      5. metadata-eval99.2%

        \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
    6. Applied egg-rr99.2%

      \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
    7. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
      2. rem-square-sqrt98.5%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
      3. fabs-sqr98.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
      4. rem-square-sqrt99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      5. *-commutative99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
      6. associate-*r*99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    8. Simplified99.2%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    9. Step-by-step derivation
      1. associate-*r*99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right) \cdot 2} \]
      2. *-commutative99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      3. log1p-expm1-u99.2%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot 2 \]
      4. log1p-define7.0%

        \[\leadsto \color{blue}{\log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot 2 \]
      5. *-commutative7.0%

        \[\leadsto \color{blue}{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \]
      6. add-sqr-sqrt7.0%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}} \]
      7. fabs-sqr7.0%

        \[\leadsto \color{blue}{\left|\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}\right|} \]
      8. add-sqr-sqrt7.0%

        \[\leadsto \left|\color{blue}{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}\right| \]
      9. log1p-expm1-u7.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left|2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)\right|\right)\right)} \]
      10. add-sqr-sqrt7.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\left|\color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}}\right|\right)\right) \]
      11. fabs-sqr7.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}}\right)\right) \]
    10. Applied egg-rr48.7%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left({\pi}^{-0.5} \cdot 2\right)\right)\right)} \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Step-by-step derivation
      1. associate-*l*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
    6. Simplified98.3%

      \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
    7. Taylor expanded in x around 0 98.2%

      \[\leadsto \color{blue}{\left|0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)\right|} \]
    8. Step-by-step derivation
      1. fabs-mul98.2%

        \[\leadsto \color{blue}{\left|0.047619047619047616\right| \cdot \left|\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right|} \]
      2. metadata-eval98.2%

        \[\leadsto \color{blue}{0.047619047619047616} \cdot \left|\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right| \]
      3. associate-*l*98.3%

        \[\leadsto 0.047619047619047616 \cdot \left|\color{blue}{{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    9. Simplified98.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.047619047619047616 \cdot \left|{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 99.1% accurate, 3.6× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Simplified99.9%

    \[\leadsto \color{blue}{\left|x\right| \cdot \left|\frac{\mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right) + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right|} \]
  3. Add Preprocessing
  4. Taylor expanded in x around inf 99.4%

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

Alternative 9: 33.7% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.047619047619047616 \cdot {x}^{7}\right) \cdot \left|{\pi}^{-0.5}\right|\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (log1p (expm1 (* x (* 2.0 (pow PI -0.5)))))
   (* (* 0.047619047619047616 (pow x 7.0)) (fabs (pow PI -0.5)))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = log1p(expm1((x * (2.0 * pow(((double) M_PI), -0.5)))));
	} else {
		tmp = (0.047619047619047616 * pow(x, 7.0)) * fabs(pow(((double) M_PI), -0.5));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = Math.log1p(Math.expm1((x * (2.0 * Math.pow(Math.PI, -0.5)))));
	} else {
		tmp = (0.047619047619047616 * Math.pow(x, 7.0)) * Math.abs(Math.pow(Math.PI, -0.5));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = math.log1p(math.expm1((x * (2.0 * math.pow(math.pi, -0.5)))))
	else:
		tmp = (0.047619047619047616 * math.pow(x, 7.0)) * math.fabs(math.pow(math.pi, -0.5))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = log1p(expm1(Float64(x * Float64(2.0 * (pi ^ -0.5)))));
	else
		tmp = Float64(Float64(0.047619047619047616 * (x ^ 7.0)) * abs((pi ^ -0.5)));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Log[1 + N[(Exp[N[(x * N[(2.0 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision] * N[Abs[N[Power[Pi, -0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(0.047619047619047616 \cdot {x}^{7}\right) \cdot \left|{\pi}^{-0.5}\right|\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    5. Step-by-step derivation
      1. fabs-mul99.2%

        \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
      2. metadata-eval99.2%

        \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
      3. inv-pow99.2%

        \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
      4. sqrt-pow199.2%

        \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
      5. metadata-eval99.2%

        \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
    6. Applied egg-rr99.2%

      \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
    7. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
      2. rem-square-sqrt98.5%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
      3. fabs-sqr98.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
      4. rem-square-sqrt99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      5. *-commutative99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
      6. associate-*r*99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    8. Simplified99.2%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    9. Step-by-step derivation
      1. associate-*r*99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right) \cdot 2} \]
      2. *-commutative99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      3. log1p-expm1-u99.2%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot 2 \]
      4. log1p-define7.0%

        \[\leadsto \color{blue}{\log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot 2 \]
      5. *-commutative7.0%

        \[\leadsto \color{blue}{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \]
      6. add-sqr-sqrt7.0%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}} \]
      7. fabs-sqr7.0%

        \[\leadsto \color{blue}{\left|\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}\right|} \]
      8. add-sqr-sqrt7.0%

        \[\leadsto \left|\color{blue}{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}\right| \]
      9. log1p-expm1-u7.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left|2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)\right|\right)\right)} \]
      10. add-sqr-sqrt7.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\left|\color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}}\right|\right)\right) \]
      11. fabs-sqr7.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}}\right)\right) \]
    10. Applied egg-rr48.7%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left({\pi}^{-0.5} \cdot 2\right)\right)\right)} \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Step-by-step derivation
      1. associate-*l*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
    6. Simplified98.3%

      \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
    7. Step-by-step derivation
      1. fabs-mul98.3%

        \[\leadsto \color{blue}{\left|0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right| \cdot \left|\sqrt{\frac{1}{\pi}}\right|} \]
      2. associate-*r*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}\right| \cdot \left|\sqrt{\frac{1}{\pi}}\right| \]
      3. inv-pow98.3%

        \[\leadsto \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}}\right| \]
      4. sqrt-pow198.3%

        \[\leadsto \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}}\right| \]
      5. metadata-eval98.3%

        \[\leadsto \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \cdot \left|{\pi}^{\color{blue}{-0.5}}\right| \]
    8. Applied egg-rr98.3%

      \[\leadsto \color{blue}{\left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \cdot \left|{\pi}^{-0.5}\right|} \]
    9. Taylor expanded in x around 0 98.3%

      \[\leadsto \color{blue}{\left|0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right|} \cdot \left|{\pi}^{-0.5}\right| \]
    10. Step-by-step derivation
      1. associate-*r*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}\right| \cdot \left|{\pi}^{-0.5}\right| \]
      2. fabs-mul98.3%

        \[\leadsto \color{blue}{\left(\left|0.047619047619047616 \cdot {x}^{6}\right| \cdot \left|\left|x\right|\right|\right)} \cdot \left|{\pi}^{-0.5}\right| \]
      3. fabs-fabs98.3%

        \[\leadsto \left(\left|0.047619047619047616 \cdot {x}^{6}\right| \cdot \color{blue}{\left|x\right|}\right) \cdot \left|{\pi}^{-0.5}\right| \]
      4. fabs-mul98.3%

        \[\leadsto \color{blue}{\left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot x\right|} \cdot \left|{\pi}^{-0.5}\right| \]
      5. associate-*l*98.3%

        \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left({x}^{6} \cdot x\right)}\right| \cdot \left|{\pi}^{-0.5}\right| \]
      6. *-commutative98.3%

        \[\leadsto \left|0.047619047619047616 \cdot \color{blue}{\left(x \cdot {x}^{6}\right)}\right| \cdot \left|{\pi}^{-0.5}\right| \]
      7. rem-square-sqrt0.0%

        \[\leadsto \left|\color{blue}{\sqrt{0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)} \cdot \sqrt{0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)}}\right| \cdot \left|{\pi}^{-0.5}\right| \]
      8. fabs-sqr0.0%

        \[\leadsto \color{blue}{\left(\sqrt{0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)} \cdot \sqrt{0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)}\right)} \cdot \left|{\pi}^{-0.5}\right| \]
      9. rem-square-sqrt0.2%

        \[\leadsto \color{blue}{\left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)} \cdot \left|{\pi}^{-0.5}\right| \]
      10. *-commutative0.2%

        \[\leadsto \left(0.047619047619047616 \cdot \color{blue}{\left({x}^{6} \cdot x\right)}\right) \cdot \left|{\pi}^{-0.5}\right| \]
      11. pow-plus0.2%

        \[\leadsto \left(0.047619047619047616 \cdot \color{blue}{{x}^{\left(6 + 1\right)}}\right) \cdot \left|{\pi}^{-0.5}\right| \]
      12. metadata-eval0.2%

        \[\leadsto \left(0.047619047619047616 \cdot {x}^{\color{blue}{7}}\right) \cdot \left|{\pi}^{-0.5}\right| \]
    11. Simplified0.2%

      \[\leadsto \color{blue}{\left(0.047619047619047616 \cdot {x}^{7}\right)} \cdot \left|{\pi}^{-0.5}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.047619047619047616 \cdot {x}^{7}\right) \cdot \left|{\pi}^{-0.5}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 33.7% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (log1p (expm1 (* x (* 2.0 (pow PI -0.5)))))
   (* (pow PI -0.5) (* 0.047619047619047616 (* x (pow x 6.0))))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = log1p(expm1((x * (2.0 * pow(((double) M_PI), -0.5)))));
	} else {
		tmp = pow(((double) M_PI), -0.5) * (0.047619047619047616 * (x * pow(x, 6.0)));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = Math.log1p(Math.expm1((x * (2.0 * Math.pow(Math.PI, -0.5)))));
	} else {
		tmp = Math.pow(Math.PI, -0.5) * (0.047619047619047616 * (x * Math.pow(x, 6.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = math.log1p(math.expm1((x * (2.0 * math.pow(math.pi, -0.5)))))
	else:
		tmp = math.pow(math.pi, -0.5) * (0.047619047619047616 * (x * math.pow(x, 6.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = log1p(expm1(Float64(x * Float64(2.0 * (pi ^ -0.5)))));
	else
		tmp = Float64((pi ^ -0.5) * Float64(0.047619047619047616 * Float64(x * (x ^ 6.0))));
	end
	return tmp
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Log[1 + N[(Exp[N[(x * N[(2.0 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(0.047619047619047616 * N[(x * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    5. Step-by-step derivation
      1. fabs-mul99.2%

        \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
      2. metadata-eval99.2%

        \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
      3. inv-pow99.2%

        \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
      4. sqrt-pow199.2%

        \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
      5. metadata-eval99.2%

        \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
    6. Applied egg-rr99.2%

      \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
    7. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
      2. rem-square-sqrt98.5%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
      3. fabs-sqr98.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
      4. rem-square-sqrt99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      5. *-commutative99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
      6. associate-*r*99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    8. Simplified99.2%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    9. Step-by-step derivation
      1. associate-*r*99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right) \cdot 2} \]
      2. *-commutative99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      3. log1p-expm1-u99.2%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot 2 \]
      4. log1p-define7.0%

        \[\leadsto \color{blue}{\log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot 2 \]
      5. *-commutative7.0%

        \[\leadsto \color{blue}{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \]
      6. add-sqr-sqrt7.0%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}} \]
      7. fabs-sqr7.0%

        \[\leadsto \color{blue}{\left|\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}\right|} \]
      8. add-sqr-sqrt7.0%

        \[\leadsto \left|\color{blue}{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}\right| \]
      9. log1p-expm1-u7.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left|2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)\right|\right)\right)} \]
      10. add-sqr-sqrt7.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\left|\color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}}\right|\right)\right) \]
      11. fabs-sqr7.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)} \cdot \sqrt{2 \cdot \log \left(1 + \mathsf{expm1}\left({\pi}^{-0.5} \cdot \left|x\right|\right)\right)}}\right)\right) \]
    10. Applied egg-rr48.7%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left({\pi}^{-0.5} \cdot 2\right)\right)\right)} \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Step-by-step derivation
      1. associate-*r*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
      2. associate-*l*98.3%

        \[\leadsto \left|\color{blue}{\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right)} \cdot \sqrt{\frac{1}{\pi}}\right| \]
      3. inv-pow98.3%

        \[\leadsto \left|\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right) \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right| \]
      4. sqrt-pow198.3%

        \[\leadsto \left|\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right) \cdot \color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}}\right| \]
      5. metadata-eval98.3%

        \[\leadsto \left|\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right) \cdot {\pi}^{\color{blue}{-0.5}}\right| \]
      6. mul-fabs98.3%

        \[\leadsto \color{blue}{\left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \cdot \left|{\pi}^{-0.5}\right|} \]
      7. *-commutative98.3%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5}\right| \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right|} \]
      8. add-sqr-sqrt98.3%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5}} \cdot \sqrt{{\pi}^{-0.5}}}\right| \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \]
      9. fabs-sqr98.3%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5}} \cdot \sqrt{{\pi}^{-0.5}}\right)} \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \]
      10. add-sqr-sqrt98.3%

        \[\leadsto \color{blue}{{\pi}^{-0.5}} \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \]
      11. add-sqr-sqrt98.2%

        \[\leadsto {\pi}^{-0.5} \cdot \left|\color{blue}{\sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|} \cdot \sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}}\right| \]
      12. fabs-sqr98.2%

        \[\leadsto {\pi}^{-0.5} \cdot \color{blue}{\left(\sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|} \cdot \sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}\right)} \]
      13. add-sqr-sqrt98.3%

        \[\leadsto {\pi}^{-0.5} \cdot \color{blue}{\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right)} \]
      14. associate-*l*98.3%

        \[\leadsto {\pi}^{-0.5} \cdot \color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right)} \]
      15. *-commutative98.3%

        \[\leadsto {\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \color{blue}{\left(\left|x\right| \cdot {x}^{6}\right)}\right) \]
    6. Applied egg-rr0.2%

      \[\leadsto \color{blue}{{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 33.7% accurate, 5.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\ \mathbf{else}:\\ \;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (* x (sqrt (/ 4.0 PI)))
   (* (pow PI -0.5) (* 0.047619047619047616 (* x (pow x 6.0))))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = x * sqrt((4.0 / ((double) M_PI)));
	} else {
		tmp = pow(((double) M_PI), -0.5) * (0.047619047619047616 * (x * pow(x, 6.0)));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = x * Math.sqrt((4.0 / Math.PI));
	} else {
		tmp = Math.pow(Math.PI, -0.5) * (0.047619047619047616 * (x * Math.pow(x, 6.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = x * math.sqrt((4.0 / math.pi))
	else:
		tmp = math.pow(math.pi, -0.5) * (0.047619047619047616 * (x * math.pow(x, 6.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = Float64(x * sqrt(Float64(4.0 / pi)));
	else
		tmp = Float64((pi ^ -0.5) * Float64(0.047619047619047616 * Float64(x * (x ^ 6.0))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (abs(x) <= 0.2)
		tmp = x * sqrt((4.0 / pi));
	else
		tmp = (pi ^ -0.5) * (0.047619047619047616 * (x * (x ^ 6.0)));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(0.047619047619047616 * N[(x * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\

\mathbf{else}:\\
\;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    5. Step-by-step derivation
      1. fabs-mul99.2%

        \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
      2. metadata-eval99.2%

        \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
      3. inv-pow99.2%

        \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
      4. sqrt-pow199.2%

        \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
      5. metadata-eval99.2%

        \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
    6. Applied egg-rr99.2%

      \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
    7. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
      2. rem-square-sqrt98.5%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
      3. fabs-sqr98.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
      4. rem-square-sqrt99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      5. *-commutative99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
      6. associate-*r*99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    8. Simplified99.2%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    9. Taylor expanded in x around 0 99.2%

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)} \]
    10. Step-by-step derivation
      1. associate-*r*99.2%

        \[\leadsto \color{blue}{\left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left|x\right|} \]
      2. *-commutative99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right)} \]
      3. *-lft-identity99.2%

        \[\leadsto \left|\color{blue}{1 \cdot x}\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \]
      4. metadata-eval99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\color{blue}{\left|2\right|} \cdot \sqrt{\frac{1}{\pi}}\right) \]
      5. unpow-199.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right) \]
      6. metadata-eval99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{{\pi}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      7. pow-sqr99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-0.5} \cdot {\pi}^{-0.5}}}\right) \]
      8. rem-sqrt-square99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \color{blue}{\left|{\pi}^{-0.5}\right|}\right) \]
      9. fabs-mul99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \color{blue}{\left|2 \cdot {\pi}^{-0.5}\right|} \]
      10. *-commutative99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left|\color{blue}{{\pi}^{-0.5} \cdot 2}\right| \]
      11. *-lft-identity99.2%

        \[\leadsto \left|\color{blue}{x}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      12. rem-square-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      14. rem-square-sqrt48.7%

        \[\leadsto \color{blue}{x} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      15. rem-sqrt-square48.7%

        \[\leadsto x \cdot \color{blue}{\sqrt{\left({\pi}^{-0.5} \cdot 2\right) \cdot \left({\pi}^{-0.5} \cdot 2\right)}} \]
      16. swap-sqr48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\left({\pi}^{-0.5} \cdot {\pi}^{-0.5}\right) \cdot \left(2 \cdot 2\right)}} \]
      17. pow-sqr48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{{\pi}^{\left(2 \cdot -0.5\right)}} \cdot \left(2 \cdot 2\right)} \]
      18. metadata-eval48.7%

        \[\leadsto x \cdot \sqrt{{\pi}^{\color{blue}{-1}} \cdot \left(2 \cdot 2\right)} \]
      19. unpow-148.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1}{\pi}} \cdot \left(2 \cdot 2\right)} \]
      20. metadata-eval48.7%

        \[\leadsto x \cdot \sqrt{\frac{1}{\pi} \cdot \color{blue}{4}} \]
      21. associate-*l/48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1 \cdot 4}{\pi}}} \]
    11. Simplified48.7%

      \[\leadsto \color{blue}{x \cdot \sqrt{\frac{4}{\pi}}} \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Step-by-step derivation
      1. associate-*r*98.3%

        \[\leadsto \left|\color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot \sqrt{\frac{1}{\pi}}}\right| \]
      2. associate-*l*98.3%

        \[\leadsto \left|\color{blue}{\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right)} \cdot \sqrt{\frac{1}{\pi}}\right| \]
      3. inv-pow98.3%

        \[\leadsto \left|\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right) \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right| \]
      4. sqrt-pow198.3%

        \[\leadsto \left|\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right) \cdot \color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}}\right| \]
      5. metadata-eval98.3%

        \[\leadsto \left|\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right) \cdot {\pi}^{\color{blue}{-0.5}}\right| \]
      6. mul-fabs98.3%

        \[\leadsto \color{blue}{\left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \cdot \left|{\pi}^{-0.5}\right|} \]
      7. *-commutative98.3%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5}\right| \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right|} \]
      8. add-sqr-sqrt98.3%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5}} \cdot \sqrt{{\pi}^{-0.5}}}\right| \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \]
      9. fabs-sqr98.3%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5}} \cdot \sqrt{{\pi}^{-0.5}}\right)} \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \]
      10. add-sqr-sqrt98.3%

        \[\leadsto \color{blue}{{\pi}^{-0.5}} \cdot \left|\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right| \]
      11. add-sqr-sqrt98.2%

        \[\leadsto {\pi}^{-0.5} \cdot \left|\color{blue}{\sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|} \cdot \sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}}\right| \]
      12. fabs-sqr98.2%

        \[\leadsto {\pi}^{-0.5} \cdot \color{blue}{\left(\sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|} \cdot \sqrt{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}\right)} \]
      13. add-sqr-sqrt98.3%

        \[\leadsto {\pi}^{-0.5} \cdot \color{blue}{\left(\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|\right)} \]
      14. associate-*l*98.3%

        \[\leadsto {\pi}^{-0.5} \cdot \color{blue}{\left(0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right)} \]
      15. *-commutative98.3%

        \[\leadsto {\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \color{blue}{\left(\left|x\right| \cdot {x}^{6}\right)}\right) \]
    6. Applied egg-rr0.2%

      \[\leadsto \color{blue}{{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 33.7% accurate, 5.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\ \mathbf{else}:\\ \;\;\;\;0.047619047619047616 \cdot \left({\pi}^{-0.5} \cdot \left(x \cdot {x}^{6}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (* x (sqrt (/ 4.0 PI)))
   (* 0.047619047619047616 (* (pow PI -0.5) (* x (pow x 6.0))))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = x * sqrt((4.0 / ((double) M_PI)));
	} else {
		tmp = 0.047619047619047616 * (pow(((double) M_PI), -0.5) * (x * pow(x, 6.0)));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = x * Math.sqrt((4.0 / Math.PI));
	} else {
		tmp = 0.047619047619047616 * (Math.pow(Math.PI, -0.5) * (x * Math.pow(x, 6.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = x * math.sqrt((4.0 / math.pi))
	else:
		tmp = 0.047619047619047616 * (math.pow(math.pi, -0.5) * (x * math.pow(x, 6.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = Float64(x * sqrt(Float64(4.0 / pi)));
	else
		tmp = Float64(0.047619047619047616 * Float64((pi ^ -0.5) * Float64(x * (x ^ 6.0))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (abs(x) <= 0.2)
		tmp = x * sqrt((4.0 / pi));
	else
		tmp = 0.047619047619047616 * ((pi ^ -0.5) * (x * (x ^ 6.0)));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.047619047619047616 * N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(x * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\

\mathbf{else}:\\
\;\;\;\;0.047619047619047616 \cdot \left({\pi}^{-0.5} \cdot \left(x \cdot {x}^{6}\right)\right)\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    5. Step-by-step derivation
      1. fabs-mul99.2%

        \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
      2. metadata-eval99.2%

        \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
      3. inv-pow99.2%

        \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
      4. sqrt-pow199.2%

        \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
      5. metadata-eval99.2%

        \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
    6. Applied egg-rr99.2%

      \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
    7. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
      2. rem-square-sqrt98.5%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
      3. fabs-sqr98.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
      4. rem-square-sqrt99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      5. *-commutative99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
      6. associate-*r*99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    8. Simplified99.2%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    9. Taylor expanded in x around 0 99.2%

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)} \]
    10. Step-by-step derivation
      1. associate-*r*99.2%

        \[\leadsto \color{blue}{\left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left|x\right|} \]
      2. *-commutative99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right)} \]
      3. *-lft-identity99.2%

        \[\leadsto \left|\color{blue}{1 \cdot x}\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \]
      4. metadata-eval99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\color{blue}{\left|2\right|} \cdot \sqrt{\frac{1}{\pi}}\right) \]
      5. unpow-199.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right) \]
      6. metadata-eval99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{{\pi}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      7. pow-sqr99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-0.5} \cdot {\pi}^{-0.5}}}\right) \]
      8. rem-sqrt-square99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \color{blue}{\left|{\pi}^{-0.5}\right|}\right) \]
      9. fabs-mul99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \color{blue}{\left|2 \cdot {\pi}^{-0.5}\right|} \]
      10. *-commutative99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left|\color{blue}{{\pi}^{-0.5} \cdot 2}\right| \]
      11. *-lft-identity99.2%

        \[\leadsto \left|\color{blue}{x}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      12. rem-square-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      14. rem-square-sqrt48.7%

        \[\leadsto \color{blue}{x} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      15. rem-sqrt-square48.7%

        \[\leadsto x \cdot \color{blue}{\sqrt{\left({\pi}^{-0.5} \cdot 2\right) \cdot \left({\pi}^{-0.5} \cdot 2\right)}} \]
      16. swap-sqr48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\left({\pi}^{-0.5} \cdot {\pi}^{-0.5}\right) \cdot \left(2 \cdot 2\right)}} \]
      17. pow-sqr48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{{\pi}^{\left(2 \cdot -0.5\right)}} \cdot \left(2 \cdot 2\right)} \]
      18. metadata-eval48.7%

        \[\leadsto x \cdot \sqrt{{\pi}^{\color{blue}{-1}} \cdot \left(2 \cdot 2\right)} \]
      19. unpow-148.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1}{\pi}} \cdot \left(2 \cdot 2\right)} \]
      20. metadata-eval48.7%

        \[\leadsto x \cdot \sqrt{\frac{1}{\pi} \cdot \color{blue}{4}} \]
      21. associate-*l/48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1 \cdot 4}{\pi}}} \]
    11. Simplified48.7%

      \[\leadsto \color{blue}{x \cdot \sqrt{\frac{4}{\pi}}} \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Step-by-step derivation
      1. add-sqr-sqrt98.1%

        \[\leadsto \left|\color{blue}{\sqrt{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)} \cdot \sqrt{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}}\right| \]
      2. fabs-sqr98.1%

        \[\leadsto \color{blue}{\sqrt{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)} \cdot \sqrt{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}} \]
      3. add-sqr-sqrt98.2%

        \[\leadsto \color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)} \]
      4. *-commutative98.2%

        \[\leadsto \color{blue}{\left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right) \cdot 0.047619047619047616} \]
      5. *-commutative98.2%

        \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\pi}} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right)} \cdot 0.047619047619047616 \]
      6. inv-pow98.2%

        \[\leadsto \left(\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot 0.047619047619047616 \]
      7. sqrt-pow198.2%

        \[\leadsto \left(\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot 0.047619047619047616 \]
      8. metadata-eval98.2%

        \[\leadsto \left({\pi}^{\color{blue}{-0.5}} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right) \cdot 0.047619047619047616 \]
      9. *-commutative98.2%

        \[\leadsto \left({\pi}^{-0.5} \cdot \color{blue}{\left(\left|x\right| \cdot {x}^{6}\right)}\right) \cdot 0.047619047619047616 \]
      10. add-sqr-sqrt0.0%

        \[\leadsto \left({\pi}^{-0.5} \cdot \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| \cdot {x}^{6}\right)\right) \cdot 0.047619047619047616 \]
      11. fabs-sqr0.0%

        \[\leadsto \left({\pi}^{-0.5} \cdot \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot {x}^{6}\right)\right) \cdot 0.047619047619047616 \]
      12. add-sqr-sqrt0.2%

        \[\leadsto \left({\pi}^{-0.5} \cdot \left(\color{blue}{x} \cdot {x}^{6}\right)\right) \cdot 0.047619047619047616 \]
    6. Applied egg-rr0.2%

      \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left(x \cdot {x}^{6}\right)\right) \cdot 0.047619047619047616} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\ \mathbf{else}:\\ \;\;\;\;0.047619047619047616 \cdot \left({\pi}^{-0.5} \cdot \left(x \cdot {x}^{6}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 33.7% accurate, 5.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|x\right| \leq 0.2:\\ \;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\ \mathbf{else}:\\ \;\;\;\;{x}^{7} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (fabs x) 0.2)
   (* x (sqrt (/ 4.0 PI)))
   (* (pow x 7.0) (* 0.047619047619047616 (pow PI -0.5)))))
double code(double x) {
	double tmp;
	if (fabs(x) <= 0.2) {
		tmp = x * sqrt((4.0 / ((double) M_PI)));
	} else {
		tmp = pow(x, 7.0) * (0.047619047619047616 * pow(((double) M_PI), -0.5));
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.abs(x) <= 0.2) {
		tmp = x * Math.sqrt((4.0 / Math.PI));
	} else {
		tmp = Math.pow(x, 7.0) * (0.047619047619047616 * Math.pow(Math.PI, -0.5));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.fabs(x) <= 0.2:
		tmp = x * math.sqrt((4.0 / math.pi))
	else:
		tmp = math.pow(x, 7.0) * (0.047619047619047616 * math.pow(math.pi, -0.5))
	return tmp
function code(x)
	tmp = 0.0
	if (abs(x) <= 0.2)
		tmp = Float64(x * sqrt(Float64(4.0 / pi)));
	else
		tmp = Float64((x ^ 7.0) * Float64(0.047619047619047616 * (pi ^ -0.5)));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (abs(x) <= 0.2)
		tmp = x * sqrt((4.0 / pi));
	else
		tmp = (x ^ 7.0) * (0.047619047619047616 * (pi ^ -0.5));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, 7.0], $MachinePrecision] * N[(0.047619047619047616 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\

\mathbf{else}:\\
\;\;\;\;{x}^{7} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right)\\


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

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

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

      \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
    5. Step-by-step derivation
      1. fabs-mul99.2%

        \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
      2. metadata-eval99.2%

        \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
      3. inv-pow99.2%

        \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
      4. sqrt-pow199.2%

        \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
      5. metadata-eval99.2%

        \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
    6. Applied egg-rr99.2%

      \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
    7. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
      2. rem-square-sqrt98.5%

        \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
      3. fabs-sqr98.5%

        \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
      4. rem-square-sqrt99.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
      5. *-commutative99.2%

        \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
      6. associate-*r*99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    8. Simplified99.2%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
    9. Taylor expanded in x around 0 99.2%

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)} \]
    10. Step-by-step derivation
      1. associate-*r*99.2%

        \[\leadsto \color{blue}{\left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left|x\right|} \]
      2. *-commutative99.2%

        \[\leadsto \color{blue}{\left|x\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right)} \]
      3. *-lft-identity99.2%

        \[\leadsto \left|\color{blue}{1 \cdot x}\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \]
      4. metadata-eval99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\color{blue}{\left|2\right|} \cdot \sqrt{\frac{1}{\pi}}\right) \]
      5. unpow-199.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right) \]
      6. metadata-eval99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{{\pi}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
      7. pow-sqr99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-0.5} \cdot {\pi}^{-0.5}}}\right) \]
      8. rem-sqrt-square99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \color{blue}{\left|{\pi}^{-0.5}\right|}\right) \]
      9. fabs-mul99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \color{blue}{\left|2 \cdot {\pi}^{-0.5}\right|} \]
      10. *-commutative99.2%

        \[\leadsto \left|1 \cdot x\right| \cdot \left|\color{blue}{{\pi}^{-0.5} \cdot 2}\right| \]
      11. *-lft-identity99.2%

        \[\leadsto \left|\color{blue}{x}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      12. rem-square-sqrt46.5%

        \[\leadsto \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      13. fabs-sqr46.5%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      14. rem-square-sqrt48.7%

        \[\leadsto \color{blue}{x} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
      15. rem-sqrt-square48.7%

        \[\leadsto x \cdot \color{blue}{\sqrt{\left({\pi}^{-0.5} \cdot 2\right) \cdot \left({\pi}^{-0.5} \cdot 2\right)}} \]
      16. swap-sqr48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\left({\pi}^{-0.5} \cdot {\pi}^{-0.5}\right) \cdot \left(2 \cdot 2\right)}} \]
      17. pow-sqr48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{{\pi}^{\left(2 \cdot -0.5\right)}} \cdot \left(2 \cdot 2\right)} \]
      18. metadata-eval48.7%

        \[\leadsto x \cdot \sqrt{{\pi}^{\color{blue}{-1}} \cdot \left(2 \cdot 2\right)} \]
      19. unpow-148.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1}{\pi}} \cdot \left(2 \cdot 2\right)} \]
      20. metadata-eval48.7%

        \[\leadsto x \cdot \sqrt{\frac{1}{\pi} \cdot \color{blue}{4}} \]
      21. associate-*l/48.7%

        \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1 \cdot 4}{\pi}}} \]
    11. Simplified48.7%

      \[\leadsto \color{blue}{x \cdot \sqrt{\frac{4}{\pi}}} \]

    if 0.20000000000000001 < (fabs.f64 x)

    1. Initial program 98.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. Simplified98.8%

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

      \[\leadsto \left|\color{blue}{0.047619047619047616 \cdot \left(\left({x}^{6} \cdot \left|x\right|\right) \cdot \sqrt{\frac{1}{\pi}}\right)}\right| \]
    5. Applied egg-rr0.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\right)} - 1} \]
    6. Step-by-step derivation
      1. sub-neg0.0%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\right)} + \left(-1\right)} \]
      2. metadata-eval0.0%

        \[\leadsto e^{\mathsf{log1p}\left({\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\right)} + \color{blue}{-1} \]
      3. +-commutative0.0%

        \[\leadsto \color{blue}{-1 + e^{\mathsf{log1p}\left({\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\right)}} \]
      4. log1p-undefine0.0%

        \[\leadsto -1 + e^{\color{blue}{\log \left(1 + {\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\right)}} \]
      5. rem-exp-log0.2%

        \[\leadsto -1 + \color{blue}{\left(1 + {\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\right)} \]
      6. associate-+r+0.2%

        \[\leadsto \color{blue}{\left(-1 + 1\right) + {\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)} \]
      7. metadata-eval0.2%

        \[\leadsto \color{blue}{0} + {\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right) \]
      8. +-lft-identity0.2%

        \[\leadsto \color{blue}{{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)} \]
      9. associate-*r*0.2%

        \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot 0.047619047619047616\right) \cdot \left(x \cdot {x}^{6}\right)} \]
      10. *-commutative0.2%

        \[\leadsto \color{blue}{\left(x \cdot {x}^{6}\right) \cdot \left({\pi}^{-0.5} \cdot 0.047619047619047616\right)} \]
      11. *-commutative0.2%

        \[\leadsto \left(x \cdot {x}^{6}\right) \cdot \color{blue}{\left(0.047619047619047616 \cdot {\pi}^{-0.5}\right)} \]
      12. *-commutative0.2%

        \[\leadsto \color{blue}{\left({x}^{6} \cdot x\right)} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right) \]
      13. pow-plus0.2%

        \[\leadsto \color{blue}{{x}^{\left(6 + 1\right)}} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right) \]
      14. metadata-eval0.2%

        \[\leadsto {x}^{\color{blue}{7}} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right) \]
    7. Simplified0.2%

      \[\leadsto \color{blue}{{x}^{7} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 33.8% accurate, 17.6× speedup?

\[\begin{array}{l} \\ x \cdot \sqrt{\frac{4}{\pi}} \end{array} \]
(FPCore (x) :precision binary64 (* x (sqrt (/ 4.0 PI))))
double code(double x) {
	return x * sqrt((4.0 / ((double) M_PI)));
}
public static double code(double x) {
	return x * Math.sqrt((4.0 / Math.PI));
}
def code(x):
	return x * math.sqrt((4.0 / math.pi))
function code(x)
	return Float64(x * sqrt(Float64(4.0 / pi)))
end
function tmp = code(x)
	tmp = x * sqrt((4.0 / pi));
end
code[x_] := N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \sqrt{\frac{4}{\pi}}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Simplified99.5%

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

    \[\leadsto \left|\color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)}\right| \]
  5. Step-by-step derivation
    1. fabs-mul66.6%

      \[\leadsto \color{blue}{\left|2\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right|} \]
    2. metadata-eval66.6%

      \[\leadsto \color{blue}{2} \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right| \]
    3. inv-pow66.6%

      \[\leadsto 2 \cdot \left|\sqrt{\color{blue}{{\pi}^{-1}}} \cdot \left|x\right|\right| \]
    4. sqrt-pow166.6%

      \[\leadsto 2 \cdot \left|\color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}} \cdot \left|x\right|\right| \]
    5. metadata-eval66.6%

      \[\leadsto 2 \cdot \left|{\pi}^{\color{blue}{-0.5}} \cdot \left|x\right|\right| \]
  6. Applied egg-rr66.6%

    \[\leadsto \color{blue}{2 \cdot \left|{\pi}^{-0.5} \cdot \left|x\right|\right|} \]
  7. Step-by-step derivation
    1. *-commutative66.6%

      \[\leadsto \color{blue}{\left|{\pi}^{-0.5} \cdot \left|x\right|\right| \cdot 2} \]
    2. rem-square-sqrt66.2%

      \[\leadsto \left|\color{blue}{\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}}\right| \cdot 2 \]
    3. fabs-sqr66.2%

      \[\leadsto \color{blue}{\left(\sqrt{{\pi}^{-0.5} \cdot \left|x\right|} \cdot \sqrt{{\pi}^{-0.5} \cdot \left|x\right|}\right)} \cdot 2 \]
    4. rem-square-sqrt66.6%

      \[\leadsto \color{blue}{\left({\pi}^{-0.5} \cdot \left|x\right|\right)} \cdot 2 \]
    5. *-commutative66.6%

      \[\leadsto \color{blue}{\left(\left|x\right| \cdot {\pi}^{-0.5}\right)} \cdot 2 \]
    6. associate-*r*66.6%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
  8. Simplified66.6%

    \[\leadsto \color{blue}{\left|x\right| \cdot \left({\pi}^{-0.5} \cdot 2\right)} \]
  9. Taylor expanded in x around 0 66.6%

    \[\leadsto \color{blue}{2 \cdot \left(\sqrt{\frac{1}{\pi}} \cdot \left|x\right|\right)} \]
  10. Step-by-step derivation
    1. associate-*r*66.6%

      \[\leadsto \color{blue}{\left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left|x\right|} \]
    2. *-commutative66.6%

      \[\leadsto \color{blue}{\left|x\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right)} \]
    3. *-lft-identity66.6%

      \[\leadsto \left|\color{blue}{1 \cdot x}\right| \cdot \left(2 \cdot \sqrt{\frac{1}{\pi}}\right) \]
    4. metadata-eval66.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \left(\color{blue}{\left|2\right|} \cdot \sqrt{\frac{1}{\pi}}\right) \]
    5. unpow-166.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right) \]
    6. metadata-eval66.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{{\pi}^{\color{blue}{\left(2 \cdot -0.5\right)}}}\right) \]
    7. pow-sqr66.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \sqrt{\color{blue}{{\pi}^{-0.5} \cdot {\pi}^{-0.5}}}\right) \]
    8. rem-sqrt-square66.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \left(\left|2\right| \cdot \color{blue}{\left|{\pi}^{-0.5}\right|}\right) \]
    9. fabs-mul66.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \color{blue}{\left|2 \cdot {\pi}^{-0.5}\right|} \]
    10. *-commutative66.6%

      \[\leadsto \left|1 \cdot x\right| \cdot \left|\color{blue}{{\pi}^{-0.5} \cdot 2}\right| \]
    11. *-lft-identity66.6%

      \[\leadsto \left|\color{blue}{x}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
    12. rem-square-sqrt30.3%

      \[\leadsto \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
    13. fabs-sqr30.3%

      \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
    14. rem-square-sqrt31.9%

      \[\leadsto \color{blue}{x} \cdot \left|{\pi}^{-0.5} \cdot 2\right| \]
    15. rem-sqrt-square31.9%

      \[\leadsto x \cdot \color{blue}{\sqrt{\left({\pi}^{-0.5} \cdot 2\right) \cdot \left({\pi}^{-0.5} \cdot 2\right)}} \]
    16. swap-sqr31.9%

      \[\leadsto x \cdot \sqrt{\color{blue}{\left({\pi}^{-0.5} \cdot {\pi}^{-0.5}\right) \cdot \left(2 \cdot 2\right)}} \]
    17. pow-sqr31.9%

      \[\leadsto x \cdot \sqrt{\color{blue}{{\pi}^{\left(2 \cdot -0.5\right)}} \cdot \left(2 \cdot 2\right)} \]
    18. metadata-eval31.9%

      \[\leadsto x \cdot \sqrt{{\pi}^{\color{blue}{-1}} \cdot \left(2 \cdot 2\right)} \]
    19. unpow-131.9%

      \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1}{\pi}} \cdot \left(2 \cdot 2\right)} \]
    20. metadata-eval31.9%

      \[\leadsto x \cdot \sqrt{\frac{1}{\pi} \cdot \color{blue}{4}} \]
    21. associate-*l/31.9%

      \[\leadsto x \cdot \sqrt{\color{blue}{\frac{1 \cdot 4}{\pi}}} \]
  11. Simplified31.9%

    \[\leadsto \color{blue}{x \cdot \sqrt{\frac{4}{\pi}}} \]
  12. Add Preprocessing

Reproduce

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