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

Percentage Accurate: 99.8% → 99.8%
Time: 6.0s
Alternatives: 15
Speedup: 2.2×

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 15 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.7× speedup?

\[\frac{1}{\sqrt{\pi}} \cdot \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| \]
(FPCore (x)
 :precision binary64
 (*
  (/ 1.0 (sqrt PI))
  (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)))))))
double code(double x) {
	return (1.0 / sqrt(((double) M_PI))) * 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)))));
}
function code(x)
	return Float64(Float64(1.0 / sqrt(pi)) * 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))))))
end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * 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]), $MachinePrecision]
\frac{1}{\sqrt{\pi}} \cdot \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|
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.8%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
  4. Add Preprocessing

Alternative 3: 99.8% accurate, 1.9× speedup?

\[\frac{1}{\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| \]
(FPCore (x)
 :precision binary64
 (*
  (/ 1.0 (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))))
double code(double x) {
	return (1.0 / 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));
}
function code(x)
	return Float64(Float64(1.0 / 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)))
end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $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]
\frac{1}{\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|
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.8%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{x \cdot \mathsf{fma}\left(\frac{1}{21} \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 \frac{1}{5}\right) \cdot x, x, \mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right)\right)\right)}\right| \]
    2. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\mathsf{fma}\left(\frac{1}{21} \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 \frac{1}{5}\right) \cdot x, x, \mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right)\right)\right) \cdot x}\right| \]
    3. lower-*.f6499.8%

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\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) \cdot x}\right| \]
  5. Applied rewrites99.8%

    \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \color{blue}{\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|} \]
  6. Add Preprocessing

Alternative 4: 99.8% accurate, 2.2× speedup?

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{x \cdot \mathsf{fma}\left(\frac{1}{21} \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 \frac{1}{5}\right) \cdot x, x, \mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right)\right)\right)}\right| \]
    2. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\mathsf{fma}\left(\frac{1}{21} \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 \frac{1}{5}\right) \cdot x, x, \mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right)\right)\right) \cdot x}\right| \]
    3. lower-*.f6499.8%

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\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) \cdot x}\right| \]
  5. Applied rewrites99.8%

    \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \color{blue}{\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|} \]
  6. Applied rewrites99.8%

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

Alternative 5: 99.4% accurate, 2.4× speedup?

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{x \cdot \mathsf{fma}\left(\frac{1}{21} \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 \frac{1}{5}\right) \cdot x, x, \mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right)\right)\right)}\right| \]
    2. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\mathsf{fma}\left(\frac{1}{21} \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 \frac{1}{5}\right) \cdot x, x, \mathsf{fma}\left(\frac{2}{3}, x \cdot x, 2\right)\right)\right) \cdot x}\right| \]
    3. lower-*.f6499.8%

      \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \left|\color{blue}{\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) \cdot x}\right| \]
  5. Applied rewrites99.8%

    \[\leadsto \frac{1}{\sqrt{\pi}} \cdot \color{blue}{\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|} \]
  6. Applied rewrites99.4%

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

Alternative 6: 99.0% accurate, 2.1× speedup?

\[\begin{array}{l} t_0 := \left|x\right| \cdot \left|x\right|\\ \mathbf{if}\;\left|x\right| \leq 170:\\ \;\;\;\;\frac{\left|\left|x\right| \cdot \left(\left(0.2 \cdot \left(t\_0 \cdot \left|x\right|\right)\right) \cdot \left|x\right| + \mathsf{fma}\left(0.6666666666666666, t\_0, 2\right)\right)\right|}{\sqrt{\pi}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|0.047619047619047616 \cdot \left({\left(\left|x\right|\right)}^{6} \cdot \left|\left|x\right|\right|\right)\right|}{\sqrt{\pi}}\\ \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (* (fabs x) (fabs x))))
   (if (<= (fabs x) 170.0)
     (/
      (fabs
       (*
        (fabs x)
        (+
         (* (* 0.2 (* t_0 (fabs x))) (fabs x))
         (fma 0.6666666666666666 t_0 2.0))))
      (sqrt PI))
     (/
      (fabs (* 0.047619047619047616 (* (pow (fabs x) 6.0) (fabs (fabs x)))))
      (sqrt PI)))))
