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

Percentage Accurate: 99.8% → 99.8%
Time: 11.4s
Alternatives: 12
Speedup: 3.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.5× speedup?

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

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

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

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

Alternative 2: 99.8% accurate, 2.5× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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. Final simplification99.9%

    \[\leadsto \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(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right) + 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| \]
  5. Add Preprocessing

Alternative 3: 99.9% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \left|x\right| \cdot \left|{\pi}^{-0.5} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (fabs x)
  (fabs
   (*
    (pow PI -0.5)
    (+
     2.0
     (+
      (* 0.047619047619047616 (pow x 6.0))
      (+ (* 0.2 (pow x 4.0)) (* 0.6666666666666666 (pow x 2.0)))))))))
double code(double x) {
	return fabs(x) * fabs((pow(((double) M_PI), -0.5) * (2.0 + ((0.047619047619047616 * pow(x, 6.0)) + ((0.2 * pow(x, 4.0)) + (0.6666666666666666 * pow(x, 2.0)))))));
}
public static double code(double x) {
	return Math.abs(x) * Math.abs((Math.pow(Math.PI, -0.5) * (2.0 + ((0.047619047619047616 * Math.pow(x, 6.0)) + ((0.2 * Math.pow(x, 4.0)) + (0.6666666666666666 * Math.pow(x, 2.0)))))));
}
def code(x):
	return math.fabs(x) * math.fabs((math.pow(math.pi, -0.5) * (2.0 + ((0.047619047619047616 * math.pow(x, 6.0)) + ((0.2 * math.pow(x, 4.0)) + (0.6666666666666666 * math.pow(x, 2.0)))))))
function code(x)
	return Float64(abs(x) * abs(Float64((pi ^ -0.5) * Float64(2.0 + Float64(Float64(0.047619047619047616 * (x ^ 6.0)) + Float64(Float64(0.2 * (x ^ 4.0)) + Float64(0.6666666666666666 * (x ^ 2.0))))))))
end
function tmp = code(x)
	tmp = abs(x) * abs(((pi ^ -0.5) * (2.0 + ((0.047619047619047616 * (x ^ 6.0)) + ((0.2 * (x ^ 4.0)) + (0.6666666666666666 * (x ^ 2.0)))))));
end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(2.0 + N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left|x\right| \cdot \left|{\pi}^{-0.5} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right|
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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 \color{blue}{\left|x\right| \cdot \left|\sqrt{\frac{1}{\pi}} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right|} \]
  5. Step-by-step derivation
    1. *-un-lft-identity99.9%

      \[\leadsto \left|x\right| \cdot \left|\color{blue}{\left(1 \cdot \sqrt{\frac{1}{\pi}}\right)} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \]
    2. inv-pow99.9%

      \[\leadsto \left|x\right| \cdot \left|\left(1 \cdot \sqrt{\color{blue}{{\pi}^{-1}}}\right) \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \]
    3. sqrt-pow199.9%

      \[\leadsto \left|x\right| \cdot \left|\left(1 \cdot \color{blue}{{\pi}^{\left(\frac{-1}{2}\right)}}\right) \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \]
    4. metadata-eval99.9%

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

    \[\leadsto \left|x\right| \cdot \left|\color{blue}{\left(1 \cdot {\pi}^{-0.5}\right)} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \]
  7. Step-by-step derivation
    1. *-lft-identity99.9%

      \[\leadsto \left|x\right| \cdot \left|\color{blue}{{\pi}^{-0.5}} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \]
  8. Simplified99.9%

    \[\leadsto \left|x\right| \cdot \left|\color{blue}{{\pi}^{-0.5}} \cdot \left(2 + \left(0.047619047619047616 \cdot {x}^{6} + \left(0.2 \cdot {x}^{4} + 0.6666666666666666 \cdot {x}^{2}\right)\right)\right)\right| \]
  9. Add Preprocessing

