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

Percentage Accurate: 99.8% → 99.8%
Time: 5.7s
Alternatives: 14
Speedup: 1.6×

Specification

?
\[x \leq 0.5\]
\[\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} \]
(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}
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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} 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} \]
(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}
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}

Alternative 1: 99.8% accurate, 1.5× speedup?

\[\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, \mathsf{fma}\left(0.2 \cdot \left|x\right|, \left(\left(x \cdot x\right) \cdot x\right) \cdot x, \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right)\right)\right| \]
(FPCore (x)
 :precision binary64
 (fabs
  (*
   (/ 1.0 (sqrt PI))
   (fma
    (pow (fabs x) 7.0)
    0.047619047619047616
    (fma
     (* 0.2 (fabs x))
     (* (* (* x x) x) x)
     (* (fabs x) (fma (* x x) 0.6666666666666666 2.0)))))))
double code(double x) {
	return fabs(((1.0 / sqrt(((double) M_PI))) * fma(pow(fabs(x), 7.0), 0.047619047619047616, fma((0.2 * fabs(x)), (((x * x) * x) * x), (fabs(x) * fma((x * x), 0.6666666666666666, 2.0))))));
}
function code(x)
	return abs(Float64(Float64(1.0 / sqrt(pi)) * fma((abs(x) ^ 7.0), 0.047619047619047616, fma(Float64(0.2 * abs(x)), Float64(Float64(Float64(x * x) * x) * x), Float64(abs(x) * fma(Float64(x * x), 0.6666666666666666, 2.0))))))