double code(double x) {
	double t_0 = fabs(x) * fabs(x);
	double tmp;
	if (fabs(x) <= 170.0) {
		tmp = fabs((fabs(x) * (((0.2 * (t_0 * fabs(x))) * fabs(x)) + fma(0.6666666666666666, t_0, 2.0)))) / sqrt(((double) M_PI));
	} else {
		tmp = fabs((0.047619047619047616 * (pow(fabs(x), 6.0) * fabs(fabs(x))))) / sqrt(((double) M_PI));
	}
	return tmp;
}
function code(x)
	t_0 = Float64(abs(x) * abs(x))
	tmp = 0.0
	if (abs(x) <= 170.0)
		tmp = Float64(abs(Float64(abs(x) * Float64(Float64(Float64(0.2 * Float64(t_0 * abs(x))) * abs(x)) + fma(0.6666666666666666, t_0, 2.0)))) / sqrt(pi));
	else
		tmp = Float64(abs(Float64(0.047619047619047616 * Float64((abs(x) ^ 6.0) * abs(abs(x))))) / sqrt(pi));
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 170.0], N[(N[Abs[N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(0.2 * N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 * t$95$0 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision], N[(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] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|x\right| \cdot \left|x\right|\\
\mathbf{if}\;\left|x\right| \leq 170:\\
\;\;\;\;\frac{\left|\left|x\right| \cdot \left(\left(0.2 \cdot \left(t\_0 \cdot \left|x\right|\right)\right) \cdot \left|x\right| + \mathsf{fma}\left(0.6666666666666666, t\_0, 2\right)\right)\right|}{\sqrt{\pi}}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 170

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

      \[\leadsto \color{blue}{\frac{\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|}{\sqrt{\pi}}} \]
    3. Taylor expanded in x around 0

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

        \[\leadsto \frac{\left|\mathsf{fma}\left(\left|x\right|, \frac{1}{5} \cdot \color{blue}{{x}^{4}}, \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, \frac{2}{3}, 2\right)\right)\right|}{\sqrt{\pi}} \]
      2. lower-pow.f6493.3%

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

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

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

      if 170 < 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.4%

        \[\leadsto \color{blue}{\frac{\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|}{\sqrt{\pi}}} \]
      3. Taylor expanded in x around inf

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

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

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

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

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

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

    Alternative 7: 98.9% accurate, 2.5× speedup?

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

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

        \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
      4. Taylor expanded in x around 0

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

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

          \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]

        if 170 < 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.4%

          \[\leadsto \color{blue}{\frac{\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|}{\sqrt{\pi}}} \]
        3. Taylor expanded in x around inf

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

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

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

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

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

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

      Alternative 8: 98.9% accurate, 2.8× speedup?

      \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 170:\\ \;\;\;\;0.5641895835477563 \cdot \left|\left|x\right| \cdot 2\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) 170.0)
         (* 0.5641895835477563 (fabs (* (fabs x) 2.0)))
         (/ (fabs (* (pow (fabs (fabs x)) 7.0) 0.047619047619047616)) (sqrt PI))))
      double code(double x) {
      	double tmp;
      	if (fabs(x) <= 170.0) {
      		tmp = 0.5641895835477563 * fabs((fabs(x) * 2.0));
      	} 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) <= 170.0) {
      		tmp = 0.5641895835477563 * Math.abs((Math.abs(x) * 2.0));
      	} 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) <= 170.0:
      		tmp = 0.5641895835477563 * math.fabs((math.fabs(x) * 2.0))
      	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) <= 170.0)
      		tmp = Float64(0.5641895835477563 * abs(Float64(abs(x) * 2.0)));
      	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) <= 170.0)
      		tmp = 0.5641895835477563 * abs((abs(x) * 2.0));
      	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], 170.0], N[(0.5641895835477563 * N[Abs[N[(N[Abs[x], $MachinePrecision] * 2.0), $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 170:\\
      \;\;\;\;0.5641895835477563 \cdot \left|\left|x\right| \cdot 2\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 < 170

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

          \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
        4. Taylor expanded in x around 0

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

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

            \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]

          if 170 < 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.9%

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

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

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

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

              \[\leadsto \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right| \cdot \color{blue}{\frac{1}{\sqrt{\pi}}} \]
            4. mult-flip-revN/A

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

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

            \[\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.9% 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}, 0.047619047619047616, \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.f6499.0%

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

          \[\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 10: 98.9% accurate, 3.0× speedup?

        \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 170:\\ \;\;\;\;0.5641895835477563 \cdot \left|\left|x\right| \cdot 2\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|{\left(\left|\left|x\right|\right|\right)}^{7} \cdot 0.047619047619047616\right|}{1.772453850905516}\\ \end{array} \]
        (FPCore (x)
         :precision binary64
         (if (<= (fabs x) 170.0)
           (* 0.5641895835477563 (fabs (* (fabs x) 2.0)))
           (/
            (fabs (* (pow (fabs (fabs x)) 7.0) 0.047619047619047616))
            1.772453850905516)))
        double code(double x) {
        	double tmp;
        	if (fabs(x) <= 170.0) {
        		tmp = 0.5641895835477563 * fabs((fabs(x) * 2.0));
        	} else {
        		tmp = fabs((pow(fabs(fabs(x)), 7.0) * 0.047619047619047616)) / 1.772453850905516;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8) :: tmp
            if (abs(x) <= 170.0d0) then
                tmp = 0.5641895835477563d0 * abs((abs(x) * 2.0d0))
            else
                tmp = abs(((abs(abs(x)) ** 7.0d0) * 0.047619047619047616d0)) / 1.772453850905516d0
            end if
            code = tmp
        end function
        
        public static double code(double x) {
        	double tmp;
        	if (Math.abs(x) <= 170.0) {
        		tmp = 0.5641895835477563 * Math.abs((Math.abs(x) * 2.0));
        	} else {
        		tmp = Math.abs((Math.pow(Math.abs(Math.abs(x)), 7.0) * 0.047619047619047616)) / 1.772453850905516;
        	}
        	return tmp;
        }
        
        def code(x):
        	tmp = 0
        	if math.fabs(x) <= 170.0:
        		tmp = 0.5641895835477563 * math.fabs((math.fabs(x) * 2.0))
        	else:
        		tmp = math.fabs((math.pow(math.fabs(math.fabs(x)), 7.0) * 0.047619047619047616)) / 1.772453850905516
        	return tmp
        
        function code(x)
        	tmp = 0.0
        	if (abs(x) <= 170.0)
        		tmp = Float64(0.5641895835477563 * abs(Float64(abs(x) * 2.0)));
        	else
        		tmp = Float64(abs(Float64((abs(abs(x)) ^ 7.0) * 0.047619047619047616)) / 1.772453850905516);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x)
        	tmp = 0.0;
        	if (abs(x) <= 170.0)
        		tmp = 0.5641895835477563 * abs((abs(x) * 2.0));
        	else
        		tmp = abs(((abs(abs(x)) ^ 7.0) * 0.047619047619047616)) / 1.772453850905516;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 170.0], N[(0.5641895835477563 * N[Abs[N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(N[Power[N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616), $MachinePrecision]], $MachinePrecision] / 1.772453850905516), $MachinePrecision]]
        
        \begin{array}{l}
        \mathbf{if}\;\left|x\right| \leq 170:\\
        \;\;\;\;0.5641895835477563 \cdot \left|\left|x\right| \cdot 2\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left|{\left(\left|\left|x\right|\right|\right)}^{7} \cdot 0.047619047619047616\right|}{1.772453850905516}\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < 170

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

            \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
          4. Taylor expanded in x around 0

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

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

              \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]

            if 170 < 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.9%

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

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

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

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

                \[\leadsto \left|\frac{1}{21} \cdot \left({x}^{6} \cdot \left|x\right|\right)\right| \cdot \color{blue}{\frac{1}{\sqrt{\pi}}} \]
              4. mult-flip-revN/A

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

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

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

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

          Alternative 11: 98.5% 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{\pi}}}\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.5%

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

            \[\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 12: 93.3% accurate, 2.9× speedup?

          \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 600:\\ \;\;\;\;0.5641895835477563 \cdot \left|\left|x\right| \cdot 2\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(0.2 \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) \cdot \left|x\right|\right) \cdot \frac{\left|\left|x\right|\right|}{1.772453850905516}\right|\\ \end{array} \]
          (FPCore (x)
           :precision binary64
           (if (<= (fabs x) 600.0)
             (* 0.5641895835477563 (fabs (* (fabs x) 2.0)))
             (fabs
              (*
               (* (* 0.2 (* (* (fabs x) (fabs x)) (fabs x))) (fabs x))
               (/ (fabs (fabs x)) 1.772453850905516)))))
          double code(double x) {
          	double tmp;
          	if (fabs(x) <= 600.0) {
          		tmp = 0.5641895835477563 * fabs((fabs(x) * 2.0));
          	} else {
          		tmp = fabs((((0.2 * ((fabs(x) * fabs(x)) * fabs(x))) * fabs(x)) * (fabs(fabs(x)) / 1.772453850905516)));
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8) :: tmp
              if (abs(x) <= 600.0d0) then
                  tmp = 0.5641895835477563d0 * abs((abs(x) * 2.0d0))
              else
                  tmp = abs((((0.2d0 * ((abs(x) * abs(x)) * abs(x))) * abs(x)) * (abs(abs(x)) / 1.772453850905516d0)))
              end if
              code = tmp
          end function
          
          public static double code(double x) {
          	double tmp;
          	if (Math.abs(x) <= 600.0) {
          		tmp = 0.5641895835477563 * Math.abs((Math.abs(x) * 2.0));
          	} else {
          		tmp = Math.abs((((0.2 * ((Math.abs(x) * Math.abs(x)) * Math.abs(x))) * Math.abs(x)) * (Math.abs(Math.abs(x)) / 1.772453850905516)));
          	}
          	return tmp;
          }
          
          def code(x):
          	tmp = 0
          	if math.fabs(x) <= 600.0:
          		tmp = 0.5641895835477563 * math.fabs((math.fabs(x) * 2.0))
          	else:
          		tmp = math.fabs((((0.2 * ((math.fabs(x) * math.fabs(x)) * math.fabs(x))) * math.fabs(x)) * (math.fabs(math.fabs(x)) / 1.772453850905516)))
          	return tmp
          
          function code(x)
          	tmp = 0.0
          	if (abs(x) <= 600.0)
          		tmp = Float64(0.5641895835477563 * abs(Float64(abs(x) * 2.0)));
          	else
          		tmp = abs(Float64(Float64(Float64(0.2 * Float64(Float64(abs(x) * abs(x)) * abs(x))) * abs(x)) * Float64(abs(abs(x)) / 1.772453850905516)));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x)
          	tmp = 0.0;
          	if (abs(x) <= 600.0)
          		tmp = 0.5641895835477563 * abs((abs(x) * 2.0));
          	else
          		tmp = abs((((0.2 * ((abs(x) * abs(x)) * abs(x))) * abs(x)) * (abs(abs(x)) / 1.772453850905516)));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 600.0], N[(0.5641895835477563 * N[Abs[N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(N[(0.2 * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision] / 1.772453850905516), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
          
          \begin{array}{l}
          \mathbf{if}\;\left|x\right| \leq 600:\\
          \;\;\;\;0.5641895835477563 \cdot \left|\left|x\right| \cdot 2\right|\\
          
          \mathbf{else}:\\
          \;\;\;\;\left|\left(\left(0.2 \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) \cdot \left|x\right|\right) \cdot \frac{\left|\left|x\right|\right|}{1.772453850905516}\right|\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 600

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

              \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
            4. Taylor expanded in x around 0

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

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

                \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]

              if 600 < 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{\pi}}}\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.4%

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

                \[\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. lift-*.f64N/A

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

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

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

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

                  \[\leadsto \left|\frac{1}{5} \cdot \left(\left({x}^{3} \cdot x\right) \cdot \frac{\color{blue}{\left|x\right|}}{\sqrt{\pi}}\right)\right| \]
                8. pow3N/A

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

                  \[\leadsto \left|\frac{1}{5} \cdot \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right)\right| \]
                10. lift-*.f64N/A

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

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

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

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

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

            Alternative 13: 83.6% accurate, 3.3× speedup?

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

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

                \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
              4. Taylor expanded in x around 0

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

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

                  \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]

                if 1.9999999999999999e-11 < 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.8%

                  \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
                4. Taylor expanded in x around 0

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

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

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

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

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

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

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

                Alternative 14: 83.6% accurate, 4.2× speedup?

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

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

                    \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
                  4. Taylor expanded in x around 0

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

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

                      \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]

                    if 9.9999999999999998e-13 < 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.8%

                      \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
                    4. Taylor expanded in x around 0

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

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

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

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

                          \[\leadsto \left|x \cdot 2\right| \cdot \color{blue}{\frac{1}{\sqrt{\pi}}} \]
                        4. mult-flip-revN/A

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

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

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

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

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

                    Alternative 15: 67.8% accurate, 11.7× speedup?

                    \[0.5641895835477563 \cdot \left|x \cdot 2\right| \]
                    (FPCore (x) :precision binary64 (* 0.5641895835477563 (fabs (* x 2.0))))
                    double code(double x) {
                    	return 0.5641895835477563 * fabs((x * 2.0));
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(x)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        code = 0.5641895835477563d0 * abs((x * 2.0d0))
                    end function
                    
                    public static double code(double x) {
                    	return 0.5641895835477563 * Math.abs((x * 2.0));
                    }
                    
                    def code(x):
                    	return 0.5641895835477563 * math.fabs((x * 2.0))
                    
                    function code(x)
                    	return Float64(0.5641895835477563 * abs(Float64(x * 2.0)))
                    end
                    
                    function tmp = code(x)
                    	tmp = 0.5641895835477563 * abs((x * 2.0));
                    end
                    
                    code[x_] := N[(0.5641895835477563 * N[Abs[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                    
                    0.5641895835477563 \cdot \left|x \cdot 2\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.8%

                      \[\leadsto \color{blue}{\frac{1}{\sqrt{\pi}} \cdot \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|} \]
                    4. Taylor expanded in x around 0

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

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

                        \[\leadsto \color{blue}{0.5641895835477563} \cdot \left|x \cdot 2\right| \]
                      3. Add Preprocessing

                      Reproduce

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