
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs x)))
(t_1 (* (* t_0 t_0) t_0))
(t_2 (* (* t_1 t_0) t_0)))
(*
(* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x))))
(+
(+ (+ t_0 (* (/ 1.0 2.0) t_1)) (* (/ 3.0 4.0) t_2))
(* (/ 15.0 8.0) (* (* t_2 t_0) t_0))))))
double code(double x) {
double t_0 = 1.0 / fabs(x);
double t_1 = (t_0 * t_0) * t_0;
double t_2 = (t_1 * t_0) * t_0;
return ((1.0 / sqrt(((double) M_PI))) * exp((fabs(x) * fabs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0)));
}
public static double code(double x) {
double t_0 = 1.0 / Math.abs(x);
double t_1 = (t_0 * t_0) * t_0;
double t_2 = (t_1 * t_0) * t_0;
return ((1.0 / Math.sqrt(Math.PI)) * Math.exp((Math.abs(x) * Math.abs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0)));
}
def code(x): t_0 = 1.0 / math.fabs(x) t_1 = (t_0 * t_0) * t_0 t_2 = (t_1 * t_0) * t_0 return ((1.0 / math.sqrt(math.pi)) * math.exp((math.fabs(x) * math.fabs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0)))
function code(x) t_0 = Float64(1.0 / abs(x)) t_1 = Float64(Float64(t_0 * t_0) * t_0) t_2 = Float64(Float64(t_1 * t_0) * t_0) return Float64(Float64(Float64(1.0 / sqrt(pi)) * exp(Float64(abs(x) * abs(x)))) * Float64(Float64(Float64(t_0 + Float64(Float64(1.0 / 2.0) * t_1)) + Float64(Float64(3.0 / 4.0) * t_2)) + Float64(Float64(15.0 / 8.0) * Float64(Float64(t_2 * t_0) * t_0)))) end
function tmp = code(x) t_0 = 1.0 / abs(x); t_1 = (t_0 * t_0) * t_0; t_2 = (t_1 * t_0) * t_0; tmp = ((1.0 / sqrt(pi)) * exp((abs(x) * abs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0))); end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]}, N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 + N[(N[(1.0 / 2.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 / 4.0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(15.0 / 8.0), $MachinePrecision] * N[(N[(t$95$2 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
t_1 := \left(t_0 \cdot t_0\right) \cdot t_0\\
t_2 := \left(t_1 \cdot t_0\right) \cdot t_0\\
\left(\frac{1}{\sqrt{\pi}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t_0 + \frac{1}{2} \cdot t_1\right) + \frac{3}{4} \cdot t_2\right) + \frac{15}{8} \cdot \left(\left(t_2 \cdot t_0\right) \cdot t_0\right)\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs x)))
(t_1 (* (* t_0 t_0) t_0))
(t_2 (* (* t_1 t_0) t_0)))
(*
(* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x))))
(+
(+ (+ t_0 (* (/ 1.0 2.0) t_1)) (* (/ 3.0 4.0) t_2))
(* (/ 15.0 8.0) (* (* t_2 t_0) t_0))))))
double code(double x) {
double t_0 = 1.0 / fabs(x);
double t_1 = (t_0 * t_0) * t_0;
double t_2 = (t_1 * t_0) * t_0;
return ((1.0 / sqrt(((double) M_PI))) * exp((fabs(x) * fabs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0)));
}
public static double code(double x) {
double t_0 = 1.0 / Math.abs(x);
double t_1 = (t_0 * t_0) * t_0;
double t_2 = (t_1 * t_0) * t_0;
return ((1.0 / Math.sqrt(Math.PI)) * Math.exp((Math.abs(x) * Math.abs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0)));
}
def code(x): t_0 = 1.0 / math.fabs(x) t_1 = (t_0 * t_0) * t_0 t_2 = (t_1 * t_0) * t_0 return ((1.0 / math.sqrt(math.pi)) * math.exp((math.fabs(x) * math.fabs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0)))
function code(x) t_0 = Float64(1.0 / abs(x)) t_1 = Float64(Float64(t_0 * t_0) * t_0) t_2 = Float64(Float64(t_1 * t_0) * t_0) return Float64(Float64(Float64(1.0 / sqrt(pi)) * exp(Float64(abs(x) * abs(x)))) * Float64(Float64(Float64(t_0 + Float64(Float64(1.0 / 2.0) * t_1)) + Float64(Float64(3.0 / 4.0) * t_2)) + Float64(Float64(15.0 / 8.0) * Float64(Float64(t_2 * t_0) * t_0)))) end
function tmp = code(x) t_0 = 1.0 / abs(x); t_1 = (t_0 * t_0) * t_0; t_2 = (t_1 * t_0) * t_0; tmp = ((1.0 / sqrt(pi)) * exp((abs(x) * abs(x)))) * (((t_0 + ((1.0 / 2.0) * t_1)) + ((3.0 / 4.0) * t_2)) + ((15.0 / 8.0) * ((t_2 * t_0) * t_0))); end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]}, N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 + N[(N[(1.0 / 2.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 / 4.0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(15.0 / 8.0), $MachinePrecision] * N[(N[(t$95$2 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
t_1 := \left(t_0 \cdot t_0\right) \cdot t_0\\
t_2 := \left(t_1 \cdot t_0\right) \cdot t_0\\
\left(\frac{1}{\sqrt{\pi}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t_0 + \frac{1}{2} \cdot t_1\right) + \frac{3}{4} \cdot t_2\right) + \frac{15}{8} \cdot \left(\left(t_2 \cdot t_0\right) \cdot t_0\right)\right)
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (log (sqrt (pow (exp 0.5) (pow x -2.0))))) (t_1 (/ 1.0 (fabs x))))
(*
(fma
0.75
(pow t_1 5.0)
(fma 1.875 (pow t_1 7.0) (/ (+ 1.0 (+ t_0 t_0)) (fabs x))))
(/ (pow (exp x) x) (pow (cbrt (sqrt PI)) 3.0)))))
double code(double x) {
double t_0 = log(sqrt(pow(exp(0.5), pow(x, -2.0))));
double t_1 = 1.0 / fabs(x);
return fma(0.75, pow(t_1, 5.0), fma(1.875, pow(t_1, 7.0), ((1.0 + (t_0 + t_0)) / fabs(x)))) * (pow(exp(x), x) / pow(cbrt(sqrt(((double) M_PI))), 3.0));
}
function code(x) t_0 = log(sqrt((exp(0.5) ^ (x ^ -2.0)))) t_1 = Float64(1.0 / abs(x)) return Float64(fma(0.75, (t_1 ^ 5.0), fma(1.875, (t_1 ^ 7.0), Float64(Float64(1.0 + Float64(t_0 + t_0)) / abs(x)))) * Float64((exp(x) ^ x) / (cbrt(sqrt(pi)) ^ 3.0))) end
code[x_] := Block[{t$95$0 = N[Log[N[Sqrt[N[Power[N[Exp[0.5], $MachinePrecision], N[Power[x, -2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[(0.75 * N[Power[t$95$1, 5.0], $MachinePrecision] + N[(1.875 * N[Power[t$95$1, 7.0], $MachinePrecision] + N[(N[(1.0 + N[(t$95$0 + t$95$0), $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[Power[N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{{\left(e^{0.5}\right)}^{\left({x}^{-2}\right)}}\right)\\
t_1 := \frac{1}{\left|x\right|}\\
\mathsf{fma}\left(0.75, {t_1}^{5}, \mathsf{fma}\left(1.875, {t_1}^{7}, \frac{1 + \left(t_0 + t_0\right)}{\left|x\right|}\right)\right) \cdot \frac{{\left(e^{x}\right)}^{x}}{{\left(\sqrt[3]{\sqrt{\pi}}\right)}^{3}}
\end{array}
\end{array}
Initial program 100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
add-log-exp100.0%
add-sqr-sqrt100.0%
log-prod100.0%
div-inv100.0%
exp-prod100.0%
pow2100.0%
pow-flip100.0%
metadata-eval100.0%
div-inv100.0%
exp-prod100.0%
pow2100.0%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs x))))
(*
(/ (pow (exp x) x) (pow (cbrt (sqrt PI)) 3.0))
(fma
0.75
(pow t_0 5.0)
(fma 1.875 (pow t_0 7.0) (/ (+ 1.0 (/ 0.5 (* x x))) (fabs x)))))))
double code(double x) {
double t_0 = 1.0 / fabs(x);
return (pow(exp(x), x) / pow(cbrt(sqrt(((double) M_PI))), 3.0)) * fma(0.75, pow(t_0, 5.0), fma(1.875, pow(t_0, 7.0), ((1.0 + (0.5 / (x * x))) / fabs(x))));
}
function code(x) t_0 = Float64(1.0 / abs(x)) return Float64(Float64((exp(x) ^ x) / (cbrt(sqrt(pi)) ^ 3.0)) * fma(0.75, (t_0 ^ 5.0), fma(1.875, (t_0 ^ 7.0), Float64(Float64(1.0 + Float64(0.5 / Float64(x * x))) / abs(x))))) end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[Power[N[Power[N[Sqrt[Pi], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.75 * N[Power[t$95$0, 5.0], $MachinePrecision] + N[(1.875 * N[Power[t$95$0, 7.0], $MachinePrecision] + N[(N[(1.0 + N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\frac{{\left(e^{x}\right)}^{x}}{{\left(\sqrt[3]{\sqrt{\pi}}\right)}^{3}} \cdot \mathsf{fma}\left(0.75, {t_0}^{5}, \mathsf{fma}\left(1.875, {t_0}^{7}, \frac{1 + \frac{0.5}{x \cdot x}}{\left|x\right|}\right)\right)
\end{array}
\end{array}
Initial program 100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs x))))
(*
(fma
0.75
(pow t_0 5.0)
(fma 1.875 (pow t_0 7.0) (/ (+ 1.0 (/ 0.5 (* x x))) (fabs x))))
(/ (pow (exp x) x) (sqrt PI)))))
double code(double x) {
double t_0 = 1.0 / fabs(x);
return fma(0.75, pow(t_0, 5.0), fma(1.875, pow(t_0, 7.0), ((1.0 + (0.5 / (x * x))) / fabs(x)))) * (pow(exp(x), x) / sqrt(((double) M_PI)));
}
function code(x) t_0 = Float64(1.0 / abs(x)) return Float64(fma(0.75, (t_0 ^ 5.0), fma(1.875, (t_0 ^ 7.0), Float64(Float64(1.0 + Float64(0.5 / Float64(x * x))) / abs(x)))) * Float64((exp(x) ^ x) / sqrt(pi))) end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[(0.75 * N[Power[t$95$0, 5.0], $MachinePrecision] + N[(1.875 * N[Power[t$95$0, 7.0], $MachinePrecision] + N[(N[(1.0 + N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{fma}\left(0.75, {t_0}^{5}, \mathsf{fma}\left(1.875, {t_0}^{7}, \frac{1 + \frac{0.5}{x \cdot x}}{\left|x\right|}\right)\right) \cdot \frac{{\left(e^{x}\right)}^{x}}{\sqrt{\pi}}
\end{array}
\end{array}
Initial program 100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x) :precision binary64 (* (/ (pow (exp x) x) (* (pow (cbrt x) 2.0) (/ -1.0 (/ (- (pow PI -0.5)) (cbrt x))))) (+ 1.0 (+ (/ 0.75 (pow (fabs x) 4.0)) (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0)))))))
double code(double x) {
return (pow(exp(x), x) / (pow(cbrt(x), 2.0) * (-1.0 / (-pow(((double) M_PI), -0.5) / cbrt(x))))) * (1.0 + ((0.75 / pow(fabs(x), 4.0)) + ((0.5 / (x * x)) + (1.875 / pow(x, 6.0)))));
}
public static double code(double x) {
return (Math.pow(Math.exp(x), x) / (Math.pow(Math.cbrt(x), 2.0) * (-1.0 / (-Math.pow(Math.PI, -0.5) / Math.cbrt(x))))) * (1.0 + ((0.75 / Math.pow(Math.abs(x), 4.0)) + ((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0)))));
}
function code(x) return Float64(Float64((exp(x) ^ x) / Float64((cbrt(x) ^ 2.0) * Float64(-1.0 / Float64(Float64(-(pi ^ -0.5)) / cbrt(x))))) * Float64(1.0 + Float64(Float64(0.75 / (abs(x) ^ 4.0)) + Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0)))))) end
code[x_] := N[(N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / N[((-N[Power[Pi, -0.5], $MachinePrecision]) / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(0.75 / N[Power[N[Abs[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(e^{x}\right)}^{x}}{{\left(\sqrt[3]{x}\right)}^{2} \cdot \frac{-1}{\frac{-{\pi}^{-0.5}}{\sqrt[3]{x}}}} \cdot \left(1 + \left(\frac{0.75}{{\left(\left|x\right|\right)}^{4}} + \left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right)\right)\right)
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 99.6%
*-commutative99.6%
unpow199.6%
sqr-pow99.6%
fabs-sqr99.6%
sqr-pow99.6%
unpow199.6%
Simplified99.6%
*-un-lft-identity99.6%
associate-*r*99.6%
metadata-eval99.6%
div-inv99.6%
associate-/r/99.6%
add-cube-cbrt99.6%
metadata-eval99.6%
sqrt-div99.6%
associate-/l*99.6%
pow299.6%
inv-pow99.6%
sqrt-pow199.6%
metadata-eval99.6%
Applied egg-rr99.6%
frac-2neg99.6%
div-inv99.6%
distribute-neg-frac99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (* (/ (pow (exp x) x) (/ (pow (cbrt x) 2.0) (/ (pow PI -0.5) (cbrt x)))) (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0))))))
double code(double x) {
return (pow(exp(x), x) / (pow(cbrt(x), 2.0) / (pow(((double) M_PI), -0.5) / cbrt(x)))) * (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0))));
}
public static double code(double x) {
return (Math.pow(Math.exp(x), x) / (Math.pow(Math.cbrt(x), 2.0) / (Math.pow(Math.PI, -0.5) / Math.cbrt(x)))) * (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0))));
}
function code(x) return Float64(Float64((exp(x) ^ x) / Float64((cbrt(x) ^ 2.0) / Float64((pi ^ -0.5) / cbrt(x)))) * Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0))))) end
code[x_] := N[(N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Power[Pi, -0.5], $MachinePrecision] / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(e^{x}\right)}^{x}}{\frac{{\left(\sqrt[3]{x}\right)}^{2}}{\frac{{\pi}^{-0.5}}{\sqrt[3]{x}}}} \cdot \left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right)
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 99.6%
*-commutative99.6%
unpow199.6%
sqr-pow99.6%
fabs-sqr99.6%
sqr-pow99.6%
unpow199.6%
Simplified99.6%
*-un-lft-identity99.6%
associate-*r*99.6%
metadata-eval99.6%
div-inv99.6%
associate-/r/99.6%
add-cube-cbrt99.6%
metadata-eval99.6%
sqrt-div99.6%
associate-/l*99.6%
pow299.6%
inv-pow99.6%
sqrt-pow199.6%
metadata-eval99.6%
Applied egg-rr99.6%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr99.6%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (* (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0)))) (/ (pow (exp x) x) (expm1 (log1p (* x (sqrt PI)))))))
double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0)))) * (pow(exp(x), x) / expm1(log1p((x * sqrt(((double) M_PI))))));
}
public static double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0)))) * (Math.pow(Math.exp(x), x) / Math.expm1(Math.log1p((x * Math.sqrt(Math.PI)))));
}
def code(x): return (1.0 + (((0.5 / (x * x)) + (1.875 / math.pow(x, 6.0))) + (0.75 / math.pow(x, 4.0)))) * (math.pow(math.exp(x), x) / math.expm1(math.log1p((x * math.sqrt(math.pi)))))
function code(x) return Float64(Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0)))) * Float64((exp(x) ^ x) / expm1(log1p(Float64(x * sqrt(pi)))))) end
code[x_] := N[(N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[(Exp[N[Log[1 + N[(x * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right) \cdot \frac{{\left(e^{x}\right)}^{x}}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot \sqrt{\pi}\right)\right)}
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 99.6%
*-commutative99.6%
unpow199.6%
sqr-pow99.6%
fabs-sqr99.6%
sqr-pow99.6%
unpow199.6%
Simplified99.6%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr99.6%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified99.6%
expm1-log1p-u99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (* (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0)))) (/ (pow (exp x) x) (* x (sqrt PI)))))
double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0)))) * (pow(exp(x), x) / (x * sqrt(((double) M_PI))));
}
public static double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0)))) * (Math.pow(Math.exp(x), x) / (x * Math.sqrt(Math.PI)));
}
def code(x): return (1.0 + (((0.5 / (x * x)) + (1.875 / math.pow(x, 6.0))) + (0.75 / math.pow(x, 4.0)))) * (math.pow(math.exp(x), x) / (x * math.sqrt(math.pi)))
function code(x) return Float64(Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0)))) * Float64((exp(x) ^ x) / Float64(x * sqrt(pi)))) end
function tmp = code(x) tmp = (1.0 + (((0.5 / (x * x)) + (1.875 / (x ^ 6.0))) + (0.75 / (x ^ 4.0)))) * ((exp(x) ^ x) / (x * sqrt(pi))); end
code[x_] := N[(N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[(x * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right) \cdot \frac{{\left(e^{x}\right)}^{x}}{x \cdot \sqrt{\pi}}
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 99.6%
*-commutative99.6%
unpow199.6%
sqr-pow99.6%
fabs-sqr99.6%
sqr-pow99.6%
unpow199.6%
Simplified99.6%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr99.6%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (* (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0)))) (sqrt (/ (pow (+ x (/ 1.0 x)) 2.0) PI))))
double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0)))) * sqrt((pow((x + (1.0 / x)), 2.0) / ((double) M_PI)));
}
public static double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0)))) * Math.sqrt((Math.pow((x + (1.0 / x)), 2.0) / Math.PI));
}
def code(x): return (1.0 + (((0.5 / (x * x)) + (1.875 / math.pow(x, 6.0))) + (0.75 / math.pow(x, 4.0)))) * math.sqrt((math.pow((x + (1.0 / x)), 2.0) / math.pi))
function code(x) return Float64(Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0)))) * sqrt(Float64((Float64(x + Float64(1.0 / x)) ^ 2.0) / pi))) end
function tmp = code(x) tmp = (1.0 + (((0.5 / (x * x)) + (1.875 / (x ^ 6.0))) + (0.75 / (x ^ 4.0)))) * sqrt((((x + (1.0 / x)) ^ 2.0) / pi)); end
code[x_] := N[(N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[Power[N[(x + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right) \cdot \sqrt{\frac{{\left(x + \frac{1}{x}\right)}^{2}}{\pi}}
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 56.1%
*-commutative56.1%
distribute-lft-out56.1%
unpow156.1%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow56.1%
unpow156.1%
unpow156.1%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow56.1%
unpow156.1%
Simplified56.1%
expm1-log1p-u56.1%
expm1-udef56.1%
*-commutative56.1%
sqrt-div56.1%
metadata-eval56.1%
un-div-inv56.1%
+-commutative56.1%
pow156.1%
pow-div5.7%
metadata-eval5.7%
pow15.7%
Applied egg-rr5.7%
expm1-def5.7%
expm1-log1p5.7%
Simplified5.7%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr5.7%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified5.7%
add-sqr-sqrt5.7%
sqrt-unprod56.1%
frac-times56.1%
pow256.1%
add-sqr-sqrt56.1%
Applied egg-rr56.1%
Final simplification56.1%
(FPCore (x) :precision binary64 (* (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0)))) (/ (+ x (/ 1.0 x)) (sqrt PI))))
double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0)))) * ((x + (1.0 / x)) / sqrt(((double) M_PI)));
}
public static double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0)))) * ((x + (1.0 / x)) / Math.sqrt(Math.PI));
}
def code(x): return (1.0 + (((0.5 / (x * x)) + (1.875 / math.pow(x, 6.0))) + (0.75 / math.pow(x, 4.0)))) * ((x + (1.0 / x)) / math.sqrt(math.pi))
function code(x) return Float64(Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0)))) * Float64(Float64(x + Float64(1.0 / x)) / sqrt(pi))) end
function tmp = code(x) tmp = (1.0 + (((0.5 / (x * x)) + (1.875 / (x ^ 6.0))) + (0.75 / (x ^ 4.0)))) * ((x + (1.0 / x)) / sqrt(pi)); end
code[x_] := N[(N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(x + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right) \cdot \frac{x + \frac{1}{x}}{\sqrt{\pi}}
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 56.1%
*-commutative56.1%
distribute-lft-out56.1%
unpow156.1%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow56.1%
unpow156.1%
unpow156.1%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow56.1%
unpow156.1%
Simplified56.1%
expm1-log1p-u56.1%
expm1-udef56.1%
*-commutative56.1%
sqrt-div56.1%
metadata-eval56.1%
un-div-inv56.1%
+-commutative56.1%
pow156.1%
pow-div5.7%
metadata-eval5.7%
pow15.7%
Applied egg-rr5.7%
expm1-def5.7%
expm1-log1p5.7%
Simplified5.7%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr5.7%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified5.7%
Final simplification5.7%
(FPCore (x) :precision binary64 (* (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0)))) (* x (sqrt (/ 1.0 PI)))))
double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0)))) * (x * sqrt((1.0 / ((double) M_PI))));
}
public static double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0)))) * (x * Math.sqrt((1.0 / Math.PI)));
}
def code(x): return (1.0 + (((0.5 / (x * x)) + (1.875 / math.pow(x, 6.0))) + (0.75 / math.pow(x, 4.0)))) * (x * math.sqrt((1.0 / math.pi)))
function code(x) return Float64(Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0)))) * Float64(x * sqrt(Float64(1.0 / pi)))) end
function tmp = code(x) tmp = (1.0 + (((0.5 / (x * x)) + (1.875 / (x ^ 6.0))) + (0.75 / (x ^ 4.0)))) * (x * sqrt((1.0 / pi))); end
code[x_] := N[(N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right) \cdot \left(x \cdot \sqrt{\frac{1}{\pi}}\right)
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 56.1%
*-commutative56.1%
distribute-lft-out56.1%
unpow156.1%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow56.1%
unpow156.1%
unpow156.1%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow56.1%
unpow156.1%
Simplified56.1%
expm1-log1p-u56.1%
expm1-udef56.1%
*-commutative56.1%
sqrt-div56.1%
metadata-eval56.1%
un-div-inv56.1%
+-commutative56.1%
pow156.1%
pow-div5.7%
metadata-eval5.7%
pow15.7%
Applied egg-rr5.7%
expm1-def5.7%
expm1-log1p5.7%
Simplified5.7%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr5.7%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified5.7%
Taylor expanded in x around inf 5.7%
Final simplification5.7%
(FPCore (x) :precision binary64 (* (+ 1.0 (+ (+ (/ 0.5 (* x x)) (/ 1.875 (pow x 6.0))) (/ 0.75 (pow x 4.0)))) (/ (pow PI -0.5) x)))
double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / pow(x, 6.0))) + (0.75 / pow(x, 4.0)))) * (pow(((double) M_PI), -0.5) / x);
}
public static double code(double x) {
return (1.0 + (((0.5 / (x * x)) + (1.875 / Math.pow(x, 6.0))) + (0.75 / Math.pow(x, 4.0)))) * (Math.pow(Math.PI, -0.5) / x);
}
def code(x): return (1.0 + (((0.5 / (x * x)) + (1.875 / math.pow(x, 6.0))) + (0.75 / math.pow(x, 4.0)))) * (math.pow(math.pi, -0.5) / x)
function code(x) return Float64(Float64(1.0 + Float64(Float64(Float64(0.5 / Float64(x * x)) + Float64(1.875 / (x ^ 6.0))) + Float64(0.75 / (x ^ 4.0)))) * Float64((pi ^ -0.5) / x)) end
function tmp = code(x) tmp = (1.0 + (((0.5 / (x * x)) + (1.875 / (x ^ 6.0))) + (0.75 / (x ^ 4.0)))) * ((pi ^ -0.5) / x); end
code[x_] := N[(N[(1.0 + N[(N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.875 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.75 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[Pi, -0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \left(\left(\frac{0.5}{x \cdot x} + \frac{1.875}{{x}^{6}}\right) + \frac{0.75}{{x}^{4}}\right)\right) \cdot \frac{{\pi}^{-0.5}}{x}
\end{array}
Initial program 100.0%
Simplified99.6%
Taylor expanded in x around 0 2.2%
associate-*r/2.2%
*-rgt-identity2.2%
unpow12.2%
sqr-pow2.2%
fabs-sqr2.2%
sqr-pow2.2%
unpow12.2%
Simplified2.2%
frac-2neg2.2%
div-inv2.2%
metadata-eval2.2%
metadata-eval2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
pow-prod-up2.2%
pow-prod-up2.2%
metadata-eval2.2%
Applied egg-rr2.2%
associate-*r/2.2%
metadata-eval2.2%
neg-mul-12.2%
associate-/r*2.2%
metadata-eval2.2%
Simplified2.2%
add-sqr-sqrt2.2%
fabs-sqr2.2%
add-sqr-sqrt2.2%
expm1-log1p-u2.2%
un-div-inv2.2%
expm1-udef1.6%
un-div-inv1.6%
inv-pow1.6%
sqrt-pow11.6%
metadata-eval1.6%
add-sqr-sqrt1.6%
fabs-sqr1.6%
add-sqr-sqrt1.6%
Applied egg-rr1.6%
expm1-def2.2%
expm1-log1p2.2%
Simplified2.2%
Final simplification2.2%
herbie shell --seed 2023300
(FPCore (x)
:name "Jmat.Real.erfi, branch x greater than or equal to 5"
:precision binary64
:pre (>= x 0.5)
(* (* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x)))) (+ (+ (+ (/ 1.0 (fabs x)) (* (/ 1.0 2.0) (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 3.0 4.0) (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 15.0 8.0) (* (* (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))))