
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
(* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x)))))) end
function tmp = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
(* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x)))))) end
function tmp = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(fabs
(*
(* (/ 1.0 (sqrt PI)) (fabs x))
(fma
(* 0.047619047619047616 (* (* (* (* x x) x) x) x))
x
(fma (* (* 0.2 (* x x)) x) x (fma 0.6666666666666666 (* x x) 2.0))))))
double code(double x) {
return fabs((((1.0 / sqrt(((double) M_PI))) * fabs(x)) * fma((0.047619047619047616 * ((((x * x) * x) * x) * x)), x, fma(((0.2 * (x * x)) * x), x, fma(0.6666666666666666, (x * x), 2.0)))));
}
function code(x) return abs(Float64(Float64(Float64(1.0 / sqrt(pi)) * abs(x)) * fma(Float64(0.047619047619047616 * Float64(Float64(Float64(Float64(x * x) * x) * x) * x)), x, fma(Float64(Float64(0.2 * Float64(x * x)) * x), x, fma(0.6666666666666666, Float64(x * x), 2.0))))) end
code[x_] := N[Abs[N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(N[(0.047619047619047616 * N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * x + N[(N[(N[(0.2 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x + N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\frac{1}{\sqrt{\pi}} \cdot \left|x\right|\right) \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(0.2 \cdot \left(x \cdot x\right)\right) \cdot x, x, \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(/
(fabs
(fma
(pow (fabs x) 7.0)
0.047619047619047616
(*
(fabs x)
(fma (* (* 0.2 (* x x)) x) x (fma 0.6666666666666666 (* x x) 2.0)))))
(sqrt PI)))
double code(double x) {
return fabs(fma(pow(fabs(x), 7.0), 0.047619047619047616, (fabs(x) * fma(((0.2 * (x * x)) * x), x, fma(0.6666666666666666, (x * x), 2.0))))) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(fma((abs(x) ^ 7.0), 0.047619047619047616, Float64(abs(x) * fma(Float64(Float64(0.2 * Float64(x * x)) * x), x, fma(0.6666666666666666, Float64(x * x), 2.0))))) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616 + N[(N[Abs[x], $MachinePrecision] * N[(N[(N[(0.2 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x + N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|\mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, \left|x\right| \cdot \mathsf{fma}\left(\left(0.2 \cdot \left(x \cdot x\right)\right) \cdot x, x, \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites99.9%
Applied rewrites99.4%
(FPCore (x)
:precision binary64
(fabs
(/
(*
(fma
(* 0.047619047619047616 (* x x))
(* (* (* x x) x) x)
(fma (* x x) (fma (* 0.2 x) x 0.6666666666666666) 2.0))
(fabs x))
(sqrt PI))))
double code(double x) {
return fabs(((fma((0.047619047619047616 * (x * x)), (((x * x) * x) * x), fma((x * x), fma((0.2 * x), x, 0.6666666666666666), 2.0)) * fabs(x)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(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)) * abs(x)) / sqrt(pi))) end
code[x_] := N[Abs[N[(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] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\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 \left|x\right|}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.4%
(FPCore (x)
:precision binary64
(if (<= x 2.2)
(fabs
(*
(/ 1.0 (sqrt PI))
(+ (fabs x) (+ (fabs x) (* (* 0.6666666666666666 (fabs x)) (* x x))))))
(fabs (* 0.047619047619047616 (/ (* (pow x 6.0) (fabs x)) (sqrt PI))))))
double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) + (fabs(x) + ((0.6666666666666666 * fabs(x)) * (x * x))))));
} else {
tmp = fabs((0.047619047619047616 * ((pow(x, 6.0) * fabs(x)) / sqrt(((double) M_PI)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) + (Math.abs(x) + ((0.6666666666666666 * Math.abs(x)) * (x * x))))));
} else {
tmp = Math.abs((0.047619047619047616 * ((Math.pow(x, 6.0) * Math.abs(x)) / Math.sqrt(Math.PI))));
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.2: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) + (math.fabs(x) + ((0.6666666666666666 * math.fabs(x)) * (x * x)))))) else: tmp = math.fabs((0.047619047619047616 * ((math.pow(x, 6.0) * math.fabs(x)) / math.sqrt(math.pi)))) return tmp
function code(x) tmp = 0.0 if (x <= 2.2) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) + Float64(abs(x) + Float64(Float64(0.6666666666666666 * abs(x)) * Float64(x * x)))))); else tmp = abs(Float64(0.047619047619047616 * Float64(Float64((x ^ 6.0) * abs(x)) / sqrt(pi)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.2) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) + (abs(x) + ((0.6666666666666666 * abs(x)) * (x * x)))))); else tmp = abs((0.047619047619047616 * (((x ^ 6.0) * abs(x)) / sqrt(pi)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.2], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] + N[(N[(0.6666666666666666 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(0.047619047619047616 * N[(N[(N[Power[x, 6.0], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| + \left(\left|x\right| + \left(0.6666666666666666 \cdot \left|x\right|\right) \cdot \left(x \cdot x\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|0.047619047619047616 \cdot \frac{{x}^{6} \cdot \left|x\right|}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
count-2-revN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.6
Applied rewrites37.6%
(FPCore (x)
:precision binary64
(if (<= x 2.2)
(fabs
(*
(/ 1.0 (sqrt PI))
(+ (fabs x) (+ (fabs x) (* (* 0.6666666666666666 (fabs x)) (* x x))))))
(fabs
(*
0.047619047619047616
(* (* (* (* x x) x) x) (* (* x x) (/ (fabs x) (sqrt PI))))))))
double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) + (fabs(x) + ((0.6666666666666666 * fabs(x)) * (x * x))))));
} else {
tmp = fabs((0.047619047619047616 * ((((x * x) * x) * x) * ((x * x) * (fabs(x) / sqrt(((double) M_PI)))))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) + (Math.abs(x) + ((0.6666666666666666 * Math.abs(x)) * (x * x))))));
} else {
tmp = Math.abs((0.047619047619047616 * ((((x * x) * x) * x) * ((x * x) * (Math.abs(x) / Math.sqrt(Math.PI))))));
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.2: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) + (math.fabs(x) + ((0.6666666666666666 * math.fabs(x)) * (x * x)))))) else: tmp = math.fabs((0.047619047619047616 * ((((x * x) * x) * x) * ((x * x) * (math.fabs(x) / math.sqrt(math.pi)))))) return tmp
function code(x) tmp = 0.0 if (x <= 2.2) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) + Float64(abs(x) + Float64(Float64(0.6666666666666666 * abs(x)) * Float64(x * x)))))); else tmp = abs(Float64(0.047619047619047616 * Float64(Float64(Float64(Float64(x * x) * x) * x) * Float64(Float64(x * x) * Float64(abs(x) / sqrt(pi)))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.2) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) + (abs(x) + ((0.6666666666666666 * abs(x)) * (x * x)))))); else tmp = abs((0.047619047619047616 * ((((x * x) * x) * x) * ((x * x) * (abs(x) / sqrt(pi)))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.2], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] + N[(N[(0.6666666666666666 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(0.047619047619047616 * N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| + \left(\left|x\right| + \left(0.6666666666666666 \cdot \left|x\right|\right) \cdot \left(x \cdot x\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|0.047619047619047616 \cdot \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right)\right)\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
count-2-revN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.6
Applied rewrites37.6%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow3N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
mult-flipN/A
Applied rewrites37.6%
(FPCore (x)
:precision binary64
(if (<= x 2.2)
(fabs
(*
(/ 1.0 (sqrt PI))
(+ (fabs x) (+ (fabs x) (* (* 0.6666666666666666 (fabs x)) (* x x))))))
(fabs
(*
(*
(/ (fabs x) (sqrt PI))
(* (* (* (* (* x x) x) x) x) 0.047619047619047616))
x))))
double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) + (fabs(x) + ((0.6666666666666666 * fabs(x)) * (x * x))))));
} else {
tmp = fabs((((fabs(x) / sqrt(((double) M_PI))) * (((((x * x) * x) * x) * x) * 0.047619047619047616)) * x));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) + (Math.abs(x) + ((0.6666666666666666 * Math.abs(x)) * (x * x))))));
} else {
tmp = Math.abs((((Math.abs(x) / Math.sqrt(Math.PI)) * (((((x * x) * x) * x) * x) * 0.047619047619047616)) * x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.2: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) + (math.fabs(x) + ((0.6666666666666666 * math.fabs(x)) * (x * x)))))) else: tmp = math.fabs((((math.fabs(x) / math.sqrt(math.pi)) * (((((x * x) * x) * x) * x) * 0.047619047619047616)) * x)) return tmp
function code(x) tmp = 0.0 if (x <= 2.2) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) + Float64(abs(x) + Float64(Float64(0.6666666666666666 * abs(x)) * Float64(x * x)))))); else tmp = abs(Float64(Float64(Float64(abs(x) / sqrt(pi)) * Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * x) * 0.047619047619047616)) * x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.2) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) + (abs(x) + ((0.6666666666666666 * abs(x)) * (x * x)))))); else tmp = abs((((abs(x) / sqrt(pi)) * (((((x * x) * x) * x) * x) * 0.047619047619047616)) * x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.2], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] + N[(N[(0.6666666666666666 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Abs[x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| + \left(\left|x\right| + \left(0.6666666666666666 \cdot \left|x\right|\right) \cdot \left(x \cdot x\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\frac{\left|x\right|}{\sqrt{\pi}} \cdot \left(\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot 0.047619047619047616\right)\right) \cdot x\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
count-2-revN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow3N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites37.6%
(FPCore (x)
:precision binary64
(if (<= x 2.2)
(fabs
(*
(/ 1.0 (sqrt PI))
(+ (fabs x) (+ (fabs x) (* (* 0.6666666666666666 (fabs x)) (* x x))))))
(fabs
(*
(* (* (* (* (* (* x x) x) x) x) x) (/ (fabs x) (sqrt PI)))
0.047619047619047616))))
double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) + (fabs(x) + ((0.6666666666666666 * fabs(x)) * (x * x))))));
} else {
tmp = fabs((((((((x * x) * x) * x) * x) * x) * (fabs(x) / sqrt(((double) M_PI)))) * 0.047619047619047616));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) + (Math.abs(x) + ((0.6666666666666666 * Math.abs(x)) * (x * x))))));
} else {
tmp = Math.abs((((((((x * x) * x) * x) * x) * x) * (Math.abs(x) / Math.sqrt(Math.PI))) * 0.047619047619047616));
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.2: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) + (math.fabs(x) + ((0.6666666666666666 * math.fabs(x)) * (x * x)))))) else: tmp = math.fabs((((((((x * x) * x) * x) * x) * x) * (math.fabs(x) / math.sqrt(math.pi))) * 0.047619047619047616)) return tmp
function code(x) tmp = 0.0 if (x <= 2.2) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) + Float64(abs(x) + Float64(Float64(0.6666666666666666 * abs(x)) * Float64(x * x)))))); else tmp = abs(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * x) * x) * Float64(abs(x) / sqrt(pi))) * 0.047619047619047616)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.2) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) + (abs(x) + ((0.6666666666666666 * abs(x)) * (x * x)))))); else tmp = abs((((((((x * x) * x) * x) * x) * x) * (abs(x) / sqrt(pi))) * 0.047619047619047616)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.2], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] + N[(N[(0.6666666666666666 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| + \left(\left|x\right| + \left(0.6666666666666666 \cdot \left|x\right|\right) \cdot \left(x \cdot x\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\left(\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right) \cdot 0.047619047619047616\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
count-2-revN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6437.6
Applied rewrites37.6%
(FPCore (x)
:precision binary64
(if (<= x 2.2)
(fabs
(*
(/ 1.0 (sqrt PI))
(+ (fabs x) (+ (fabs x) (* (* 0.6666666666666666 (fabs x)) (* x x))))))
(fabs
(*
(* (* (* (* (* (* x x) x) x) x) x) 0.047619047619047616)
(/ (fabs x) (sqrt PI))))))
double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) + (fabs(x) + ((0.6666666666666666 * fabs(x)) * (x * x))))));
} else {
tmp = fabs((((((((x * x) * x) * x) * x) * x) * 0.047619047619047616) * (fabs(x) / sqrt(((double) M_PI)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2.2) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) + (Math.abs(x) + ((0.6666666666666666 * Math.abs(x)) * (x * x))))));
} else {
tmp = Math.abs((((((((x * x) * x) * x) * x) * x) * 0.047619047619047616) * (Math.abs(x) / Math.sqrt(Math.PI))));
}
return tmp;
}
def code(x): tmp = 0 if x <= 2.2: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) + (math.fabs(x) + ((0.6666666666666666 * math.fabs(x)) * (x * x)))))) else: tmp = math.fabs((((((((x * x) * x) * x) * x) * x) * 0.047619047619047616) * (math.fabs(x) / math.sqrt(math.pi)))) return tmp
function code(x) tmp = 0.0 if (x <= 2.2) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) + Float64(abs(x) + Float64(Float64(0.6666666666666666 * abs(x)) * Float64(x * x)))))); else tmp = abs(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * x) * x) * 0.047619047619047616) * Float64(abs(x) / sqrt(pi)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2.2) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) + (abs(x) + ((0.6666666666666666 * abs(x)) * (x * x)))))); else tmp = abs((((((((x * x) * x) * x) * x) * x) * 0.047619047619047616) * (abs(x) / sqrt(pi)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2.2], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] + N[(N[(0.6666666666666666 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 0.047619047619047616), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| + \left(\left|x\right| + \left(0.6666666666666666 \cdot \left|x\right|\right) \cdot \left(x \cdot x\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\left(\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot 0.047619047619047616\right) \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
count-2-revN/A
associate-+l+N/A
lower-+.f64N/A
lower-+.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.6
Applied rewrites37.6%
Applied rewrites37.6%
(FPCore (x)
:precision binary64
(/
(fabs
(fma
(fabs x)
2.0
(*
(*
x
(fma
(* 0.2 (* x x))
x
(* (* (* (* (* x x) x) x) x) 0.047619047619047616)))
(fabs x))))
(sqrt PI)))
double code(double x) {
return fabs(fma(fabs(x), 2.0, ((x * fma((0.2 * (x * x)), x, (((((x * x) * x) * x) * x) * 0.047619047619047616))) * fabs(x)))) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(fma(abs(x), 2.0, Float64(Float64(x * fma(Float64(0.2 * Float64(x * x)), x, Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * x) * 0.047619047619047616))) * abs(x)))) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(N[Abs[x], $MachinePrecision] * 2.0 + N[(N[(x * N[(N[(0.2 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|\mathsf{fma}\left(\left|x\right|, 2, \left(x \cdot \mathsf{fma}\left(0.2 \cdot \left(x \cdot x\right), x, \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot 0.047619047619047616\right)\right) \cdot \left|x\right|\right)\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites98.5%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.5
Applied rewrites98.6%
(FPCore (x)
:precision binary64
(/
(fabs
(*
(fma
x
(fma (* 0.2 (* x x)) x (* (* (* (* (* x x) x) x) x) 0.047619047619047616))
2.0)
(fabs x)))
(sqrt PI)))
double code(double x) {
return fabs((fma(x, fma((0.2 * (x * x)), x, (((((x * x) * x) * x) * x) * 0.047619047619047616)), 2.0) * fabs(x))) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(Float64(fma(x, fma(Float64(0.2 * Float64(x * x)), x, Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * x) * 0.047619047619047616)), 2.0) * abs(x))) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(N[(x * N[(N[(0.2 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|\mathsf{fma}\left(x, \mathsf{fma}\left(0.2 \cdot \left(x \cdot x\right), x, \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot 0.047619047619047616\right), 2\right) \cdot \left|x\right|\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites98.5%
Applied rewrites98.6%
(FPCore (x)
:precision binary64
(fabs
(/
(*
(fma
(* 0.047619047619047616 (* x x))
(* (* (* x x) x) x)
(fma (* x x) 0.6666666666666666 2.0))
(fabs x))
(sqrt PI))))
double code(double x) {
return fabs(((fma((0.047619047619047616 * (x * x)), (((x * x) * x) * x), fma((x * x), 0.6666666666666666, 2.0)) * fabs(x)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(Float64(0.047619047619047616 * Float64(x * x)), Float64(Float64(Float64(x * x) * x) * x), fma(Float64(x * x), 0.6666666666666666, 2.0)) * abs(x)) / sqrt(pi))) end
code[x_] := N[Abs[N[(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] * 0.6666666666666666 + 2.0), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\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, 0.6666666666666666, 2\right)\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites98.6%
(FPCore (x) :precision binary64 (/ (fabs (* (fma 0.6666666666666666 (sqrt (* (* (* x x) x) x)) 2.0) (fabs x))) (sqrt PI)))
double code(double x) {
return fabs((fma(0.6666666666666666, sqrt((((x * x) * x) * x)), 2.0) * fabs(x))) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(Float64(fma(0.6666666666666666, sqrt(Float64(Float64(Float64(x * x) * x) * x)), 2.0) * abs(x))) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(N[(0.6666666666666666 * N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|\mathsf{fma}\left(0.6666666666666666, \sqrt{\left(\left(x \cdot x\right) \cdot x\right) \cdot x}, 2\right) \cdot \left|x\right|\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites88.4%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-sqrt.f6491.1
Applied rewrites91.1%
(FPCore (x) :precision binary64 (fabs (* (/ 1.0 (sqrt PI)) (fma (* (fabs x) x) (* 0.6666666666666666 x) (* 2.0 (fabs x))))))
double code(double x) {
return fabs(((1.0 / sqrt(((double) M_PI))) * fma((fabs(x) * x), (0.6666666666666666 * x), (2.0 * fabs(x)))));
}
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * fma(Float64(abs(x) * x), Float64(0.6666666666666666 * x), Float64(2.0 * abs(x))))) end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[x], $MachinePrecision] * x), $MachinePrecision] * N[(0.6666666666666666 * x), $MachinePrecision] + N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(\left|x\right| \cdot x, 0.6666666666666666 \cdot x, 2 \cdot \left|x\right|\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
(FPCore (x) :precision binary64 (fabs (/ 1.0 (/ (sqrt PI) (* (fma 0.6666666666666666 (* x x) 2.0) (fabs x))))))
double code(double x) {
return fabs((1.0 / (sqrt(((double) M_PI)) / (fma(0.6666666666666666, (x * x), 2.0) * fabs(x)))));
}
function code(x) return abs(Float64(1.0 / Float64(sqrt(pi) / Float64(fma(0.6666666666666666, Float64(x * x), 2.0) * abs(x))))) end
code[x_] := N[Abs[N[(1.0 / N[(N[Sqrt[Pi], $MachinePrecision] / N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\frac{\sqrt{\pi}}{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) \cdot \left|x\right|}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-/.f64N/A
Applied rewrites88.4%
(FPCore (x) :precision binary64 (/ (fabs (* (fma 0.6666666666666666 (* x x) 2.0) (fabs x))) (sqrt PI)))
double code(double x) {
return fabs((fma(0.6666666666666666, (x * x), 2.0) * fabs(x))) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(Float64(fma(0.6666666666666666, Float64(x * x), 2.0) * abs(x))) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) \cdot \left|x\right|\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6488.9
Applied rewrites88.9%
lift-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
Applied rewrites88.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(if (<=
(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))))))
4e-37)
(fabs (* (fabs x) (/ 2.0 (sqrt PI))))
(fabs (* 2.0 (/ (sqrt (* x x)) (sqrt PI)))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
double tmp;
if (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)))))) <= 4e-37) {
tmp = fabs((fabs(x) * (2.0 / sqrt(((double) M_PI)))));
} else {
tmp = fabs((2.0 * (sqrt((x * x)) / sqrt(((double) M_PI)))));
}
return tmp;
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
double tmp;
if (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)))))) <= 4e-37) {
tmp = Math.abs((Math.abs(x) * (2.0 / Math.sqrt(Math.PI))));
} else {
tmp = Math.abs((2.0 * (Math.sqrt((x * x)) / Math.sqrt(Math.PI))));
}
return tmp;
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) tmp = 0 if 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)))))) <= 4e-37: tmp = math.fabs((math.fabs(x) * (2.0 / math.sqrt(math.pi)))) else: tmp = math.fabs((2.0 * (math.sqrt((x * x)) / math.sqrt(math.pi)))) return tmp
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) tmp = 0.0 if (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)))))) <= 4e-37) tmp = abs(Float64(abs(x) * Float64(2.0 / sqrt(pi)))); else tmp = abs(Float64(2.0 * Float64(sqrt(Float64(x * x)) / sqrt(pi)))); end return tmp end
function tmp_2 = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = 0.0; if (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)))))) <= 4e-37) tmp = abs((abs(x) * (2.0 / sqrt(pi)))); else tmp = abs((2.0 * (sqrt((x * x)) / sqrt(pi)))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], 4e-37], N[Abs[N[(N[Abs[x], $MachinePrecision] * N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(2.0 * N[(N[Sqrt[N[(x * x), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\mathbf{if}\;\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| \leq 4 \cdot 10^{-37}:\\
\;\;\;\;\left|\left|x\right| \cdot \frac{2}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|2 \cdot \frac{\sqrt{x \cdot x}}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) < 4.00000000000000027e-37Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6466.5
Applied rewrites66.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6467.0
Applied rewrites67.0%
if 4.00000000000000027e-37 < (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6466.5
Applied rewrites66.5%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lower-sqrt.f6452.3
Applied rewrites52.3%
(FPCore (x) :precision binary64 (fabs (* (fabs x) (/ 2.0 (sqrt PI)))))
double code(double x) {
return fabs((fabs(x) * (2.0 / sqrt(((double) M_PI)))));
}
public static double code(double x) {
return Math.abs((Math.abs(x) * (2.0 / Math.sqrt(Math.PI))));
}
def code(x): return math.fabs((math.fabs(x) * (2.0 / math.sqrt(math.pi))))
function code(x) return abs(Float64(abs(x) * Float64(2.0 / sqrt(pi)))) end
function tmp = code(x) tmp = abs((abs(x) * (2.0 / sqrt(pi)))); end
code[x_] := N[Abs[N[(N[Abs[x], $MachinePrecision] * N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left|x\right| \cdot \frac{2}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6466.5
Applied rewrites66.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6467.0
Applied rewrites67.0%
(FPCore (x) :precision binary64 (fabs (* 2.0 (/ (fabs x) (sqrt PI)))))
double code(double x) {
return fabs((2.0 * (fabs(x) / sqrt(((double) M_PI)))));
}
public static double code(double x) {
return Math.abs((2.0 * (Math.abs(x) / Math.sqrt(Math.PI))));
}
def code(x): return math.fabs((2.0 * (math.fabs(x) / math.sqrt(math.pi))))
function code(x) return abs(Float64(2.0 * Float64(abs(x) / sqrt(pi)))) end
function tmp = code(x) tmp = abs((2.0 * (abs(x) / sqrt(pi)))); end
code[x_] := N[Abs[N[(2.0 * N[(N[Abs[x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|2 \cdot \frac{\left|x\right|}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6466.5
Applied rewrites66.5%
herbie shell --seed 2025148
(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)))))))