Alternative 4: 99.9% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \left|x\right| \cdot \left|\frac{\left(0.047619047619047616 \cdot {x}^{6} + 0.2 \cdot {x}^{4}\right) + \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)) (* 0.2 (pow x 4.0)))
     (fma 0.6666666666666666 (* x x) 2.0))
    (sqrt PI)))))
double code(double x) {
	return fabs(x) * fabs(((((0.047619047619047616 * pow(x, 6.0)) + (0.2 * pow(x, 4.0))) + fma(0.6666666666666666, (x * x), 2.0)) / sqrt(((double) M_PI))));
}
function code(x)
	return Float64(abs(x) * abs(Float64(Float64(Float64(Float64(0.047619047619047616 * (x ^ 6.0)) + Float64(0.2 * (x ^ 4.0))) + fma(0.6666666666666666, Float64(x * x), 2.0)) / sqrt(pi))))
end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(0.2 * N[Power[x, 4.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{\left(0.047619047619047616 \cdot {x}^{6} + 0.2 \cdot {x}^{4}\right) + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right|
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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. Step-by-step derivation
    1. fma-undefine99.9%

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

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

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

Alternative 5: 99.4% accurate, 3.6× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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 98.8%

    \[\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. Taylor expanded in x around 0 98.8%

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

Alternative 6: 99.4% 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.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 inf 98.8%

    \[\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 7: 99.0% accurate, 3.6× speedup?

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

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

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


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

    1. Initial program 99.8%

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

      \[\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 98.8%

      \[\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 97.4%

      \[\leadsto \left|x\right| \cdot \left|\frac{0.2 \cdot {x}^{4} + \color{blue}{2}}{\sqrt{\pi}}\right| \]
    6. Step-by-step derivation
      1. mul-fabs97.4%

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

        \[\leadsto \left|x \cdot \frac{\color{blue}{\mathsf{fma}\left(0.2, {x}^{4}, 2\right)}}{\sqrt{\pi}}\right| \]
    7. Applied egg-rr97.4%

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

    if 2 < (fabs.f64 x)

    1. Initial program 100.0%

      \[\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 inf 99.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. *-un-lft-identity99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 67.5% accurate, 4.5× speedup?

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

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

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


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

    1. Initial program 99.8%

      \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
    2. Simplified99.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 0 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\color{blue}{e^{\log \pi \cdot -0.5}} \cdot \left|\left|x\right|\right|\right) \]
      13. metadata-eval97.8%

        \[\leadsto 2 \cdot \left(e^{\log \pi \cdot \color{blue}{\left(-0.5\right)}} \cdot \left|\left|x\right|\right|\right) \]
      14. distribute-rgt-neg-in97.8%

        \[\leadsto 2 \cdot \left(e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left|\left|x\right|\right|\right) \]
      15. exp-neg97.8%

        \[\leadsto 2 \cdot \left(\color{blue}{\frac{1}{e^{\log \pi \cdot 0.5}}} \cdot \left|\left|x\right|\right|\right) \]
      16. fabs-fabs97.8%

        \[\leadsto 2 \cdot \left(\frac{1}{e^{\log \pi \cdot 0.5}} \cdot \color{blue}{\left|x\right|}\right) \]
      17. associate-*l/97.6%

        \[\leadsto 2 \cdot \color{blue}{\frac{1 \cdot \left|x\right|}{e^{\log \pi \cdot 0.5}}} \]
      18. *-lft-identity97.6%

        \[\leadsto 2 \cdot \frac{\color{blue}{\left|x\right|}}{e^{\log \pi \cdot 0.5}} \]
      19. exp-to-pow97.2%

        \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{{\pi}^{0.5}}} \]
      20. unpow1/297.2%

        \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{\sqrt{\pi}}} \]
    9. Simplified97.2%

      \[\leadsto \color{blue}{2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}} \]
    10. Step-by-step derivation
      1. add-log-exp9.5%

        \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
    11. Applied egg-rr9.5%

      \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
    12. Step-by-step derivation
      1. rem-log-exp97.2%

        \[\leadsto 2 \cdot \color{blue}{\frac{\left|x\right|}{\sqrt{\pi}}} \]
      2. div-inv97.8%

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

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

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\sqrt{\pi}}\right) \]
      5. add-sqr-sqrt53.0%

        \[\leadsto 2 \cdot \left(\color{blue}{x} \cdot \frac{1}{\sqrt{\pi}}\right) \]
      6. pow1/253.0%

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

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

        \[\leadsto 2 \cdot \left(x \cdot {\pi}^{\color{blue}{-0.5}}\right) \]
    13. Applied egg-rr53.0%

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

    if 0.40000000000000002 < (fabs.f64 x)

    1. Initial program 99.9%

      \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
    2. 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 inf 98.3%

      \[\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. *-un-lft-identity98.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1 \cdot \left(0.047619047619047616 \cdot \left|{\pi}^{-0.5} \cdot \left(\left|x\right| \cdot {x}^{6}\right)\right|\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 34.5% accurate, 4.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 5 \cdot 10^{+15}:\\
\;\;\;\;2 \cdot \left(x \cdot {\pi}^{-0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;2 \cdot \log \left(e^{\frac{x}{\sqrt{\pi}}}\right)\\


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

    1. Initial program 99.8%

      \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
    2. Simplified99.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 0 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\color{blue}{e^{\log \pi \cdot -0.5}} \cdot \left|\left|x\right|\right|\right) \]
      13. metadata-eval95.8%

        \[\leadsto 2 \cdot \left(e^{\log \pi \cdot \color{blue}{\left(-0.5\right)}} \cdot \left|\left|x\right|\right|\right) \]
      14. distribute-rgt-neg-in95.8%

        \[\leadsto 2 \cdot \left(e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left|\left|x\right|\right|\right) \]
      15. exp-neg95.8%

        \[\leadsto 2 \cdot \left(\color{blue}{\frac{1}{e^{\log \pi \cdot 0.5}}} \cdot \left|\left|x\right|\right|\right) \]
      16. fabs-fabs95.8%

        \[\leadsto 2 \cdot \left(\frac{1}{e^{\log \pi \cdot 0.5}} \cdot \color{blue}{\left|x\right|}\right) \]
      17. associate-*l/95.5%

        \[\leadsto 2 \cdot \color{blue}{\frac{1 \cdot \left|x\right|}{e^{\log \pi \cdot 0.5}}} \]
      18. *-lft-identity95.5%

        \[\leadsto 2 \cdot \frac{\color{blue}{\left|x\right|}}{e^{\log \pi \cdot 0.5}} \]
      19. exp-to-pow95.1%

        \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{{\pi}^{0.5}}} \]
      20. unpow1/295.1%

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

      \[\leadsto \color{blue}{2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}} \]
    10. Step-by-step derivation
      1. add-log-exp9.4%

        \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
    11. Applied egg-rr9.4%

      \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
    12. Step-by-step derivation
      1. rem-log-exp95.1%

        \[\leadsto 2 \cdot \color{blue}{\frac{\left|x\right|}{\sqrt{\pi}}} \]
      2. div-inv95.8%

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

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

        \[\leadsto 2 \cdot \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\sqrt{\pi}}\right) \]
      5. add-sqr-sqrt51.8%

        \[\leadsto 2 \cdot \left(\color{blue}{x} \cdot \frac{1}{\sqrt{\pi}}\right) \]
      6. pow1/251.8%

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

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

        \[\leadsto 2 \cdot \left(x \cdot {\pi}^{\color{blue}{-0.5}}\right) \]
    13. Applied egg-rr51.8%

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

    if 5e15 < (fabs.f64 x)

    1. Initial program 100.0%

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

      \[\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 6.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 2 \cdot \left(\left|\color{blue}{\sqrt{{\pi}^{-0.5}} \cdot \sqrt{{\pi}^{-0.5}}}\right| \cdot \left|\left|x\right|\right|\right) \]
      10. fabs-sqr6.0%

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

        \[\leadsto 2 \cdot \left(\color{blue}{{\pi}^{-0.5}} \cdot \left|\left|x\right|\right|\right) \]
      12. exp-to-pow6.0%

        \[\leadsto 2 \cdot \left(\color{blue}{e^{\log \pi \cdot -0.5}} \cdot \left|\left|x\right|\right|\right) \]
      13. metadata-eval6.0%

        \[\leadsto 2 \cdot \left(e^{\log \pi \cdot \color{blue}{\left(-0.5\right)}} \cdot \left|\left|x\right|\right|\right) \]
      14. distribute-rgt-neg-in6.0%

        \[\leadsto 2 \cdot \left(e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left|\left|x\right|\right|\right) \]
      15. exp-neg6.0%

        \[\leadsto 2 \cdot \left(\color{blue}{\frac{1}{e^{\log \pi \cdot 0.5}}} \cdot \left|\left|x\right|\right|\right) \]
      16. fabs-fabs6.0%

        \[\leadsto 2 \cdot \left(\frac{1}{e^{\log \pi \cdot 0.5}} \cdot \color{blue}{\left|x\right|}\right) \]
      17. associate-*l/6.0%

        \[\leadsto 2 \cdot \color{blue}{\frac{1 \cdot \left|x\right|}{e^{\log \pi \cdot 0.5}}} \]
      18. *-lft-identity6.0%

        \[\leadsto 2 \cdot \frac{\color{blue}{\left|x\right|}}{e^{\log \pi \cdot 0.5}} \]
      19. exp-to-pow6.0%

        \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{{\pi}^{0.5}}} \]
      20. unpow1/26.0%

        \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{\sqrt{\pi}}} \]
    9. Simplified6.0%

      \[\leadsto \color{blue}{2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}} \]
    10. Step-by-step derivation
      1. add-log-exp96.8%

        \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
    11. Applied egg-rr96.8%

      \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
    12. Step-by-step derivation
      1. expm1-log1p-u96.8%

        \[\leadsto 2 \cdot \log \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)\right)\right)} \]
      2. expm1-undefine96.8%

        \[\leadsto 2 \cdot \log \color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} - 1\right)} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto 2 \cdot \log \left(e^{\mathsf{log1p}\left(e^{\frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{\sqrt{\pi}}}\right)} - 1\right) \]
      4. fabs-sqr0.0%

        \[\leadsto 2 \cdot \log \left(e^{\mathsf{log1p}\left(e^{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{\sqrt{\pi}}}\right)} - 1\right) \]
      5. add-sqr-sqrt0.0%

        \[\leadsto 2 \cdot \log \left(e^{\mathsf{log1p}\left(e^{\frac{\color{blue}{x}}{\sqrt{\pi}}}\right)} - 1\right) \]
    13. Applied egg-rr0.0%

      \[\leadsto 2 \cdot \log \color{blue}{\left(e^{\mathsf{log1p}\left(e^{\frac{x}{\sqrt{\pi}}}\right)} - 1\right)} \]
    14. Step-by-step derivation
      1. log1p-undefine0.0%

        \[\leadsto 2 \cdot \log \left(e^{\color{blue}{\log \left(1 + e^{\frac{x}{\sqrt{\pi}}}\right)}} - 1\right) \]
      2. rem-exp-log0.0%

        \[\leadsto 2 \cdot \log \left(\color{blue}{\left(1 + e^{\frac{x}{\sqrt{\pi}}}\right)} - 1\right) \]
      3. associate-+r-0.0%

        \[\leadsto 2 \cdot \log \color{blue}{\left(1 + \left(e^{\frac{x}{\sqrt{\pi}}} - 1\right)\right)} \]
      4. expm1-undefine0.0%

        \[\leadsto 2 \cdot \log \left(1 + \color{blue}{\mathsf{expm1}\left(\frac{x}{\sqrt{\pi}}\right)}\right) \]
      5. rem-exp-log0.0%

        \[\leadsto 2 \cdot \log \color{blue}{\left(e^{\log \left(1 + \mathsf{expm1}\left(\frac{x}{\sqrt{\pi}}\right)\right)}\right)} \]
      6. log1p-undefine0.0%

        \[\leadsto 2 \cdot \log \left(e^{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{\sqrt{\pi}}\right)\right)}}\right) \]
      7. log1p-expm10.0%

        \[\leadsto 2 \cdot \log \left(e^{\color{blue}{\frac{x}{\sqrt{\pi}}}}\right) \]
    15. Simplified0.0%

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

