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

Percentage Accurate: 99.8% → 99.9%
Time: 10.4s
Alternatives: 6
Speedup: 2.7×

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 6 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, 0.9× speedup?

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

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

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

    \[\leadsto \left|\color{blue}{\mathsf{fma}\left({\left(\left|x\right|\right)}^{6} \cdot 0.047619047619047616, \left|x\right| \cdot {\pi}^{-0.5}, \mathsf{fma}\left({\left(\left|x\right|\right)}^{5}, 0.2, \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right) \cdot {\pi}^{-0.5}\right)}\right| \]
  4. Applied rewrites69.6%

    \[\leadsto \left|\mathsf{fma}\left({\left(\left|x\right|\right)}^{6} \cdot 0.047619047619047616, \left|x\right| \cdot {\pi}^{-0.5}, \color{blue}{\mathsf{fma}\left(x \cdot x, x \cdot \left(\left(x \cdot x\right) \cdot 0.2\right), \left(-\left(-x\right)\right) \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right)} \cdot {\pi}^{-0.5}\right)\right| \]
  5. Step-by-step derivation
    1. lift-PI.f64N/A

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

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

      \[\leadsto \left|\mathsf{fma}\left({\left(\left|x\right|\right)}^{6} \cdot \frac{1}{21}, \left|x\right| \cdot {\pi}^{\frac{-1}{2}}, \mathsf{fma}\left(x \cdot x, x \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{5}\right), \left(-\left(-x\right)\right) \cdot \mathsf{fma}\left(x \cdot x, \frac{2}{3}, 2\right)\right) \cdot {\mathsf{PI}\left(\right)}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}\right)\right| \]
    4. pow-flipN/A

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

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

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

      \[\leadsto \left|\mathsf{fma}\left({\left(\left|x\right|\right)}^{6} \cdot \frac{1}{21}, \left|x\right| \cdot {\pi}^{\frac{-1}{2}}, \mathsf{fma}\left(x \cdot x, x \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{5}\right), \left(-\left(-x\right)\right) \cdot \mathsf{fma}\left(x \cdot x, \frac{2}{3}, 2\right)\right) \cdot \frac{1}{\sqrt{\color{blue}{\pi}}}\right)\right| \]
    8. lift-/.f6469.6

      \[\leadsto \left|\mathsf{fma}\left({\left(\left|x\right|\right)}^{6} \cdot 0.047619047619047616, \left|x\right| \cdot {\pi}^{-0.5}, \mathsf{fma}\left(x \cdot x, x \cdot \left(\left(x \cdot x\right) \cdot 0.2\right), \left(-\left(-x\right)\right) \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right) \cdot \color{blue}{\frac{1}{\sqrt{\pi}}}\right)\right| \]
  6. Applied rewrites69.6%

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left({\left(\left|x\right|\right)}^{6} \cdot \frac{1}{21}, \left|x\right| \cdot \color{blue}{\frac{1}{\sqrt{\pi}}}, \mathsf{fma}\left(x \cdot x, x \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{5}\right), \left(-\left(-x\right)\right) \cdot \mathsf{fma}\left(x \cdot x, \frac{2}{3}, 2\right)\right) \cdot \frac{1}{\sqrt{\pi}}\right)\right| \]
    8. lift-/.f6469.6

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

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

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

Alternative 2: 99.8% accurate, 2.7× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

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

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

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot x\right)\right| \]
    2. unpow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot {x}^{1}\right)\right| \]
    3. metadata-evalN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot {x}^{\left(\frac{2}{2}\right)}\right)\right| \]
    4. sqrt-pow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \sqrt{{x}^{2}}\right)\right| \]
    5. pow2N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \sqrt{x \cdot x}\right)\right| \]
    6. rem-sqrt-square-revN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \left|x\right|\right)\right| \]
    7. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot \frac{1}{21} + \frac{1}{5}\right) \cdot x, x, \frac{2}{3}\right), x \cdot x, 2\right) \cdot x\right)\right| \]
    9. lift-fma.f6499.6

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

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

Alternative 3: 99.2% accurate, 2.8× speedup?

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

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

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

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

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

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot x\right)\right| \]
    2. unpow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot {x}^{1}\right)\right| \]
    3. metadata-evalN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot {x}^{\left(\frac{2}{2}\right)}\right)\right| \]
    4. sqrt-pow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \sqrt{{x}^{2}}\right)\right| \]
    5. pow2N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \sqrt{x \cdot x}\right)\right| \]
    6. rem-sqrt-square-revN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \left|x\right|\right)\right| \]
    7. lower-*.f64N/A

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

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

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{21} \cdot {x}^{2}, x \cdot x, \frac{2}{3}\right), x \cdot x, 2\right) \cdot x\right)\right| \]
  10. Step-by-step derivation
    1. pow2N/A

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot \frac{1}{21}, x \cdot x, \frac{2}{3}\right), x \cdot x, 2\right) \cdot x\right)\right| \]
    4. lower-*.f6497.8

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot 0.047619047619047616, x \cdot x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right)\right| \]
  11. Applied rewrites97.8%

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

Alternative 4: 93.2% accurate, 3.3× speedup?

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