end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616 + N[(N[(0.2 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.6666666666666666 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, \mathsf{fma}\left(0.2 \cdot \left|x\right|, \left(\left(x \cdot x\right) \cdot x\right) \cdot x, \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right)\right)\right|
Derivation
  1. Initial program 99.8%

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

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

Alternative 2: 99.8% accurate, 1.6× speedup?

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

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

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

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

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

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

Alternative 4: 99.6% accurate, 1.9× speedup?

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

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

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

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

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

    Alternative 5: 99.4% accurate, 2.0× speedup?

    \[\frac{1.772453850905516 \cdot \left|\mathsf{fma}\left(0.047619047619047616 \cdot \left(x \cdot x\right), \left(\left(x \cdot x\right) \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), 2\right)\right) \cdot x\right|}{\pi} \]
    (FPCore (x)
     :precision binary64
     (/
      (*
       1.772453850905516
       (fabs
        (*
         (fma
          (* 0.047619047619047616 (* x x))
          (* (* (* x x) x) x)
          (fma (* x x) (fma (* 0.2 x) x 0.6666666666666666) 2.0))
         x)))
      PI))
    double code(double x) {
    	return (1.772453850905516 * fabs((fma((0.047619047619047616 * (x * x)), (((x * x) * x) * x), fma((x * x), fma((0.2 * x), x, 0.6666666666666666), 2.0)) * x))) / ((double) M_PI);
    }
    
    function code(x)
    	return Float64(Float64(1.772453850905516 * abs(Float64(fma(Float64(0.047619047619047616 * Float64(x * x)), Float64(Float64(Float64(x * x) * x) * x), fma(Float64(x * x), fma(Float64(0.2 * x), x, 0.6666666666666666), 2.0)) * x))) / pi)
    end
    
    code[x_] := N[(N[(1.772453850905516 * N[Abs[N[(N[(N[(0.047619047619047616 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]
    
    \frac{1.772453850905516 \cdot \left|\mathsf{fma}\left(0.047619047619047616 \cdot \left(x \cdot x\right), \left(\left(x \cdot x\right) \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), 2\right)\right) \cdot x\right|}{\pi}
    
    Derivation
    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\pi} \cdot \left|\mathsf{fma}\left(0.047619047619047616 \cdot \left(x \cdot x\right), \left(\left(x \cdot x\right) \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), 2\right)\right) \cdot x\right|}{\pi}} \]
      2. Evaluated real constant99.4%

        \[\leadsto \frac{\color{blue}{\frac{7982422502469483}{4503599627370496}} \cdot \left|\mathsf{fma}\left(\frac{1}{21} \cdot \left(x \cdot x\right), \left(\left(x \cdot x\right) \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\frac{1}{5} \cdot x, x, \frac{2}{3}\right), 2\right)\right) \cdot x\right|}{\pi} \]
      3. Add Preprocessing

      Alternative 6: 98.8% accurate, 2.7× speedup?

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

        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. Applied rewrites99.8%

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

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

          \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
        5. Step-by-step derivation
          1. Applied rewrites67.7%

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

              \[\leadsto \color{blue}{\frac{\left|x \cdot 2\right| \cdot \sqrt{\pi}}{\pi}} \]
            2. lift-*.f64N/A

              \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right| \cdot \sqrt{\pi}}}{\pi} \]
            3. associate-/l*N/A

              \[\leadsto \color{blue}{\left|x \cdot 2\right| \cdot \frac{\sqrt{\pi}}{\pi}} \]
            4. lift-sqrt.f64N/A

              \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{\sqrt{\pi}}}{\pi} \]
            5. pow1/2N/A

              \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{{\pi}^{\frac{1}{2}}}}{\pi} \]
            6. unpow1N/A

              \[\leadsto \left|x \cdot 2\right| \cdot \frac{{\pi}^{\frac{1}{2}}}{\color{blue}{{\pi}^{1}}} \]
            7. pow-divN/A

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

              \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\frac{-1}{2}}} \]
            9. metadata-evalN/A

              \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
            10. pow-flipN/A

              \[\leadsto \left|x \cdot 2\right| \cdot \color{blue}{\frac{1}{{\pi}^{\frac{1}{2}}}} \]
            11. pow1/2N/A

              \[\leadsto \left|x \cdot 2\right| \cdot \frac{1}{\color{blue}{\sqrt{\pi}}} \]
            12. lift-PI.f64N/A

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

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

          if 2.4e5 < x

          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. Applied rewrites99.8%

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

            \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\frac{1}{21} \cdot \left({x}^{6} \cdot \left|x\right|\right)}\right| \]
          4. Step-by-step derivation
            1. lower-*.f64N/A

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

              \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \color{blue}{\left|x\right|}\right)\right| \]
            3. lower-pow.f64N/A

              \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \left|\color{blue}{x}\right|\right)\right| \]
            4. lower-fabs.f6436.6

              \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right| \]
          5. Applied rewrites36.6%

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

            \[\leadsto \color{blue}{\frac{5081767996463981}{9007199254740992}} \cdot \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right| \]
        6. Recombined 2 regimes into one program.
        7. Add Preprocessing

        Alternative 7: 98.5% accurate, 2.6× speedup?

        \[\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, 2 \cdot \left|x\right|\right)\right| \]
        (FPCore (x)
         :precision binary64
         (fabs
          (*
           (/ 1.0 (sqrt PI))
           (fma (pow (fabs x) 7.0) 0.047619047619047616 (* 2.0 (fabs x))))))
        double code(double x) {
        	return fabs(((1.0 / sqrt(((double) M_PI))) * fma(pow(fabs(x), 7.0), 0.047619047619047616, (2.0 * fabs(x)))));
        }
        
        function code(x)
        	return abs(Float64(Float64(1.0 / sqrt(pi)) * fma((abs(x) ^ 7.0), 0.047619047619047616, Float64(2.0 * abs(x)))))
        end
        
        code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616 + N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
        
        \left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, 2 \cdot \left|x\right|\right)\right|
        
        Derivation
        1. Initial program 99.8%

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

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

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

            \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, \frac{1}{21}, 2 \cdot \color{blue}{\left|x\right|}\right)\right| \]
          2. lower-fabs.f6498.8

            \[\leadsto \left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, 2 \cdot \left|x\right|\right)\right| \]
        5. Applied rewrites98.8%

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

        Alternative 8: 98.5% accurate, 2.8× speedup?

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

          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. Applied rewrites99.8%

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

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

            \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
          5. Step-by-step derivation
            1. Applied rewrites67.7%

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

                \[\leadsto \color{blue}{\frac{\left|x \cdot 2\right| \cdot \sqrt{\pi}}{\pi}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right| \cdot \sqrt{\pi}}}{\pi} \]
              3. associate-/l*N/A

                \[\leadsto \color{blue}{\left|x \cdot 2\right| \cdot \frac{\sqrt{\pi}}{\pi}} \]
              4. lift-sqrt.f64N/A

                \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{\sqrt{\pi}}}{\pi} \]
              5. pow1/2N/A

                \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{{\pi}^{\frac{1}{2}}}}{\pi} \]
              6. unpow1N/A

                \[\leadsto \left|x \cdot 2\right| \cdot \frac{{\pi}^{\frac{1}{2}}}{\color{blue}{{\pi}^{1}}} \]
              7. pow-divN/A

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

                \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\frac{-1}{2}}} \]
              9. metadata-evalN/A

                \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
              10. pow-flipN/A

                \[\leadsto \left|x \cdot 2\right| \cdot \color{blue}{\frac{1}{{\pi}^{\frac{1}{2}}}} \]
              11. pow1/2N/A

                \[\leadsto \left|x \cdot 2\right| \cdot \frac{1}{\color{blue}{\sqrt{\pi}}} \]
              12. lift-PI.f64N/A

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

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

            if 2.4e5 < x

            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. Applied rewrites99.8%

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

              \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\frac{1}{21} \cdot \left({x}^{6} \cdot \left|x\right|\right)}\right| \]
            4. Step-by-step derivation
              1. lower-*.f64N/A

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

                \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \color{blue}{\left|x\right|}\right)\right| \]
              3. lower-pow.f64N/A

                \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \left|\color{blue}{x}\right|\right)\right| \]
              4. lower-fabs.f6436.6

                \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|0.047619047619047616 \cdot \left({x}^{6} \cdot \left|x\right|\right)\right| \]
            5. Applied rewrites36.6%

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

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

          Alternative 9: 98.3% accurate, 2.8× speedup?

          \[\left|\frac{\mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, 2 \cdot \left|x\right|\right)}{\sqrt{\pi}}\right| \]
          (FPCore (x)
           :precision binary64
           (fabs
            (/
             (fma 0.047619047619047616 (pow (fabs x) 7.0) (* 2.0 (fabs x)))
             (sqrt PI))))
          double code(double x) {
          	return fabs((fma(0.047619047619047616, pow(fabs(x), 7.0), (2.0 * fabs(x))) / sqrt(((double) M_PI))));
          }
          
          function code(x)
          	return abs(Float64(fma(0.047619047619047616, (abs(x) ^ 7.0), Float64(2.0 * abs(x))) / sqrt(pi)))
          end
          
          code[x_] := N[Abs[N[(N[(0.047619047619047616 * N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] + N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
          
          \left|\frac{\mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, 2 \cdot \left|x\right|\right)}{\sqrt{\pi}}\right|
          
          Derivation
          1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

              \[\leadsto \left|\frac{\mathsf{fma}\left(\frac{1}{21}, {\left(\left|x\right|\right)}^{7}, 2 \cdot \left|x\right|\right)}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
            8. lower-PI.f6498.3

              \[\leadsto \left|\frac{\mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, 2 \cdot \left|x\right|\right)}{\sqrt{\pi}}\right| \]
          5. Applied rewrites98.3%

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

          Alternative 10: 93.3% accurate, 3.3× speedup?

          \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 240000:\\ \;\;\;\;\frac{1}{\sqrt{\pi}} \cdot \left|2 \cdot \left|x\right|\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(\left|\left|x\right|\right| \cdot \left|x\right|\right) \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) \cdot 0.11283791670955126\right|\\ \end{array} \]
          (FPCore (x)
           :precision binary64
           (if (<= (fabs x) 240000.0)
             (* (/ 1.0 (sqrt PI)) (fabs (* 2.0 (fabs x))))
             (fabs
              (*
               (* (* (fabs (fabs x)) (fabs x)) (* (* (fabs x) (fabs x)) (fabs x)))
               0.11283791670955126))))
          double code(double x) {
          	double tmp;
          	if (fabs(x) <= 240000.0) {
          		tmp = (1.0 / sqrt(((double) M_PI))) * fabs((2.0 * fabs(x)));
          	} else {
          		tmp = fabs((((fabs(fabs(x)) * fabs(x)) * ((fabs(x) * fabs(x)) * fabs(x))) * 0.11283791670955126));
          	}
          	return tmp;
          }
          
          public static double code(double x) {
          	double tmp;
          	if (Math.abs(x) <= 240000.0) {
          		tmp = (1.0 / Math.sqrt(Math.PI)) * Math.abs((2.0 * Math.abs(x)));
          	} else {
          		tmp = Math.abs((((Math.abs(Math.abs(x)) * Math.abs(x)) * ((Math.abs(x) * Math.abs(x)) * Math.abs(x))) * 0.11283791670955126));
          	}
          	return tmp;
          }
          
          def code(x):
          	tmp = 0
          	if math.fabs(x) <= 240000.0:
          		tmp = (1.0 / math.sqrt(math.pi)) * math.fabs((2.0 * math.fabs(x)))
          	else:
          		tmp = math.fabs((((math.fabs(math.fabs(x)) * math.fabs(x)) * ((math.fabs(x) * math.fabs(x)) * math.fabs(x))) * 0.11283791670955126))
          	return tmp
          
          function code(x)
          	tmp = 0.0
          	if (abs(x) <= 240000.0)
          		tmp = Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(2.0 * abs(x))));
          	else
          		tmp = abs(Float64(Float64(Float64(abs(abs(x)) * abs(x)) * Float64(Float64(abs(x) * abs(x)) * abs(x))) * 0.11283791670955126));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x)
          	tmp = 0.0;
          	if (abs(x) <= 240000.0)
          		tmp = (1.0 / sqrt(pi)) * abs((2.0 * abs(x)));
          	else
          		tmp = abs((((abs(abs(x)) * abs(x)) * ((abs(x) * abs(x)) * abs(x))) * 0.11283791670955126));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 240000.0], N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(N[(N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.11283791670955126), $MachinePrecision]], $MachinePrecision]]
          
          \begin{array}{l}
          \mathbf{if}\;\left|x\right| \leq 240000:\\
          \;\;\;\;\frac{1}{\sqrt{\pi}} \cdot \left|2 \cdot \left|x\right|\right|\\
          
          \mathbf{else}:\\
          \;\;\;\;\left|\left(\left(\left|\left|x\right|\right| \cdot \left|x\right|\right) \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) \cdot 0.11283791670955126\right|\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 2.4e5

            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. Applied rewrites99.8%

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

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

              \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
            5. Step-by-step derivation
              1. Applied rewrites67.7%

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

                  \[\leadsto \color{blue}{\frac{\left|x \cdot 2\right| \cdot \sqrt{\pi}}{\pi}} \]
                2. lift-*.f64N/A

                  \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right| \cdot \sqrt{\pi}}}{\pi} \]
                3. associate-/l*N/A

                  \[\leadsto \color{blue}{\left|x \cdot 2\right| \cdot \frac{\sqrt{\pi}}{\pi}} \]
                4. lift-sqrt.f64N/A

                  \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{\sqrt{\pi}}}{\pi} \]
                5. pow1/2N/A

                  \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{{\pi}^{\frac{1}{2}}}}{\pi} \]
                6. unpow1N/A

                  \[\leadsto \left|x \cdot 2\right| \cdot \frac{{\pi}^{\frac{1}{2}}}{\color{blue}{{\pi}^{1}}} \]
                7. pow-divN/A

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

                  \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\frac{-1}{2}}} \]
                9. metadata-evalN/A

                  \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
                10. pow-flipN/A

                  \[\leadsto \left|x \cdot 2\right| \cdot \color{blue}{\frac{1}{{\pi}^{\frac{1}{2}}}} \]
                11. pow1/2N/A

                  \[\leadsto \left|x \cdot 2\right| \cdot \frac{1}{\color{blue}{\sqrt{\pi}}} \]
                12. lift-PI.f64N/A

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

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

              if 2.4e5 < x

              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. Applied rewrites99.8%

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

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

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

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

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

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

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

                  \[\leadsto \left|\frac{1}{5} \cdot \frac{{x}^{4} \cdot \left|x\right|}{\sqrt{\mathsf{PI}\left(\right)}}\right| \]
                7. lower-PI.f6431.2

                  \[\leadsto \left|0.2 \cdot \frac{{x}^{4} \cdot \left|x\right|}{\sqrt{\pi}}\right| \]
              5. Applied rewrites31.2%

                \[\leadsto \left|\color{blue}{0.2 \cdot \frac{{x}^{4} \cdot \left|x\right|}{\sqrt{\pi}}}\right| \]
              6. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \left|\frac{1}{5} \cdot \color{blue}{\frac{{x}^{4} \cdot \left|x\right|}{\sqrt{\pi}}}\right| \]
                2. lift-/.f64N/A

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

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

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

                  \[\leadsto \left|\left({x}^{4} \cdot \left|x\right|\right) \cdot \color{blue}{\frac{\frac{1}{5}}{\sqrt{\pi}}}\right| \]
                6. lower-*.f64N/A

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

                \[\leadsto \left|\left(\left(\left|x\right| \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)\right) \cdot \color{blue}{\frac{0.2}{\sqrt{\pi}}}\right| \]
              8. Evaluated real constant31.2%

                \[\leadsto \left|\left(\left(\left|x\right| \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)\right) \cdot \frac{4065414397171185}{36028797018963968}\right| \]
            6. Recombined 2 regimes into one program.
            7. Add Preprocessing

            Alternative 11: 83.4% accurate, 0.8× speedup?

            \[\begin{array}{l} t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\ t_1 := \frac{1}{\sqrt{\pi}}\\ t_2 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\ \mathbf{if}\;\left|t\_1 \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_2\right) + \frac{1}{21} \cdot \left(\left(t\_2 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \leq 2 \cdot 10^{-8}:\\ \;\;\;\;t\_1 \cdot \left|2 \cdot x\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(2 \cdot x\right) \cdot x\right) \cdot 2\right) \cdot \pi}}{\pi}\\ \end{array} \]
            (FPCore (x)
             :precision binary64
             (let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
                    (t_1 (/ 1.0 (sqrt PI)))
                    (t_2 (* (* t_0 (fabs x)) (fabs x))))
               (if (<=
                    (fabs
                     (*
                      t_1
                      (+
                       (+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_2))
                       (* (/ 1.0 21.0) (* (* t_2 (fabs x)) (fabs x))))))
                    2e-8)
                 (* t_1 (fabs (* 2.0 x)))
                 (/ (sqrt (* (* (* (* 2.0 x) x) 2.0) PI)) PI))))
            double code(double x) {
            	double t_0 = (fabs(x) * fabs(x)) * fabs(x);
            	double t_1 = 1.0 / sqrt(((double) M_PI));
            	double t_2 = (t_0 * fabs(x)) * fabs(x);
            	double tmp;
            	if (fabs((t_1 * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * fabs(x)) * fabs(x)))))) <= 2e-8) {
            		tmp = t_1 * fabs((2.0 * x));
            	} else {
            		tmp = sqrt(((((2.0 * x) * x) * 2.0) * ((double) M_PI))) / ((double) M_PI);
            	}
            	return tmp;
            }
            
            public static double code(double x) {
            	double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
            	double t_1 = 1.0 / Math.sqrt(Math.PI);
            	double t_2 = (t_0 * Math.abs(x)) * Math.abs(x);
            	double tmp;
            	if (Math.abs((t_1 * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * Math.abs(x)) * Math.abs(x)))))) <= 2e-8) {
            		tmp = t_1 * Math.abs((2.0 * x));
            	} else {
            		tmp = Math.sqrt(((((2.0 * x) * x) * 2.0) * Math.PI)) / Math.PI;
            	}
            	return tmp;
            }
            
            def code(x):
            	t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x)
            	t_1 = 1.0 / math.sqrt(math.pi)
            	t_2 = (t_0 * math.fabs(x)) * math.fabs(x)
            	tmp = 0
            	if math.fabs((t_1 * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * math.fabs(x)) * math.fabs(x)))))) <= 2e-8:
            		tmp = t_1 * math.fabs((2.0 * x))
            	else:
            		tmp = math.sqrt(((((2.0 * x) * x) * 2.0) * math.pi)) / math.pi
            	return tmp
            
            function code(x)
            	t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x))
            	t_1 = Float64(1.0 / sqrt(pi))
            	t_2 = Float64(Float64(t_0 * abs(x)) * abs(x))
            	tmp = 0.0
            	if (abs(Float64(t_1 * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_2)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_2 * abs(x)) * abs(x)))))) <= 2e-8)
            		tmp = Float64(t_1 * abs(Float64(2.0 * x)));
            	else
            		tmp = Float64(sqrt(Float64(Float64(Float64(Float64(2.0 * x) * x) * 2.0) * pi)) / pi);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x)
            	t_0 = (abs(x) * abs(x)) * abs(x);
            	t_1 = 1.0 / sqrt(pi);
            	t_2 = (t_0 * abs(x)) * abs(x);
            	tmp = 0.0;
            	if (abs((t_1 * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * abs(x)) * abs(x)))))) <= 2e-8)
            		tmp = t_1 * abs((2.0 * x));
            	else
            		tmp = sqrt(((((2.0 * x) * x) * 2.0) * pi)) / pi;
            	end
            	tmp_2 = tmp;
            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[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[N[(t$95$1 * 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$2), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$2 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2e-8], N[(t$95$1 * N[Abs[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(2.0 * x), $MachinePrecision] * x), $MachinePrecision] * 2.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]]]]]
            
            \begin{array}{l}
            t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
            t_1 := \frac{1}{\sqrt{\pi}}\\
            t_2 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
            \mathbf{if}\;\left|t\_1 \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_2\right) + \frac{1}{21} \cdot \left(\left(t\_2 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \leq 2 \cdot 10^{-8}:\\
            \;\;\;\;t\_1 \cdot \left|2 \cdot x\right|\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\sqrt{\left(\left(\left(2 \cdot x\right) \cdot x\right) \cdot 2\right) \cdot \pi}}{\pi}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) < 2e-8

              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. Applied rewrites99.8%

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

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

                \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
              5. Step-by-step derivation
                1. Applied rewrites67.7%

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

                    \[\leadsto \color{blue}{\frac{\left|x \cdot 2\right| \cdot \sqrt{\pi}}{\pi}} \]
                  2. lift-*.f64N/A

                    \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right| \cdot \sqrt{\pi}}}{\pi} \]
                  3. associate-/l*N/A

                    \[\leadsto \color{blue}{\left|x \cdot 2\right| \cdot \frac{\sqrt{\pi}}{\pi}} \]
                  4. lift-sqrt.f64N/A

                    \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{\sqrt{\pi}}}{\pi} \]
                  5. pow1/2N/A

                    \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{{\pi}^{\frac{1}{2}}}}{\pi} \]
                  6. unpow1N/A

                    \[\leadsto \left|x \cdot 2\right| \cdot \frac{{\pi}^{\frac{1}{2}}}{\color{blue}{{\pi}^{1}}} \]
                  7. pow-divN/A

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

                    \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\frac{-1}{2}}} \]
                  9. metadata-evalN/A

                    \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
                  10. pow-flipN/A

                    \[\leadsto \left|x \cdot 2\right| \cdot \color{blue}{\frac{1}{{\pi}^{\frac{1}{2}}}} \]
                  11. pow1/2N/A

                    \[\leadsto \left|x \cdot 2\right| \cdot \frac{1}{\color{blue}{\sqrt{\pi}}} \]
                  12. lift-PI.f64N/A

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

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

                if 2e-8 < (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x))))))

                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. Applied rewrites99.8%

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

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

                  \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
                5. Step-by-step derivation
                  1. Applied rewrites67.7%

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

                      \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right| \cdot \sqrt{\pi}}}{\pi} \]
                    2. lift-fabs.f64N/A

                      \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right|} \cdot \sqrt{\pi}}{\pi} \]
                    3. rem-sqrt-square-revN/A

                      \[\leadsto \frac{\color{blue}{\sqrt{\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)}} \cdot \sqrt{\pi}}{\pi} \]
                    4. lift-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)} \cdot \color{blue}{\sqrt{\pi}}}{\pi} \]
                    5. sqrt-unprodN/A

                      \[\leadsto \frac{\color{blue}{\sqrt{\left(\left(x \cdot 2\right) \cdot \left(x \cdot 2\right)\right) \cdot \pi}}}{\pi} \]
                  3. Applied rewrites52.9%

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

                Alternative 12: 67.9% accurate, 7.2× speedup?

                \[\frac{1}{\sqrt{\pi}} \cdot \left|2 \cdot x\right| \]
                (FPCore (x) :precision binary64 (* (/ 1.0 (sqrt PI)) (fabs (* 2.0 x))))
                double code(double x) {
                	return (1.0 / sqrt(((double) M_PI))) * fabs((2.0 * x));
                }
                
                public static double code(double x) {
                	return (1.0 / Math.sqrt(Math.PI)) * Math.abs((2.0 * x));
                }
                
                def code(x):
                	return (1.0 / math.sqrt(math.pi)) * math.fabs((2.0 * x))
                
                function code(x)
                	return Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(2.0 * x)))
                end
                
                function tmp = code(x)
                	tmp = (1.0 / sqrt(pi)) * abs((2.0 * x));
                end
                
                code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                
                \frac{1}{\sqrt{\pi}} \cdot \left|2 \cdot x\right|
                
                Derivation
                1. Initial program 99.8%

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

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

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

                  \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
                5. Step-by-step derivation
                  1. Applied rewrites67.7%

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

                      \[\leadsto \color{blue}{\frac{\left|x \cdot 2\right| \cdot \sqrt{\pi}}{\pi}} \]
                    2. lift-*.f64N/A

                      \[\leadsto \frac{\color{blue}{\left|x \cdot 2\right| \cdot \sqrt{\pi}}}{\pi} \]
                    3. associate-/l*N/A

                      \[\leadsto \color{blue}{\left|x \cdot 2\right| \cdot \frac{\sqrt{\pi}}{\pi}} \]
                    4. lift-sqrt.f64N/A

                      \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{\sqrt{\pi}}}{\pi} \]
                    5. pow1/2N/A

                      \[\leadsto \left|x \cdot 2\right| \cdot \frac{\color{blue}{{\pi}^{\frac{1}{2}}}}{\pi} \]
                    6. unpow1N/A

                      \[\leadsto \left|x \cdot 2\right| \cdot \frac{{\pi}^{\frac{1}{2}}}{\color{blue}{{\pi}^{1}}} \]
                    7. pow-divN/A

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

                      \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\frac{-1}{2}}} \]
                    9. metadata-evalN/A

                      \[\leadsto \left|x \cdot 2\right| \cdot {\pi}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
                    10. pow-flipN/A

                      \[\leadsto \left|x \cdot 2\right| \cdot \color{blue}{\frac{1}{{\pi}^{\frac{1}{2}}}} \]
                    11. pow1/2N/A

                      \[\leadsto \left|x \cdot 2\right| \cdot \frac{1}{\color{blue}{\sqrt{\pi}}} \]
                    12. lift-PI.f64N/A

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

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

                  Alternative 13: 67.5% accurate, 8.3× speedup?

                  \[\frac{\left|x \cdot 2\right| \cdot 1.772453850905516}{\pi} \]
                  (FPCore (x) :precision binary64 (/ (* (fabs (* x 2.0)) 1.772453850905516) PI))
                  double code(double x) {
                  	return (fabs((x * 2.0)) * 1.772453850905516) / ((double) M_PI);
                  }
                  
                  public static double code(double x) {
                  	return (Math.abs((x * 2.0)) * 1.772453850905516) / Math.PI;
                  }
                  
                  def code(x):
                  	return (math.fabs((x * 2.0)) * 1.772453850905516) / math.pi
                  
                  function code(x)
                  	return Float64(Float64(abs(Float64(x * 2.0)) * 1.772453850905516) / pi)
                  end
                  
                  function tmp = code(x)
                  	tmp = (abs((x * 2.0)) * 1.772453850905516) / pi;
                  end
                  
                  code[x_] := N[(N[(N[Abs[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] * 1.772453850905516), $MachinePrecision] / Pi), $MachinePrecision]
                  
                  \frac{\left|x \cdot 2\right| \cdot 1.772453850905516}{\pi}
                  
                  Derivation
                  1. Initial program 99.8%

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

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

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

                    \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
                  5. Step-by-step derivation
                    1. Applied rewrites67.7%

                      \[\leadsto \frac{\left|x \cdot \color{blue}{2}\right| \cdot \sqrt{\pi}}{\pi} \]
                    2. Evaluated real constant67.5%

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

                    Reproduce

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