Alternative 10: 99.1% accurate, 4.5× speedup?

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

\\
\left|x\right| \cdot \left|\frac{2 + 0.047619047619047616 \cdot {x}^{6}}{\sqrt{\pi}}\right|
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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 98.8%

    \[\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. Taylor expanded in x around 0 98.0%

    \[\leadsto \left|x\right| \cdot \left|\frac{0.047619047619047616 \cdot {x}^{6} + \color{blue}{2}}{\sqrt{\pi}}\right| \]
  6. Final simplification98.0%

    \[\leadsto \left|x\right| \cdot \left|\frac{2 + 0.047619047619047616 \cdot {x}^{6}}{\sqrt{\pi}}\right| \]
  7. Add Preprocessing

Alternative 11: 34.6% accurate, 17.4× speedup?

\[\begin{array}{l} \\ 2 \cdot \left(x \cdot {\pi}^{-0.5}\right) \end{array} \]
(FPCore (x) :precision binary64 (* 2.0 (* x (pow PI -0.5))))
double code(double x) {
	return 2.0 * (x * pow(((double) M_PI), -0.5));
}
public static double code(double x) {
	return 2.0 * (x * Math.pow(Math.PI, -0.5));
}
def code(x):
	return 2.0 * (x * math.pow(math.pi, -0.5))
function code(x)
	return Float64(2.0 * Float64(x * (pi ^ -0.5)))
end
function tmp = code(x)
	tmp = 2.0 * (x * (pi ^ -0.5));
end
code[x_] := N[(2.0 * N[(x * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
2 \cdot \left(x \cdot {\pi}^{-0.5}\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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 65.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\color{blue}{{\pi}^{-0.5}} \cdot \left|\left|x\right|\right|\right) \]
    12. exp-to-pow65.3%

      \[\leadsto 2 \cdot \left(\color{blue}{e^{\log \pi \cdot -0.5}} \cdot \left|\left|x\right|\right|\right) \]
    13. metadata-eval65.3%

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

      \[\leadsto 2 \cdot \left(e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left|\left|x\right|\right|\right) \]
    15. exp-neg65.3%

      \[\leadsto 2 \cdot \left(\color{blue}{\frac{1}{e^{\log \pi \cdot 0.5}}} \cdot \left|\left|x\right|\right|\right) \]
    16. fabs-fabs65.3%

      \[\leadsto 2 \cdot \left(\frac{1}{e^{\log \pi \cdot 0.5}} \cdot \color{blue}{\left|x\right|}\right) \]
    17. associate-*l/65.1%

      \[\leadsto 2 \cdot \color{blue}{\frac{1 \cdot \left|x\right|}{e^{\log \pi \cdot 0.5}}} \]
    18. *-lft-identity65.1%

      \[\leadsto 2 \cdot \frac{\color{blue}{\left|x\right|}}{e^{\log \pi \cdot 0.5}} \]
    19. exp-to-pow64.8%

      \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{{\pi}^{0.5}}} \]
    20. unpow1/264.8%

      \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{\sqrt{\pi}}} \]
  9. Simplified64.8%

    \[\leadsto \color{blue}{2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}} \]
  10. Step-by-step derivation
    1. add-log-exp39.1%

      \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
  11. Applied egg-rr39.1%

    \[\leadsto 2 \cdot \color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \]
  12. Step-by-step derivation
    1. rem-log-exp64.8%

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

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

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

      \[\leadsto 2 \cdot \left(\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\sqrt{\pi}}\right) \]
    5. add-sqr-sqrt34.3%

      \[\leadsto 2 \cdot \left(\color{blue}{x} \cdot \frac{1}{\sqrt{\pi}}\right) \]
    6. pow1/234.3%

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

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

      \[\leadsto 2 \cdot \left(x \cdot {\pi}^{\color{blue}{-0.5}}\right) \]
  13. Applied egg-rr34.3%

    \[\leadsto 2 \cdot \color{blue}{\left(x \cdot {\pi}^{-0.5}\right)} \]
  14. Add Preprocessing