\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(x\_m \cdot x\_m, 0.2, 0.6666666666666666\right), x\_m \cdot x\_m, 2\right) \cdot x\_m\right)\right|
\end{array}
Derivation
  1. Initial program 99.6%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

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

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

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + \frac{1}{5} \cdot {x}^{2}\right)\right) \cdot x\right)\right| \]
    2. unpow1N/A

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + \frac{1}{5} \cdot {x}^{2}\right)\right) \cdot {x}^{\left(\frac{2}{2}\right)}\right)\right| \]
    4. sqrt-pow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + \frac{1}{5} \cdot {x}^{2}\right)\right) \cdot \sqrt{{x}^{2}}\right)\right| \]
    5. pow2N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + \frac{1}{5} \cdot {x}^{2}\right)\right) \cdot \sqrt{x \cdot x}\right)\right| \]
    6. rem-sqrt-square-revN/A

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

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

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

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

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

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left({x}^{2}, \frac{1}{5}, \frac{2}{3}\right), {x}^{2}, 2\right) \cdot \left|x\right|\right)\right| \]
    14. pow2N/A

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{1}{5}, \frac{2}{3}\right), {x}^{2}, 2\right) \cdot \left|x\right|\right)\right| \]
    16. pow2N/A

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{1}{5}, \frac{2}{3}\right), x \cdot x, 2\right) \cdot \left|x\right|\right)\right| \]
    18. rem-sqrt-square-revN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{1}{5}, \frac{2}{3}\right), x \cdot x, 2\right) \cdot \sqrt{x \cdot x}\right)\right| \]
    19. pow2N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{1}{5}, \frac{2}{3}\right), x \cdot x, 2\right) \cdot \sqrt{{x}^{2}}\right)\right| \]
    20. sqrt-pow1N/A

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

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

Alternative 5: 89.0% accurate, 4.1× speedup?

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

\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x\_m \cdot x\_m, 2\right) \cdot x\_m\right)\right|
\end{array}
Derivation
  1. Initial program 99.6%

    \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

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

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

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

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

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot x\right)\right| \]
    2. unpow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot {x}^{1}\right)\right| \]
    3. metadata-evalN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot {x}^{\left(\frac{2}{2}\right)}\right)\right| \]
    4. sqrt-pow1N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \sqrt{{x}^{2}}\right)\right| \]
    5. pow2N/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \sqrt{x \cdot x}\right)\right| \]
    6. rem-sqrt-square-revN/A

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(2 + {x}^{2} \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{5} + \frac{1}{21} \cdot {x}^{2}\right)\right)\right) \cdot \left|x\right|\right)\right| \]
    7. lower-*.f64N/A

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

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

    \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right) \cdot x\right)\right| \]
  10. Step-by-step derivation
    1. Applied rewrites88.5%

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

    Alternative 6: 67.4% accurate, 5.7× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \left|\frac{1}{\sqrt{\pi}} \cdot \left(x\_m + x\_m\right)\right| \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m) :precision binary64 (fabs (* (/ 1.0 (sqrt PI)) (+ x_m x_m))))
    x_m = fabs(x);
    double code(double x_m) {
    	return fabs(((1.0 / sqrt(((double) M_PI))) * (x_m + x_m)));
    }
    
    x_m = Math.abs(x);
    public static double code(double x_m) {
    	return Math.abs(((1.0 / Math.sqrt(Math.PI)) * (x_m + x_m)));
    }
    
    x_m = math.fabs(x)
    def code(x_m):
    	return math.fabs(((1.0 / math.sqrt(math.pi)) * (x_m + x_m)))
    
    x_m = abs(x)
    function code(x_m)
    	return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(x_m + x_m)))
    end
    
    x_m = abs(x);
    function tmp = code(x_m)
    	tmp = abs(((1.0 / sqrt(pi)) * (x_m + x_m)));
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(x$95$m + x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \left|\frac{1}{\sqrt{\pi}} \cdot \left(x\_m + x\_m\right)\right|
    \end{array}
    
    Derivation
    1. Initial program 99.6%

      \[\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

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

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

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

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

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(x \cdot 2\right)\right| \]
      2. unpow1N/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({x}^{1} \cdot 2\right)\right| \]
      3. metadata-evalN/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({x}^{\left(\frac{2}{2}\right)} \cdot 2\right)\right| \]
      4. sqrt-pow1N/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\sqrt{{x}^{2}} \cdot 2\right)\right| \]
      5. pow2N/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\sqrt{x \cdot x} \cdot 2\right)\right| \]
      6. rem-sqrt-square-revN/A

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

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot 2\right)\right| \]
      8. rem-sqrt-square-revN/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\sqrt{x \cdot x} \cdot 2\right)\right| \]
      9. pow2N/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(\sqrt{{x}^{2}} \cdot 2\right)\right| \]
      10. sqrt-pow1N/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({x}^{\left(\frac{2}{2}\right)} \cdot 2\right)\right| \]
      11. metadata-evalN/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left({x}^{1} \cdot 2\right)\right| \]
      12. unpow164.8

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(x \cdot 2\right)\right| \]
    8. Applied rewrites64.8%

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

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(x \cdot 2\right)\right| \]
      2. *-commutativeN/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(2 \cdot x\right)\right| \]
      3. count-2-revN/A

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(x + x\right)\right| \]
      4. lower-+.f6464.8

        \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(x + x\right)\right| \]
    10. Applied rewrites64.8%

      \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \left(x + x\right)\right| \]
    11. Add Preprocessing

    Reproduce

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