
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
(* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x)))))) end
function tmp = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 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 x)
(fabs
(/
(+
(fma 0.2 (pow x 4.0) (* 0.047619047619047616 (pow x 6.0)))
(fma 0.6666666666666666 (* x x) 2.0))
(sqrt PI)))))
double code(double x) {
return fabs(x) * fabs(((fma(0.2, pow(x, 4.0), (0.047619047619047616 * pow(x, 6.0))) + fma(0.6666666666666666, (x * x), 2.0)) / sqrt(((double) M_PI))));
}
function code(x) return Float64(abs(x) * abs(Float64(Float64(fma(0.2, (x ^ 4.0), Float64(0.047619047619047616 * (x ^ 6.0))) + fma(0.6666666666666666, Float64(x * x), 2.0)) / sqrt(pi)))) end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(N[(0.2 * N[Power[x, 4.0], $MachinePrecision] + N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|x\right| \cdot \left|\frac{\mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right) + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.5%
Simplified99.9%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.2)
(fabs
(* (pow PI -0.5) (* (fabs x) (fma 0.6666666666666666 (pow x 2.0) 2.0))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+ (* 0.2 (pow (fabs x) 5.0)) (* 0.047619047619047616 (pow x 7.0)))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = fabs((pow(((double) M_PI), -0.5) * (fabs(x) * fma(0.6666666666666666, pow(x, 2.0), 2.0))));
} else {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * ((0.2 * pow(fabs(x), 5.0)) + (0.047619047619047616 * pow(x, 7.0)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = abs(Float64((pi ^ -0.5) * Float64(abs(x) * fma(0.6666666666666666, (x ^ 2.0), 2.0)))); else tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(0.2 * (abs(x) ^ 5.0)) + Float64(0.047619047619047616 * (x ^ 7.0))))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Abs[N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[(0.6666666666666666 * N[Power[x, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(0.2 * N[Power[N[Abs[x], $MachinePrecision], 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\left|{\pi}^{-0.5} \cdot \left(\left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, {x}^{2}, 2\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {\left(\left|x\right|\right)}^{5} + 0.047619047619047616 \cdot {x}^{7}\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.6%
Simplified99.6%
Taylor expanded in x around 0 99.5%
rem-exp-log99.5%
rec-exp99.5%
unpow1/299.5%
exp-prod99.5%
distribute-lft-neg-out99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
exp-to-pow99.5%
unpow399.5%
sqr-abs99.5%
unpow299.5%
associate-*r*99.5%
distribute-rgt-out99.5%
fma-define99.5%
Simplified99.5%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.8%
metadata-eval98.8%
pow-sqr98.8%
unpow298.8%
sqr-abs98.8%
associate-*l*98.8%
unpow298.8%
sqr-abs98.8%
unpow398.8%
pow-plus98.8%
metadata-eval98.8%
pow-plus98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in x around 0 98.9%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt29.7%
pow-plus29.7%
metadata-eval29.7%
Simplified29.7%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.2)
(fabs
(* (pow PI -0.5) (* (fabs x) (fma 0.6666666666666666 (pow x 2.0) 2.0))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(* 0.2 (pow x 5.0))
(*
0.047619047619047616
(* (* x x) (* (* x x) (* (fabs x) (* x x))))))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = fabs((pow(((double) M_PI), -0.5) * (fabs(x) * fma(0.6666666666666666, pow(x, 2.0), 2.0))));
} else {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * ((0.2 * pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (fabs(x) * (x * x))))))));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = abs(Float64((pi ^ -0.5) * Float64(abs(x) * fma(0.6666666666666666, (x ^ 2.0), 2.0)))); else tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(0.2 * (x ^ 5.0)) + Float64(0.047619047619047616 * Float64(Float64(x * x) * Float64(Float64(x * x) * Float64(abs(x) * Float64(x * x)))))))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Abs[N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[(0.6666666666666666 * N[Power[x, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\left|{\pi}^{-0.5} \cdot \left(\left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, {x}^{2}, 2\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.6%
Simplified99.6%
Taylor expanded in x around 0 99.5%
rem-exp-log99.5%
rec-exp99.5%
unpow1/299.5%
exp-prod99.5%
distribute-lft-neg-out99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
exp-to-pow99.5%
unpow399.5%
sqr-abs99.5%
unpow299.5%
associate-*r*99.5%
distribute-rgt-out99.5%
fma-define99.5%
Simplified99.5%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.8%
metadata-eval98.8%
pow-sqr98.8%
unpow298.8%
sqr-abs98.8%
associate-*l*98.8%
unpow298.8%
sqr-abs98.8%
unpow398.8%
pow-plus98.8%
metadata-eval98.8%
pow-plus98.8%
metadata-eval98.8%
Simplified98.8%
pow198.8%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt29.5%
Applied egg-rr29.5%
unpow129.5%
Simplified29.5%
Final simplification75.2%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.2)
(* (fabs x) (fabs (/ (+ 2.0 (* 0.2 (pow x 4.0))) (sqrt PI))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(* 0.2 (pow x 5.0))
(*
0.047619047619047616
(* (* x x) (* (* x x) (* (fabs x) (* x x))))))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = fabs(x) * fabs(((2.0 + (0.2 * pow(x, 4.0))) / sqrt(((double) M_PI))));
} else {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * ((0.2 * pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (fabs(x) * (x * x))))))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = Math.abs(x) * Math.abs(((2.0 + (0.2 * Math.pow(x, 4.0))) / Math.sqrt(Math.PI)));
} else {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((0.2 * Math.pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (Math.abs(x) * (x * x))))))));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = math.fabs(x) * math.fabs(((2.0 + (0.2 * math.pow(x, 4.0))) / math.sqrt(math.pi))) else: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * ((0.2 * math.pow(x, 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (math.fabs(x) * (x * x)))))))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = Float64(abs(x) * abs(Float64(Float64(2.0 + Float64(0.2 * (x ^ 4.0))) / sqrt(pi)))); else tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(0.2 * (x ^ 5.0)) + Float64(0.047619047619047616 * Float64(Float64(x * x) * Float64(Float64(x * x) * Float64(abs(x) * Float64(x * x)))))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.2) tmp = abs(x) * abs(((2.0 + (0.2 * (x ^ 4.0))) / sqrt(pi))); else tmp = abs(((1.0 / sqrt(pi)) * ((0.2 * (x ^ 5.0)) + (0.047619047619047616 * ((x * x) * ((x * x) * (abs(x) * (x * x)))))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(2.0 + N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.6%
Taylor expanded in x around 0 99.2%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.8%
metadata-eval98.8%
pow-sqr98.8%
unpow298.8%
sqr-abs98.8%
associate-*l*98.8%
unpow298.8%
sqr-abs98.8%
unpow398.8%
pow-plus98.8%
metadata-eval98.8%
pow-plus98.8%
metadata-eval98.8%
Simplified98.8%
pow198.8%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt29.5%
Applied egg-rr29.5%
unpow129.5%
Simplified29.5%
Final simplification75.0%
(FPCore (x)
:precision binary64
(*
(fabs x)
(fabs
(/
(+
(fma 0.6666666666666666 (* x x) 2.0)
(* (pow x 4.0) (+ 0.2 (* 0.047619047619047616 (* x x)))))
(sqrt PI)))))
double code(double x) {
return fabs(x) * fabs(((fma(0.6666666666666666, (x * x), 2.0) + (pow(x, 4.0) * (0.2 + (0.047619047619047616 * (x * x))))) / sqrt(((double) M_PI))));
}
function code(x) return Float64(abs(x) * abs(Float64(Float64(fma(0.6666666666666666, Float64(x * x), 2.0) + Float64((x ^ 4.0) * Float64(0.2 + Float64(0.047619047619047616 * Float64(x * x))))) / sqrt(pi)))) end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * N[(0.2 + N[(0.047619047619047616 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|x\right| \cdot \left|\frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + {x}^{4} \cdot \left(0.2 + 0.047619047619047616 \cdot \left(x \cdot x\right)\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.5%
Simplified99.9%
Taylor expanded in x around 0 99.9%
pow299.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.2)
(* (fabs x) (fabs (/ (+ 2.0 (* 0.2 (pow x 4.0))) (sqrt PI))))
(*
0.047619047619047616
(fabs (* (pow x 6.0) (* (fabs x) (sqrt (/ 1.0 PI))))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = fabs(x) * fabs(((2.0 + (0.2 * pow(x, 4.0))) / sqrt(((double) M_PI))));
} else {
tmp = 0.047619047619047616 * fabs((pow(x, 6.0) * (fabs(x) * sqrt((1.0 / ((double) M_PI))))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = Math.abs(x) * Math.abs(((2.0 + (0.2 * Math.pow(x, 4.0))) / Math.sqrt(Math.PI)));
} else {
tmp = 0.047619047619047616 * Math.abs((Math.pow(x, 6.0) * (Math.abs(x) * Math.sqrt((1.0 / Math.PI)))));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = math.fabs(x) * math.fabs(((2.0 + (0.2 * math.pow(x, 4.0))) / math.sqrt(math.pi))) else: tmp = 0.047619047619047616 * math.fabs((math.pow(x, 6.0) * (math.fabs(x) * math.sqrt((1.0 / math.pi))))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = Float64(abs(x) * abs(Float64(Float64(2.0 + Float64(0.2 * (x ^ 4.0))) / sqrt(pi)))); else tmp = Float64(0.047619047619047616 * abs(Float64((x ^ 6.0) * Float64(abs(x) * sqrt(Float64(1.0 / pi)))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.2) tmp = abs(x) * abs(((2.0 + (0.2 * (x ^ 4.0))) / sqrt(pi))); else tmp = 0.047619047619047616 * abs(((x ^ 6.0) * (abs(x) * sqrt((1.0 / pi))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(2.0 + N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.047619047619047616 * N[Abs[N[(N[Power[x, 6.0], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{2 + 0.2 \cdot {x}^{4}}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;0.047619047619047616 \cdot \left|{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.6%
Taylor expanded in x around 0 99.2%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in x around 0 98.2%
fabs-mul98.2%
metadata-eval98.2%
associate-*l*98.3%
Simplified98.3%
Final simplification98.9%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.2)
(log1p (expm1 (* x (* 2.0 (pow PI -0.5)))))
(*
0.047619047619047616
(fabs (* (pow x 6.0) (* (fabs x) (sqrt (/ 1.0 PI))))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = log1p(expm1((x * (2.0 * pow(((double) M_PI), -0.5)))));
} else {
tmp = 0.047619047619047616 * fabs((pow(x, 6.0) * (fabs(x) * sqrt((1.0 / ((double) M_PI))))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = Math.log1p(Math.expm1((x * (2.0 * Math.pow(Math.PI, -0.5)))));
} else {
tmp = 0.047619047619047616 * Math.abs((Math.pow(x, 6.0) * (Math.abs(x) * Math.sqrt((1.0 / Math.PI)))));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = math.log1p(math.expm1((x * (2.0 * math.pow(math.pi, -0.5))))) else: tmp = 0.047619047619047616 * math.fabs((math.pow(x, 6.0) * (math.fabs(x) * math.sqrt((1.0 / math.pi))))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = log1p(expm1(Float64(x * Float64(2.0 * (pi ^ -0.5))))); else tmp = Float64(0.047619047619047616 * abs(Float64((x ^ 6.0) * Float64(abs(x) * sqrt(Float64(1.0 / pi)))))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Log[1 + N[(Exp[N[(x * N[(2.0 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(0.047619047619047616 * N[Abs[N[(N[Power[x, 6.0], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.047619047619047616 \cdot \left|{x}^{6} \cdot \left(\left|x\right| \cdot \sqrt{\frac{1}{\pi}}\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
fabs-mul99.2%
metadata-eval99.2%
inv-pow99.2%
sqrt-pow199.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
associate-*r*99.2%
*-commutative99.2%
log1p-expm1-u99.2%
log1p-define7.0%
*-commutative7.0%
add-sqr-sqrt7.0%
fabs-sqr7.0%
add-sqr-sqrt7.0%
log1p-expm1-u7.0%
add-sqr-sqrt7.0%
fabs-sqr7.0%
Applied egg-rr48.7%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in x around 0 98.2%
fabs-mul98.2%
metadata-eval98.2%
associate-*l*98.3%
Simplified98.3%
Final simplification65.9%
(FPCore (x)
:precision binary64
(*
(fabs x)
(fabs
(/
(+
(* 0.047619047619047616 (pow x 6.0))
(fma 0.6666666666666666 (* x x) 2.0))
(sqrt PI)))))
double code(double x) {
return fabs(x) * fabs((((0.047619047619047616 * pow(x, 6.0)) + fma(0.6666666666666666, (x * x), 2.0)) / sqrt(((double) M_PI))));
}
function code(x) return Float64(abs(x) * abs(Float64(Float64(Float64(0.047619047619047616 * (x ^ 6.0)) + fma(0.6666666666666666, Float64(x * x), 2.0)) / sqrt(pi)))) end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|x\right| \cdot \left|\frac{0.047619047619047616 \cdot {x}^{6} + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.5%
Simplified99.9%
Taylor expanded in x around inf 99.4%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.2) (log1p (expm1 (* x (* 2.0 (pow PI -0.5))))) (* (* 0.047619047619047616 (pow x 7.0)) (fabs (pow PI -0.5)))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = log1p(expm1((x * (2.0 * pow(((double) M_PI), -0.5)))));
} else {
tmp = (0.047619047619047616 * pow(x, 7.0)) * fabs(pow(((double) M_PI), -0.5));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = Math.log1p(Math.expm1((x * (2.0 * Math.pow(Math.PI, -0.5)))));
} else {
tmp = (0.047619047619047616 * Math.pow(x, 7.0)) * Math.abs(Math.pow(Math.PI, -0.5));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = math.log1p(math.expm1((x * (2.0 * math.pow(math.pi, -0.5))))) else: tmp = (0.047619047619047616 * math.pow(x, 7.0)) * math.fabs(math.pow(math.pi, -0.5)) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = log1p(expm1(Float64(x * Float64(2.0 * (pi ^ -0.5))))); else tmp = Float64(Float64(0.047619047619047616 * (x ^ 7.0)) * abs((pi ^ -0.5))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Log[1 + N[(Exp[N[(x * N[(2.0 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision] * N[Abs[N[Power[Pi, -0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.047619047619047616 \cdot {x}^{7}\right) \cdot \left|{\pi}^{-0.5}\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
fabs-mul99.2%
metadata-eval99.2%
inv-pow99.2%
sqrt-pow199.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
associate-*r*99.2%
*-commutative99.2%
log1p-expm1-u99.2%
log1p-define7.0%
*-commutative7.0%
add-sqr-sqrt7.0%
fabs-sqr7.0%
add-sqr-sqrt7.0%
log1p-expm1-u7.0%
add-sqr-sqrt7.0%
fabs-sqr7.0%
Applied egg-rr48.7%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
associate-*l*98.3%
Simplified98.3%
fabs-mul98.3%
associate-*r*98.3%
inv-pow98.3%
sqrt-pow198.3%
metadata-eval98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 98.3%
associate-*r*98.3%
fabs-mul98.3%
fabs-fabs98.3%
fabs-mul98.3%
associate-*l*98.3%
*-commutative98.3%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.2%
*-commutative0.2%
pow-plus0.2%
metadata-eval0.2%
Simplified0.2%
Final simplification31.8%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.2) (log1p (expm1 (* x (* 2.0 (pow PI -0.5))))) (* (pow PI -0.5) (* 0.047619047619047616 (* x (pow x 6.0))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = log1p(expm1((x * (2.0 * pow(((double) M_PI), -0.5)))));
} else {
tmp = pow(((double) M_PI), -0.5) * (0.047619047619047616 * (x * pow(x, 6.0)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = Math.log1p(Math.expm1((x * (2.0 * Math.pow(Math.PI, -0.5)))));
} else {
tmp = Math.pow(Math.PI, -0.5) * (0.047619047619047616 * (x * Math.pow(x, 6.0)));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = math.log1p(math.expm1((x * (2.0 * math.pow(math.pi, -0.5))))) else: tmp = math.pow(math.pi, -0.5) * (0.047619047619047616 * (x * math.pow(x, 6.0))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = log1p(expm1(Float64(x * Float64(2.0 * (pi ^ -0.5))))); else tmp = Float64((pi ^ -0.5) * Float64(0.047619047619047616 * Float64(x * (x ^ 6.0)))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[Log[1 + N[(Exp[N[(x * N[(2.0 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(0.047619047619047616 * N[(x * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x \cdot \left(2 \cdot {\pi}^{-0.5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
fabs-mul99.2%
metadata-eval99.2%
inv-pow99.2%
sqrt-pow199.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
associate-*r*99.2%
*-commutative99.2%
log1p-expm1-u99.2%
log1p-define7.0%
*-commutative7.0%
add-sqr-sqrt7.0%
fabs-sqr7.0%
add-sqr-sqrt7.0%
log1p-expm1-u7.0%
add-sqr-sqrt7.0%
fabs-sqr7.0%
Applied egg-rr48.7%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
associate-*r*98.3%
associate-*l*98.3%
inv-pow98.3%
sqrt-pow198.3%
metadata-eval98.3%
mul-fabs98.3%
*-commutative98.3%
add-sqr-sqrt98.3%
fabs-sqr98.3%
add-sqr-sqrt98.3%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.3%
associate-*l*98.3%
*-commutative98.3%
Applied egg-rr0.2%
Final simplification31.8%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.2) (* x (sqrt (/ 4.0 PI))) (* (pow PI -0.5) (* 0.047619047619047616 (* x (pow x 6.0))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = x * sqrt((4.0 / ((double) M_PI)));
} else {
tmp = pow(((double) M_PI), -0.5) * (0.047619047619047616 * (x * pow(x, 6.0)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = x * Math.sqrt((4.0 / Math.PI));
} else {
tmp = Math.pow(Math.PI, -0.5) * (0.047619047619047616 * (x * Math.pow(x, 6.0)));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = x * math.sqrt((4.0 / math.pi)) else: tmp = math.pow(math.pi, -0.5) * (0.047619047619047616 * (x * math.pow(x, 6.0))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = Float64(x * sqrt(Float64(4.0 / pi))); else tmp = Float64((pi ^ -0.5) * Float64(0.047619047619047616 * Float64(x * (x ^ 6.0)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.2) tmp = x * sqrt((4.0 / pi)); else tmp = (pi ^ -0.5) * (0.047619047619047616 * (x * (x ^ 6.0))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(0.047619047619047616 * N[(x * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\
\mathbf{else}:\\
\;\;\;\;{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot \left(x \cdot {x}^{6}\right)\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
fabs-mul99.2%
metadata-eval99.2%
inv-pow99.2%
sqrt-pow199.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-*r*99.2%
*-commutative99.2%
*-lft-identity99.2%
metadata-eval99.2%
unpow-199.2%
metadata-eval99.2%
pow-sqr99.2%
rem-sqrt-square99.2%
fabs-mul99.2%
*-commutative99.2%
*-lft-identity99.2%
rem-square-sqrt46.5%
fabs-sqr46.5%
rem-square-sqrt48.7%
rem-sqrt-square48.7%
swap-sqr48.7%
pow-sqr48.7%
metadata-eval48.7%
unpow-148.7%
metadata-eval48.7%
associate-*l/48.7%
Simplified48.7%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
associate-*r*98.3%
associate-*l*98.3%
inv-pow98.3%
sqrt-pow198.3%
metadata-eval98.3%
mul-fabs98.3%
*-commutative98.3%
add-sqr-sqrt98.3%
fabs-sqr98.3%
add-sqr-sqrt98.3%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.3%
associate-*l*98.3%
*-commutative98.3%
Applied egg-rr0.2%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.2) (* x (sqrt (/ 4.0 PI))) (* 0.047619047619047616 (* (pow PI -0.5) (* x (pow x 6.0))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = x * sqrt((4.0 / ((double) M_PI)));
} else {
tmp = 0.047619047619047616 * (pow(((double) M_PI), -0.5) * (x * pow(x, 6.0)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = x * Math.sqrt((4.0 / Math.PI));
} else {
tmp = 0.047619047619047616 * (Math.pow(Math.PI, -0.5) * (x * Math.pow(x, 6.0)));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = x * math.sqrt((4.0 / math.pi)) else: tmp = 0.047619047619047616 * (math.pow(math.pi, -0.5) * (x * math.pow(x, 6.0))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = Float64(x * sqrt(Float64(4.0 / pi))); else tmp = Float64(0.047619047619047616 * Float64((pi ^ -0.5) * Float64(x * (x ^ 6.0)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.2) tmp = x * sqrt((4.0 / pi)); else tmp = 0.047619047619047616 * ((pi ^ -0.5) * (x * (x ^ 6.0))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.047619047619047616 * N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(x * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\
\mathbf{else}:\\
\;\;\;\;0.047619047619047616 \cdot \left({\pi}^{-0.5} \cdot \left(x \cdot {x}^{6}\right)\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
fabs-mul99.2%
metadata-eval99.2%
inv-pow99.2%
sqrt-pow199.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-*r*99.2%
*-commutative99.2%
*-lft-identity99.2%
metadata-eval99.2%
unpow-199.2%
metadata-eval99.2%
pow-sqr99.2%
rem-sqrt-square99.2%
fabs-mul99.2%
*-commutative99.2%
*-lft-identity99.2%
rem-square-sqrt46.5%
fabs-sqr46.5%
rem-square-sqrt48.7%
rem-sqrt-square48.7%
swap-sqr48.7%
pow-sqr48.7%
metadata-eval48.7%
unpow-148.7%
metadata-eval48.7%
associate-*l/48.7%
Simplified48.7%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
add-sqr-sqrt98.1%
fabs-sqr98.1%
add-sqr-sqrt98.2%
*-commutative98.2%
*-commutative98.2%
inv-pow98.2%
sqrt-pow198.2%
metadata-eval98.2%
*-commutative98.2%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.2%
Applied egg-rr0.2%
Final simplification31.8%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.2) (* x (sqrt (/ 4.0 PI))) (* (pow x 7.0) (* 0.047619047619047616 (pow PI -0.5)))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.2) {
tmp = x * sqrt((4.0 / ((double) M_PI)));
} else {
tmp = pow(x, 7.0) * (0.047619047619047616 * pow(((double) M_PI), -0.5));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.2) {
tmp = x * Math.sqrt((4.0 / Math.PI));
} else {
tmp = Math.pow(x, 7.0) * (0.047619047619047616 * Math.pow(Math.PI, -0.5));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.2: tmp = x * math.sqrt((4.0 / math.pi)) else: tmp = math.pow(x, 7.0) * (0.047619047619047616 * math.pow(math.pi, -0.5)) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.2) tmp = Float64(x * sqrt(Float64(4.0 / pi))); else tmp = Float64((x ^ 7.0) * Float64(0.047619047619047616 * (pi ^ -0.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.2) tmp = x * sqrt((4.0 / pi)); else tmp = (x ^ 7.0) * (0.047619047619047616 * (pi ^ -0.5)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.2], N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, 7.0], $MachinePrecision] * N[(0.047619047619047616 * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2:\\
\;\;\;\;x \cdot \sqrt{\frac{4}{\pi}}\\
\mathbf{else}:\\
\;\;\;\;{x}^{7} \cdot \left(0.047619047619047616 \cdot {\pi}^{-0.5}\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 99.2%
fabs-mul99.2%
metadata-eval99.2%
inv-pow99.2%
sqrt-pow199.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
rem-square-sqrt98.5%
fabs-sqr98.5%
rem-square-sqrt99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-*r*99.2%
*-commutative99.2%
*-lft-identity99.2%
metadata-eval99.2%
unpow-199.2%
metadata-eval99.2%
pow-sqr99.2%
rem-sqrt-square99.2%
fabs-mul99.2%
*-commutative99.2%
*-lft-identity99.2%
rem-square-sqrt46.5%
fabs-sqr46.5%
rem-square-sqrt48.7%
rem-sqrt-square48.7%
swap-sqr48.7%
pow-sqr48.7%
metadata-eval48.7%
unpow-148.7%
metadata-eval48.7%
associate-*l/48.7%
Simplified48.7%
if 0.20000000000000001 < (fabs.f64 x) Initial program 98.8%
Simplified98.8%
Taylor expanded in x around inf 98.2%
Applied egg-rr0.0%
sub-neg0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-undefine0.0%
rem-exp-log0.2%
associate-+r+0.2%
metadata-eval0.2%
+-lft-identity0.2%
associate-*r*0.2%
*-commutative0.2%
*-commutative0.2%
*-commutative0.2%
pow-plus0.2%
metadata-eval0.2%
Simplified0.2%
(FPCore (x) :precision binary64 (* x (sqrt (/ 4.0 PI))))
double code(double x) {
return x * sqrt((4.0 / ((double) M_PI)));
}
public static double code(double x) {
return x * Math.sqrt((4.0 / Math.PI));
}
def code(x): return x * math.sqrt((4.0 / math.pi))
function code(x) return Float64(x * sqrt(Float64(4.0 / pi))) end
function tmp = code(x) tmp = x * sqrt((4.0 / pi)); end
code[x_] := N[(x * N[Sqrt[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sqrt{\frac{4}{\pi}}
\end{array}
Initial program 99.5%
Simplified99.5%
Taylor expanded in x around 0 66.6%
fabs-mul66.6%
metadata-eval66.6%
inv-pow66.6%
sqrt-pow166.6%
metadata-eval66.6%
Applied egg-rr66.6%
*-commutative66.6%
rem-square-sqrt66.2%
fabs-sqr66.2%
rem-square-sqrt66.6%
*-commutative66.6%
associate-*r*66.6%
Simplified66.6%
Taylor expanded in x around 0 66.6%
associate-*r*66.6%
*-commutative66.6%
*-lft-identity66.6%
metadata-eval66.6%
unpow-166.6%
metadata-eval66.6%
pow-sqr66.6%
rem-sqrt-square66.6%
fabs-mul66.6%
*-commutative66.6%
*-lft-identity66.6%
rem-square-sqrt30.3%
fabs-sqr30.3%
rem-square-sqrt31.9%
rem-sqrt-square31.9%
swap-sqr31.9%
pow-sqr31.9%
metadata-eval31.9%
unpow-131.9%
metadata-eval31.9%
associate-*l/31.9%
Simplified31.9%
herbie shell --seed 2024157
(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)))))))