Alternative 12: 34.4% accurate, 17.6× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. 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 65.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 2 \cdot \left(\color{blue}{{\pi}^{-0.5}} \cdot \left|\left|x\right|\right|\right) \]
    12. exp-to-pow65.3%

      \[\leadsto 2 \cdot \left(\color{blue}{e^{\log \pi \cdot -0.5}} \cdot \left|\left|x\right|\right|\right) \]
    13. metadata-eval65.3%

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

      \[\leadsto 2 \cdot \left(e^{\color{blue}{-\log \pi \cdot 0.5}} \cdot \left|\left|x\right|\right|\right) \]
    15. exp-neg65.3%

      \[\leadsto 2 \cdot \left(\color{blue}{\frac{1}{e^{\log \pi \cdot 0.5}}} \cdot \left|\left|x\right|\right|\right) \]
    16. fabs-fabs65.3%

      \[\leadsto 2 \cdot \left(\frac{1}{e^{\log \pi \cdot 0.5}} \cdot \color{blue}{\left|x\right|}\right) \]
    17. associate-*l/65.1%

      \[\leadsto 2 \cdot \color{blue}{\frac{1 \cdot \left|x\right|}{e^{\log \pi \cdot 0.5}}} \]
    18. *-lft-identity65.1%

      \[\leadsto 2 \cdot \frac{\color{blue}{\left|x\right|}}{e^{\log \pi \cdot 0.5}} \]
    19. exp-to-pow64.8%

      \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{{\pi}^{0.5}}} \]
    20. unpow1/264.8%

      \[\leadsto 2 \cdot \frac{\left|x\right|}{\color{blue}{\sqrt{\pi}}} \]
  9. Simplified64.8%

    \[\leadsto \color{blue}{2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}} \]
  10. Step-by-step derivation
    1. expm1-log1p-u64.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right)\right)} \]
    2. expm1-undefine8.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right)} - 1} \]
  11. Applied egg-rr8.4%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right)} - 1} \]
  12. Step-by-step derivation
    1. log1p-undefine8.4%

      \[\leadsto e^{\color{blue}{\log \left(1 + 2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right)}} - 1 \]
    2. rem-exp-log8.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left|2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right| + 1\right)} - 1 \]
    9. associate--l+64.8%

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

      \[\leadsto \left|2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right| + \color{blue}{0} \]
    11. +-rgt-identity64.8%

      \[\leadsto \color{blue}{\left|2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right|} \]
    12. fabs-mul64.8%

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

      \[\leadsto \color{blue}{2} \cdot \left|\frac{\left|x\right|}{\sqrt{\pi}}\right| \]
  13. Simplified65.3%

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

      \[\leadsto \color{blue}{\frac{\left|x\right| \cdot 2}{\sqrt{\pi}}} \]
    2. add-sqr-sqrt32.9%

      \[\leadsto \frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| \cdot 2}{\sqrt{\pi}} \]
    3. fabs-sqr32.9%

      \[\leadsto \frac{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot 2}{\sqrt{\pi}} \]
    4. add-sqr-sqrt34.1%

      \[\leadsto \frac{\color{blue}{x} \cdot 2}{\sqrt{\pi}} \]
  15. Applied egg-rr34.1%

    \[\leadsto \color{blue}{\frac{x \cdot 2}{\sqrt{\pi}}} \]
  16. Final simplification34.1%

    \[\leadsto \frac{2 \cdot x}{\sqrt{\pi}} \]
  17. Add Preprocessing

Reproduce

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