
(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 17 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
(let* ((t_0 (* (fabs x) (* x x))) (t_1 (* (fabs x) (* (fabs x) t_0))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* 0.6666666666666666 t_0)) (* 0.2 t_1))
(* 0.047619047619047616 (* (fabs x) (* (fabs x) t_1))))))))
double code(double x) {
double t_0 = fabs(x) * (x * x);
double t_1 = fabs(x) * (fabs(x) * t_0);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + (0.6666666666666666 * t_0)) + (0.2 * t_1)) + (0.047619047619047616 * (fabs(x) * (fabs(x) * t_1))))));
}
public static double code(double x) {
double t_0 = Math.abs(x) * (x * x);
double t_1 = Math.abs(x) * (Math.abs(x) * t_0);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + (0.6666666666666666 * t_0)) + (0.2 * t_1)) + (0.047619047619047616 * (Math.abs(x) * (Math.abs(x) * t_1))))));
}
def code(x): t_0 = math.fabs(x) * (x * x) t_1 = math.fabs(x) * (math.fabs(x) * t_0) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + (0.6666666666666666 * t_0)) + (0.2 * t_1)) + (0.047619047619047616 * (math.fabs(x) * (math.fabs(x) * t_1))))))
function code(x) t_0 = Float64(abs(x) * Float64(x * x)) t_1 = Float64(abs(x) * Float64(abs(x) * t_0)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(0.6666666666666666 * t_0)) + Float64(0.2 * t_1)) + Float64(0.047619047619047616 * Float64(abs(x) * Float64(abs(x) * t_1)))))) end
function tmp = code(x) t_0 = abs(x) * (x * x); t_1 = abs(x) * (abs(x) * t_0); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + (0.6666666666666666 * t_0)) + (0.2 * t_1)) + (0.047619047619047616 * (abs(x) * (abs(x) * t_1)))))); end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[x], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * t$95$0), $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[(0.6666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.2 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[(N[Abs[x], $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|x\right| \cdot \left(x \cdot x\right)\\
t_1 := \left|x\right| \cdot \left(\left|x\right| \cdot t_0\right)\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + 0.6666666666666666 \cdot t_0\right) + 0.2 \cdot t_1\right) + 0.047619047619047616 \cdot \left(\left|x\right| \cdot \left(\left|x\right| \cdot t_1\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) (* x x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+
(fma 2.0 (fabs x) (* 0.6666666666666666 (* (fabs x) (* x x))))
(* 0.2 (* (fabs x) t_0)))
(* 0.047619047619047616 (* (fabs x) (* (* x x) t_0))))))))
double code(double x) {
double t_0 = (x * x) * (x * x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((fma(2.0, fabs(x), (0.6666666666666666 * (fabs(x) * (x * x)))) + (0.2 * (fabs(x) * t_0))) + (0.047619047619047616 * (fabs(x) * ((x * x) * t_0))))));
}
function code(x) t_0 = Float64(Float64(x * x) * Float64(x * x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(fma(2.0, abs(x), Float64(0.6666666666666666 * Float64(abs(x) * Float64(x * x)))) + Float64(0.2 * Float64(abs(x) * t_0))) + Float64(0.047619047619047616 * Float64(abs(x) * Float64(Float64(x * x) * t_0)))))) end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision] + N[(0.6666666666666666 * N[(N[Abs[x], $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2 * N[(N[Abs[x], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[(N[Abs[x], $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\mathsf{fma}\left(2, \left|x\right|, 0.6666666666666666 \cdot \left(\left|x\right| \cdot \left(x \cdot x\right)\right)\right) + 0.2 \cdot \left(\left|x\right| \cdot t_0\right)\right) + 0.047619047619047616 \cdot \left(\left|x\right| \cdot \left(\left(x \cdot x\right) \cdot t_0\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x)
:precision binary64
(fabs
(*
(* x (sqrt (/ 1.0 PI)))
(+
(+ 2.0 (* 0.6666666666666666 (* x x)))
(+ (* 0.2 (pow x 4.0)) (* 0.047619047619047616 (pow x 6.0)))))))
double code(double x) {
return fabs(((x * sqrt((1.0 / ((double) M_PI)))) * ((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * pow(x, 4.0)) + (0.047619047619047616 * pow(x, 6.0))))));
}
public static double code(double x) {
return Math.abs(((x * Math.sqrt((1.0 / Math.PI))) * ((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * Math.pow(x, 4.0)) + (0.047619047619047616 * Math.pow(x, 6.0))))));
}
def code(x): return math.fabs(((x * math.sqrt((1.0 / math.pi))) * ((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * math.pow(x, 4.0)) + (0.047619047619047616 * math.pow(x, 6.0))))))
function code(x) return abs(Float64(Float64(x * sqrt(Float64(1.0 / pi))) * Float64(Float64(2.0 + Float64(0.6666666666666666 * Float64(x * x))) + Float64(Float64(0.2 * (x ^ 4.0)) + Float64(0.047619047619047616 * (x ^ 6.0)))))) end
function tmp = code(x) tmp = abs(((x * sqrt((1.0 / pi))) * ((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * (x ^ 4.0)) + (0.047619047619047616 * (x ^ 6.0)))))); end
code[x_] := N[Abs[N[(N[(x * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 + N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(x \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left(\left(2 + 0.6666666666666666 \cdot \left(x \cdot x\right)\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in x around 0 99.8%
unpow199.8%
sqr-pow31.4%
fabs-sqr31.4%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
metadata-eval92.1%
fma-udef92.1%
metadata-eval92.1%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x)
:precision binary64
(fabs
(*
(+
(+ 2.0 (* 0.6666666666666666 (* x x)))
(+ (* 0.2 (pow x 4.0)) (* 0.047619047619047616 (pow x 6.0))))
(/ x (sqrt PI)))))
double code(double x) {
return fabs((((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * pow(x, 4.0)) + (0.047619047619047616 * pow(x, 6.0)))) * (x / sqrt(((double) M_PI)))));
}
public static double code(double x) {
return Math.abs((((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * Math.pow(x, 4.0)) + (0.047619047619047616 * Math.pow(x, 6.0)))) * (x / Math.sqrt(Math.PI))));
}
def code(x): return math.fabs((((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * math.pow(x, 4.0)) + (0.047619047619047616 * math.pow(x, 6.0)))) * (x / math.sqrt(math.pi))))
function code(x) return abs(Float64(Float64(Float64(2.0 + Float64(0.6666666666666666 * Float64(x * x))) + Float64(Float64(0.2 * (x ^ 4.0)) + Float64(0.047619047619047616 * (x ^ 6.0)))) * Float64(x / sqrt(pi)))) end
function tmp = code(x) tmp = abs((((2.0 + (0.6666666666666666 * (x * x))) + ((0.2 * (x ^ 4.0)) + (0.047619047619047616 * (x ^ 6.0)))) * (x / sqrt(pi)))); end
code[x_] := N[Abs[N[(N[(N[(2.0 + N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(\left(2 + 0.6666666666666666 \cdot \left(x \cdot x\right)\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right) \cdot \frac{x}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in x around 0 99.8%
unpow199.8%
sqr-pow31.4%
fabs-sqr31.4%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
metadata-eval92.1%
fma-udef92.1%
metadata-eval92.1%
Applied egg-rr99.8%
expm1-log1p-u64.3%
expm1-udef6.4%
sqrt-div6.4%
metadata-eval6.4%
un-div-inv6.4%
Applied egg-rr6.4%
expm1-def63.9%
expm1-log1p99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x)
:precision binary64
(fabs
(*
(* x (sqrt (/ 1.0 PI)))
(+
(* 0.047619047619047616 (pow x 6.0))
(fma 0.6666666666666666 (* x x) 2.0)))))
double code(double x) {
return fabs(((x * sqrt((1.0 / ((double) M_PI)))) * ((0.047619047619047616 * pow(x, 6.0)) + fma(0.6666666666666666, (x * x), 2.0))));
}
function code(x) return abs(Float64(Float64(x * sqrt(Float64(1.0 / pi))) * Float64(Float64(0.047619047619047616 * (x ^ 6.0)) + fma(0.6666666666666666, Float64(x * x), 2.0)))) end
code[x_] := N[Abs[N[(N[(x * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(x \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left(0.047619047619047616 \cdot {x}^{6} + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right|
\end{array}
Initial program 99.8%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in x around 0 99.8%
unpow199.8%
sqr-pow31.4%
fabs-sqr31.4%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
Taylor expanded in x around inf 98.4%
Final simplification98.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 PI))))
(if (<= x -2.2)
(fabs
(* t_0 (+ (* 0.2 (pow x 5.0)) (* 0.047619047619047616 (pow x 7.0)))))
(fabs
(*
(* x t_0)
(+ (+ 2.0 (* 0.6666666666666666 (* x x))) (* 0.2 (pow x 4.0))))))))
double code(double x) {
double t_0 = sqrt((1.0 / ((double) M_PI)));
double tmp;
if (x <= -2.2) {
tmp = fabs((t_0 * ((0.2 * pow(x, 5.0)) + (0.047619047619047616 * pow(x, 7.0)))));
} else {
tmp = fabs(((x * t_0) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * pow(x, 4.0)))));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.sqrt((1.0 / Math.PI));
double tmp;
if (x <= -2.2) {
tmp = Math.abs((t_0 * ((0.2 * Math.pow(x, 5.0)) + (0.047619047619047616 * Math.pow(x, 7.0)))));
} else {
tmp = Math.abs(((x * t_0) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * Math.pow(x, 4.0)))));
}
return tmp;
}
def code(x): t_0 = math.sqrt((1.0 / math.pi)) tmp = 0 if x <= -2.2: tmp = math.fabs((t_0 * ((0.2 * math.pow(x, 5.0)) + (0.047619047619047616 * math.pow(x, 7.0))))) else: tmp = math.fabs(((x * t_0) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * math.pow(x, 4.0))))) return tmp
function code(x) t_0 = sqrt(Float64(1.0 / pi)) tmp = 0.0 if (x <= -2.2) tmp = abs(Float64(t_0 * Float64(Float64(0.2 * (x ^ 5.0)) + Float64(0.047619047619047616 * (x ^ 7.0))))); else tmp = abs(Float64(Float64(x * t_0) * Float64(Float64(2.0 + Float64(0.6666666666666666 * Float64(x * x))) + Float64(0.2 * (x ^ 4.0))))); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((1.0 / pi)); tmp = 0.0; if (x <= -2.2) tmp = abs((t_0 * ((0.2 * (x ^ 5.0)) + (0.047619047619047616 * (x ^ 7.0))))); else tmp = abs(((x * t_0) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * (x ^ 4.0))))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.2], N[Abs[N[(t$95$0 * N[(N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x * t$95$0), $MachinePrecision] * N[(N[(2.0 + N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\pi}}\\
\mathbf{if}\;x \leq -2.2:\\
\;\;\;\;\left|t_0 \cdot \left(0.2 \cdot {x}^{5} + 0.047619047619047616 \cdot {x}^{7}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(x \cdot t_0\right) \cdot \left(\left(2 + 0.6666666666666666 \cdot \left(x \cdot x\right)\right) + 0.2 \cdot {x}^{4}\right)\right|\\
\end{array}
\end{array}
if x < -2.2000000000000002Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around inf 99.4%
associate-*r*99.4%
associate-*r*99.4%
Simplified99.5%
Taylor expanded in x around 0 99.5%
if -2.2000000000000002 < x Initial program 99.8%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in x around 0 99.8%
unpow199.8%
sqr-pow48.7%
fabs-sqr48.7%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
Taylor expanded in x around 0 98.8%
metadata-eval98.8%
fma-udef98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification99.1%
(FPCore (x) :precision binary64 (fabs (/ (fma 2.0 x (* 0.047619047619047616 (pow x 7.0))) (sqrt PI))))
double code(double x) {
return fabs((fma(2.0, x, (0.047619047619047616 * pow(x, 7.0))) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(fma(2.0, x, Float64(0.047619047619047616 * (x ^ 7.0))) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(2.0 * x + N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(2, x, 0.047619047619047616 \cdot {x}^{7}\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
Simplified99.4%
Taylor expanded in x around inf 97.3%
Final simplification97.3%
(FPCore (x)
:precision binary64
(if (<= x -2.7)
(fabs (* (pow x 7.0) (/ 0.047619047619047616 (sqrt PI))))
(fabs
(*
(* x (sqrt (/ 1.0 PI)))
(+ (+ 2.0 (* 0.6666666666666666 (* x x))) (* 0.2 (pow x 4.0)))))))
double code(double x) {
double tmp;
if (x <= -2.7) {
tmp = fabs((pow(x, 7.0) * (0.047619047619047616 / sqrt(((double) M_PI)))));
} else {
tmp = fabs(((x * sqrt((1.0 / ((double) M_PI)))) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * pow(x, 4.0)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -2.7) {
tmp = Math.abs((Math.pow(x, 7.0) * (0.047619047619047616 / Math.sqrt(Math.PI))));
} else {
tmp = Math.abs(((x * Math.sqrt((1.0 / Math.PI))) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * Math.pow(x, 4.0)))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -2.7: tmp = math.fabs((math.pow(x, 7.0) * (0.047619047619047616 / math.sqrt(math.pi)))) else: tmp = math.fabs(((x * math.sqrt((1.0 / math.pi))) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * math.pow(x, 4.0))))) return tmp
function code(x) tmp = 0.0 if (x <= -2.7) tmp = abs(Float64((x ^ 7.0) * Float64(0.047619047619047616 / sqrt(pi)))); else tmp = abs(Float64(Float64(x * sqrt(Float64(1.0 / pi))) * Float64(Float64(2.0 + Float64(0.6666666666666666 * Float64(x * x))) + Float64(0.2 * (x ^ 4.0))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -2.7) tmp = abs(((x ^ 7.0) * (0.047619047619047616 / sqrt(pi)))); else tmp = abs(((x * sqrt((1.0 / pi))) * ((2.0 + (0.6666666666666666 * (x * x))) + (0.2 * (x ^ 4.0))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -2.7], N[Abs[N[(N[Power[x, 7.0], $MachinePrecision] * N[(0.047619047619047616 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x * N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 + N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7:\\
\;\;\;\;\left|{x}^{7} \cdot \frac{0.047619047619047616}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(x \cdot \sqrt{\frac{1}{\pi}}\right) \cdot \left(\left(2 + 0.6666666666666666 \cdot \left(x \cdot x\right)\right) + 0.2 \cdot {x}^{4}\right)\right|\\
\end{array}
\end{array}
if x < -2.7000000000000002Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
Simplified99.9%
Taylor expanded in x around inf 98.3%
expm1-log1p-u0.0%
expm1-udef0.0%
sqrt-div0.0%
metadata-eval0.0%
un-div-inv0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p98.3%
associate-*r/98.4%
associate-/l*98.4%
associate-/r/98.4%
Simplified98.4%
if -2.7000000000000002 < x Initial program 99.8%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in x around 0 99.8%
unpow199.8%
sqr-pow48.7%
fabs-sqr48.7%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
Taylor expanded in x around 0 98.8%
metadata-eval98.8%
fma-udef98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification98.7%
(FPCore (x)
:precision binary64
(if (<= x -2.2)
(fabs (sqrt (* (/ (pow x 14.0) PI) 0.0022675736961451248)))
(fabs
(* (sqrt (/ 1.0 PI)) (+ (* x (* x (* x 0.6666666666666666))) (* 2.0 x))))))
double code(double x) {
double tmp;
if (x <= -2.2) {
tmp = fabs(sqrt(((pow(x, 14.0) / ((double) M_PI)) * 0.0022675736961451248)));
} else {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -2.2) {
tmp = Math.abs(Math.sqrt(((Math.pow(x, 14.0) / Math.PI) * 0.0022675736961451248)));
} else {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -2.2: tmp = math.fabs(math.sqrt(((math.pow(x, 14.0) / math.pi) * 0.0022675736961451248))) else: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))) return tmp
function code(x) tmp = 0.0 if (x <= -2.2) tmp = abs(sqrt(Float64(Float64((x ^ 14.0) / pi) * 0.0022675736961451248))); else tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(x * Float64(x * Float64(x * 0.6666666666666666))) + Float64(2.0 * x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -2.2) tmp = abs(sqrt((((x ^ 14.0) / pi) * 0.0022675736961451248))); else tmp = abs((sqrt((1.0 / pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -2.2], N[Abs[N[Sqrt[N[(N[(N[Power[x, 14.0], $MachinePrecision] / Pi), $MachinePrecision] * 0.0022675736961451248), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(x * N[(x * N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2:\\
\;\;\;\;\left|\sqrt{\frac{{x}^{14}}{\pi} \cdot 0.0022675736961451248}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.6666666666666666\right)\right) + 2 \cdot x\right)\right|\\
\end{array}
\end{array}
if x < -2.2000000000000002Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
Simplified99.9%
Taylor expanded in x around inf 98.3%
add-sqr-sqrt0.0%
sqrt-unprod92.1%
*-commutative92.1%
*-commutative92.1%
swap-sqr92.1%
*-commutative92.1%
*-commutative92.1%
swap-sqr92.1%
add-sqr-sqrt92.1%
pow-prod-up92.1%
metadata-eval92.1%
metadata-eval92.2%
Applied egg-rr92.2%
metadata-eval92.2%
pow-sqr92.2%
associate-*l/92.2%
*-lft-identity92.2%
pow-sqr92.2%
metadata-eval92.2%
Simplified92.2%
if -2.2000000000000002 < x Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
*-commutative98.5%
associate-*r*98.5%
distribute-rgt-in98.5%
+-commutative98.5%
fma-def98.5%
unpow298.5%
unpow198.5%
sqr-pow48.1%
fabs-sqr48.1%
sqr-pow98.5%
unpow198.5%
fma-def98.5%
associate-*r*98.5%
fma-def98.5%
Simplified98.5%
fma-udef98.5%
distribute-rgt-in98.5%
*-commutative98.5%
Applied egg-rr98.5%
Final simplification96.2%
(FPCore (x)
:precision binary64
(if (<= x -2.2)
(fabs (* 0.047619047619047616 (/ (pow x 7.0) (sqrt PI))))
(fabs
(* (sqrt (/ 1.0 PI)) (+ (* x (* x (* x 0.6666666666666666))) (* 2.0 x))))))
double code(double x) {
double tmp;
if (x <= -2.2) {
tmp = fabs((0.047619047619047616 * (pow(x, 7.0) / sqrt(((double) M_PI)))));
} else {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -2.2) {
tmp = Math.abs((0.047619047619047616 * (Math.pow(x, 7.0) / Math.sqrt(Math.PI))));
} else {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -2.2: tmp = math.fabs((0.047619047619047616 * (math.pow(x, 7.0) / math.sqrt(math.pi)))) else: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))) return tmp
function code(x) tmp = 0.0 if (x <= -2.2) tmp = abs(Float64(0.047619047619047616 * Float64((x ^ 7.0) / sqrt(pi)))); else tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(x * Float64(x * Float64(x * 0.6666666666666666))) + Float64(2.0 * x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -2.2) tmp = abs((0.047619047619047616 * ((x ^ 7.0) / sqrt(pi)))); else tmp = abs((sqrt((1.0 / pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -2.2], N[Abs[N[(0.047619047619047616 * N[(N[Power[x, 7.0], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(x * N[(x * N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2:\\
\;\;\;\;\left|0.047619047619047616 \cdot \frac{{x}^{7}}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.6666666666666666\right)\right) + 2 \cdot x\right)\right|\\
\end{array}
\end{array}
if x < -2.2000000000000002Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
Simplified99.9%
Taylor expanded in x around inf 98.3%
expm1-log1p-u0.0%
expm1-udef0.0%
sqrt-div0.0%
metadata-eval0.0%
un-div-inv0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p98.3%
Simplified98.3%
if -2.2000000000000002 < x Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
*-commutative98.5%
associate-*r*98.5%
distribute-rgt-in98.5%
+-commutative98.5%
fma-def98.5%
unpow298.5%
unpow198.5%
sqr-pow48.1%
fabs-sqr48.1%
sqr-pow98.5%
unpow198.5%
fma-def98.5%
associate-*r*98.5%
fma-def98.5%
Simplified98.5%
fma-udef98.5%
distribute-rgt-in98.5%
*-commutative98.5%
Applied egg-rr98.5%
Final simplification98.4%
(FPCore (x)
:precision binary64
(if (<= x -2.2)
(fabs (* (pow x 7.0) (/ 0.047619047619047616 (sqrt PI))))
(fabs
(* (sqrt (/ 1.0 PI)) (+ (* x (* x (* x 0.6666666666666666))) (* 2.0 x))))))
double code(double x) {
double tmp;
if (x <= -2.2) {
tmp = fabs((pow(x, 7.0) * (0.047619047619047616 / sqrt(((double) M_PI)))));
} else {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -2.2) {
tmp = Math.abs((Math.pow(x, 7.0) * (0.047619047619047616 / Math.sqrt(Math.PI))));
} else {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -2.2: tmp = math.fabs((math.pow(x, 7.0) * (0.047619047619047616 / math.sqrt(math.pi)))) else: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))) return tmp
function code(x) tmp = 0.0 if (x <= -2.2) tmp = abs(Float64((x ^ 7.0) * Float64(0.047619047619047616 / sqrt(pi)))); else tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(x * Float64(x * Float64(x * 0.6666666666666666))) + Float64(2.0 * x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -2.2) tmp = abs(((x ^ 7.0) * (0.047619047619047616 / sqrt(pi)))); else tmp = abs((sqrt((1.0 / pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -2.2], N[Abs[N[(N[Power[x, 7.0], $MachinePrecision] * N[(0.047619047619047616 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(x * N[(x * N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2:\\
\;\;\;\;\left|{x}^{7} \cdot \frac{0.047619047619047616}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.6666666666666666\right)\right) + 2 \cdot x\right)\right|\\
\end{array}
\end{array}
if x < -2.2000000000000002Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
Simplified99.9%
Taylor expanded in x around inf 98.3%
expm1-log1p-u0.0%
expm1-udef0.0%
sqrt-div0.0%
metadata-eval0.0%
un-div-inv0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p98.3%
associate-*r/98.4%
associate-/l*98.4%
associate-/r/98.4%
Simplified98.4%
if -2.2000000000000002 < x Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
*-commutative98.5%
associate-*r*98.5%
distribute-rgt-in98.5%
+-commutative98.5%
fma-def98.5%
unpow298.5%
unpow198.5%
sqr-pow48.1%
fabs-sqr48.1%
sqr-pow98.5%
unpow198.5%
fma-def98.5%
associate-*r*98.5%
fma-def98.5%
Simplified98.5%
fma-udef98.5%
distribute-rgt-in98.5%
*-commutative98.5%
Applied egg-rr98.5%
Final simplification98.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (* x (* x 0.6666666666666666))))
(if (<= x -2e+154)
(fabs (sqrt (/ (* (* x x) 4.0) PI)))
(fabs (* (sqrt (/ 1.0 PI)) (* x (/ (- (* t_0 t_0) 4.0) (- t_0 2.0))))))))
double code(double x) {
double t_0 = x * (x * 0.6666666666666666);
double tmp;
if (x <= -2e+154) {
tmp = fabs(sqrt((((x * x) * 4.0) / ((double) M_PI))));
} else {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * (x * (((t_0 * t_0) - 4.0) / (t_0 - 2.0)))));
}
return tmp;
}
public static double code(double x) {
double t_0 = x * (x * 0.6666666666666666);
double tmp;
if (x <= -2e+154) {
tmp = Math.abs(Math.sqrt((((x * x) * 4.0) / Math.PI)));
} else {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * (x * (((t_0 * t_0) - 4.0) / (t_0 - 2.0)))));
}
return tmp;
}
def code(x): t_0 = x * (x * 0.6666666666666666) tmp = 0 if x <= -2e+154: tmp = math.fabs(math.sqrt((((x * x) * 4.0) / math.pi))) else: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * (x * (((t_0 * t_0) - 4.0) / (t_0 - 2.0))))) return tmp
function code(x) t_0 = Float64(x * Float64(x * 0.6666666666666666)) tmp = 0.0 if (x <= -2e+154) tmp = abs(sqrt(Float64(Float64(Float64(x * x) * 4.0) / pi))); else tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(x * Float64(Float64(Float64(t_0 * t_0) - 4.0) / Float64(t_0 - 2.0))))); end return tmp end
function tmp_2 = code(x) t_0 = x * (x * 0.6666666666666666); tmp = 0.0; if (x <= -2e+154) tmp = abs(sqrt((((x * x) * 4.0) / pi))); else tmp = abs((sqrt((1.0 / pi)) * (x * (((t_0 * t_0) - 4.0) / (t_0 - 2.0))))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(x * N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+154], N[Abs[N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] * 4.0), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(x * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - 4.0), $MachinePrecision] / N[(t$95$0 - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot 0.6666666666666666\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{+154}:\\
\;\;\;\;\left|\sqrt{\frac{\left(x \cdot x\right) \cdot 4}{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \frac{t_0 \cdot t_0 - 4}{t_0 - 2}\right)\right|\\
\end{array}
\end{array}
if x < -2.00000000000000007e154Initial program 100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 7.1%
associate-*r*7.1%
*-commutative7.1%
associate-*l*7.1%
unpow17.1%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow7.1%
unpow17.1%
Simplified7.1%
expm1-log1p-u0.0%
expm1-udef0.0%
associate-*r*0.0%
sqrt-div0.0%
metadata-eval0.0%
un-div-inv0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p7.1%
Simplified7.1%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
*-commutative100.0%
*-commutative100.0%
frac-times100.0%
swap-sqr100.0%
metadata-eval100.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
if -2.00000000000000007e154 < x Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 84.0%
associate-*r*84.0%
associate-*r*84.0%
distribute-rgt-out84.0%
*-commutative84.0%
associate-*r*84.0%
distribute-rgt-in84.0%
+-commutative84.0%
fma-def84.0%
unpow284.0%
unpow184.0%
sqr-pow37.1%
fabs-sqr37.1%
sqr-pow84.0%
unpow184.0%
fma-def84.0%
associate-*r*84.0%
fma-def84.0%
Simplified84.0%
fma-udef84.0%
flip-+86.6%
*-commutative86.6%
*-commutative86.6%
metadata-eval86.6%
*-commutative86.6%
Applied egg-rr86.6%
Final simplification88.8%
(FPCore (x) :precision binary64 (fabs (* (sqrt (/ 1.0 PI)) (+ (* x (* x (* x 0.6666666666666666))) (* 2.0 x)))))
double code(double x) {
return fabs((sqrt((1.0 / ((double) M_PI))) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
public static double code(double x) {
return Math.abs((Math.sqrt((1.0 / Math.PI)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))));
}
def code(x): return math.fabs((math.sqrt((1.0 / math.pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x))))
function code(x) return abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(x * Float64(x * Float64(x * 0.6666666666666666))) + Float64(2.0 * x)))) end
function tmp = code(x) tmp = abs((sqrt((1.0 / pi)) * ((x * (x * (x * 0.6666666666666666))) + (2.0 * x)))); end
code[x_] := N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(x * N[(x * N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.6666666666666666\right)\right) + 2 \cdot x\right)\right|
\end{array}
Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 86.6%
associate-*r*86.6%
associate-*r*86.6%
distribute-rgt-out86.6%
*-commutative86.6%
associate-*r*86.6%
distribute-rgt-in86.6%
+-commutative86.6%
fma-def86.6%
unpow286.6%
unpow186.6%
sqr-pow31.0%
fabs-sqr31.0%
sqr-pow86.6%
unpow186.6%
fma-def86.6%
associate-*r*86.6%
fma-def86.6%
Simplified86.6%
fma-udef86.6%
distribute-rgt-in86.6%
*-commutative86.6%
Applied egg-rr86.6%
Final simplification86.6%
(FPCore (x) :precision binary64 (if (<= x -1.7) (fabs (* (sqrt (/ 1.0 PI)) (* x (* 0.6666666666666666 (* x x))))) (fabs (* x (/ 2.0 (sqrt PI))))))
double code(double x) {
double tmp;
if (x <= -1.7) {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * (x * (0.6666666666666666 * (x * x)))));
} else {
tmp = fabs((x * (2.0 / sqrt(((double) M_PI)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -1.7) {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * (x * (0.6666666666666666 * (x * x)))));
} else {
tmp = Math.abs((x * (2.0 / Math.sqrt(Math.PI))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.7: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * (x * (0.6666666666666666 * (x * x))))) else: tmp = math.fabs((x * (2.0 / math.sqrt(math.pi)))) return tmp
function code(x) tmp = 0.0 if (x <= -1.7) tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(x * Float64(0.6666666666666666 * Float64(x * x))))); else tmp = abs(Float64(x * Float64(2.0 / sqrt(pi)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.7) tmp = abs((sqrt((1.0 / pi)) * (x * (0.6666666666666666 * (x * x))))); else tmp = abs((x * (2.0 / sqrt(pi)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.7], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(x * N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{2}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < -1.69999999999999996Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 65.1%
associate-*r*65.1%
associate-*r*65.1%
distribute-rgt-out65.1%
*-commutative65.1%
associate-*r*65.1%
distribute-rgt-in65.1%
+-commutative65.1%
fma-def65.1%
unpow265.1%
unpow165.1%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow65.1%
unpow165.1%
fma-def65.1%
associate-*r*65.1%
fma-def65.1%
Simplified65.1%
Taylor expanded in x around inf 65.1%
unpow265.1%
Simplified65.1%
if -1.69999999999999996 < x Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 97.3%
associate-*r*97.3%
*-commutative97.3%
associate-*l*97.3%
unpow197.3%
sqr-pow47.8%
fabs-sqr47.8%
sqr-pow97.3%
unpow197.3%
Simplified97.3%
expm1-log1p-u97.3%
expm1-udef8.0%
associate-*r*8.0%
sqrt-div8.0%
metadata-eval8.0%
un-div-inv8.0%
Applied egg-rr8.0%
expm1-def96.7%
expm1-log1p96.7%
Simplified96.7%
expm1-log1p-u96.7%
expm1-udef8.0%
*-commutative8.0%
*-un-lft-identity8.0%
times-frac8.0%
metadata-eval8.0%
Applied egg-rr8.0%
expm1-def96.7%
expm1-log1p96.7%
associate-*r/96.7%
*-commutative96.7%
associate-*r/97.3%
Simplified97.3%
Final simplification85.9%
(FPCore (x) :precision binary64 (fabs (* (sqrt (/ 1.0 PI)) (* x (+ 2.0 (* x (* x 0.6666666666666666)))))))
double code(double x) {
return fabs((sqrt((1.0 / ((double) M_PI))) * (x * (2.0 + (x * (x * 0.6666666666666666))))));
}
public static double code(double x) {
return Math.abs((Math.sqrt((1.0 / Math.PI)) * (x * (2.0 + (x * (x * 0.6666666666666666))))));
}
def code(x): return math.fabs((math.sqrt((1.0 / math.pi)) * (x * (2.0 + (x * (x * 0.6666666666666666))))))
function code(x) return abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(x * Float64(2.0 + Float64(x * Float64(x * 0.6666666666666666)))))) end
function tmp = code(x) tmp = abs((sqrt((1.0 / pi)) * (x * (2.0 + (x * (x * 0.6666666666666666)))))); end
code[x_] := N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(x * N[(2.0 + N[(x * N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sqrt{\frac{1}{\pi}} \cdot \left(x \cdot \left(2 + x \cdot \left(x \cdot 0.6666666666666666\right)\right)\right)\right|
\end{array}
Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 86.6%
associate-*r*86.6%
associate-*r*86.6%
distribute-rgt-out86.6%
*-commutative86.6%
associate-*r*86.6%
distribute-rgt-in86.6%
+-commutative86.6%
fma-def86.6%
unpow286.6%
unpow186.6%
sqr-pow31.0%
fabs-sqr31.0%
sqr-pow86.6%
unpow186.6%
fma-def86.6%
associate-*r*86.6%
fma-def86.6%
Simplified86.6%
fma-udef86.6%
*-commutative86.6%
Applied egg-rr86.6%
Final simplification86.6%
(FPCore (x) :precision binary64 (if (<= x -2e-5) (fabs (sqrt (/ (* (* x x) 4.0) PI))) (fabs (* x (/ 2.0 (sqrt PI))))))
double code(double x) {
double tmp;
if (x <= -2e-5) {
tmp = fabs(sqrt((((x * x) * 4.0) / ((double) M_PI))));
} else {
tmp = fabs((x * (2.0 / sqrt(((double) M_PI)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -2e-5) {
tmp = Math.abs(Math.sqrt((((x * x) * 4.0) / Math.PI)));
} else {
tmp = Math.abs((x * (2.0 / Math.sqrt(Math.PI))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -2e-5: tmp = math.fabs(math.sqrt((((x * x) * 4.0) / math.pi))) else: tmp = math.fabs((x * (2.0 / math.sqrt(math.pi)))) return tmp
function code(x) tmp = 0.0 if (x <= -2e-5) tmp = abs(sqrt(Float64(Float64(Float64(x * x) * 4.0) / pi))); else tmp = abs(Float64(x * Float64(2.0 / sqrt(pi)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -2e-5) tmp = abs(sqrt((((x * x) * 4.0) / pi))); else tmp = abs((x * (2.0 / sqrt(pi)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -2e-5], N[Abs[N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] * 4.0), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-5}:\\
\;\;\;\;\left|\sqrt{\frac{\left(x \cdot x\right) \cdot 4}{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{2}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < -2.00000000000000016e-5Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 8.2%
associate-*r*8.2%
*-commutative8.2%
associate-*l*8.2%
unpow18.2%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow8.2%
unpow18.2%
Simplified8.2%
expm1-log1p-u2.6%
expm1-udef2.6%
associate-*r*2.6%
sqrt-div2.6%
metadata-eval2.6%
un-div-inv2.6%
Applied egg-rr2.6%
expm1-def2.6%
expm1-log1p8.2%
Simplified8.2%
add-sqr-sqrt0.0%
sqrt-unprod48.8%
*-commutative48.8%
*-commutative48.8%
frac-times48.8%
swap-sqr48.8%
metadata-eval48.8%
add-sqr-sqrt48.8%
Applied egg-rr48.8%
if -2.00000000000000016e-5 < x Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 98.8%
associate-*r*98.8%
*-commutative98.8%
associate-*l*98.8%
unpow198.8%
sqr-pow49.2%
fabs-sqr49.2%
sqr-pow98.8%
unpow198.8%
Simplified98.8%
expm1-log1p-u98.8%
expm1-udef6.7%
associate-*r*6.7%
sqrt-div6.7%
metadata-eval6.7%
un-div-inv6.7%
Applied egg-rr6.7%
expm1-def98.1%
expm1-log1p98.1%
Simplified98.1%
expm1-log1p-u98.1%
expm1-udef6.7%
*-commutative6.7%
*-un-lft-identity6.7%
times-frac6.7%
metadata-eval6.7%
Applied egg-rr6.7%
expm1-def98.1%
expm1-log1p98.1%
associate-*r/98.1%
*-commutative98.1%
associate-*r/98.8%
Simplified98.8%
Final simplification80.0%
(FPCore (x) :precision binary64 (fabs (* x (/ 2.0 (sqrt PI)))))
double code(double x) {
return fabs((x * (2.0 / sqrt(((double) M_PI)))));
}
public static double code(double x) {
return Math.abs((x * (2.0 / Math.sqrt(Math.PI))));
}
def code(x): return math.fabs((x * (2.0 / math.sqrt(math.pi))))
function code(x) return abs(Float64(x * Float64(2.0 / sqrt(pi)))) end
function tmp = code(x) tmp = abs((x * (2.0 / sqrt(pi)))); end
code[x_] := N[Abs[N[(x * N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|x \cdot \frac{2}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
*-rgt-identity99.8%
Simplified99.8%
Taylor expanded in x around 0 64.8%
associate-*r*64.8%
*-commutative64.8%
associate-*l*64.8%
unpow164.8%
sqr-pow30.8%
fabs-sqr30.8%
sqr-pow64.8%
unpow164.8%
Simplified64.8%
expm1-log1p-u62.7%
expm1-udef5.2%
associate-*r*5.2%
sqrt-div5.2%
metadata-eval5.2%
un-div-inv5.2%
Applied egg-rr5.2%
expm1-def62.3%
expm1-log1p64.4%
Simplified64.4%
expm1-log1p-u62.3%
expm1-udef5.2%
*-commutative5.2%
*-un-lft-identity5.2%
times-frac5.2%
metadata-eval5.2%
Applied egg-rr5.2%
expm1-def62.3%
expm1-log1p64.4%
associate-*r/64.4%
*-commutative64.4%
associate-*r/64.8%
Simplified64.8%
Final simplification64.8%
herbie shell --seed 2023171
(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)))))))