
(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 11 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
(*
(sqrt (/ 1.0 PI))
(+
(* 0.047619047619047616 (pow x 7.0))
(+
(* 0.2 (pow x 5.0))
(+ (* 0.6666666666666666 (pow x 3.0)) (* x 2.0)))))))
double code(double x) {
return fabs((sqrt((1.0 / ((double) M_PI))) * ((0.047619047619047616 * pow(x, 7.0)) + ((0.2 * pow(x, 5.0)) + ((0.6666666666666666 * pow(x, 3.0)) + (x * 2.0))))));
}
public static double code(double x) {
return Math.abs((Math.sqrt((1.0 / Math.PI)) * ((0.047619047619047616 * Math.pow(x, 7.0)) + ((0.2 * Math.pow(x, 5.0)) + ((0.6666666666666666 * Math.pow(x, 3.0)) + (x * 2.0))))));
}
def code(x): return math.fabs((math.sqrt((1.0 / math.pi)) * ((0.047619047619047616 * math.pow(x, 7.0)) + ((0.2 * math.pow(x, 5.0)) + ((0.6666666666666666 * math.pow(x, 3.0)) + (x * 2.0))))))
function code(x) return abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(0.047619047619047616 * (x ^ 7.0)) + Float64(Float64(0.2 * (x ^ 5.0)) + Float64(Float64(0.6666666666666666 * (x ^ 3.0)) + Float64(x * 2.0)))))) end
function tmp = code(x) tmp = abs((sqrt((1.0 / pi)) * ((0.047619047619047616 * (x ^ 7.0)) + ((0.2 * (x ^ 5.0)) + ((0.6666666666666666 * (x ^ 3.0)) + (x * 2.0)))))); end
code[x_] := N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sqrt{\frac{1}{\pi}} \cdot \left(0.047619047619047616 \cdot {x}^{7} + \left(0.2 \cdot {x}^{5} + \left(0.6666666666666666 \cdot {x}^{3} + x \cdot 2\right)\right)\right)\right|
\end{array}
Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 99.9%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around 0 99.8%
Final simplification99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (* 0.6666666666666666 (pow x 3.0)))
(t_1 (sqrt (/ 1.0 PI)))
(t_2 (* 0.2 (pow x 5.0))))
(if (<= (fabs x) 0.4)
(fabs (* t_1 (+ t_2 (+ t_0 (* x 2.0)))))
(fabs (* t_1 (+ (* 0.047619047619047616 (pow x 7.0)) (+ t_2 t_0)))))))
double code(double x) {
double t_0 = 0.6666666666666666 * pow(x, 3.0);
double t_1 = sqrt((1.0 / ((double) M_PI)));
double t_2 = 0.2 * pow(x, 5.0);
double tmp;
if (fabs(x) <= 0.4) {
tmp = fabs((t_1 * (t_2 + (t_0 + (x * 2.0)))));
} else {
tmp = fabs((t_1 * ((0.047619047619047616 * pow(x, 7.0)) + (t_2 + t_0))));
}
return tmp;
}
public static double code(double x) {
double t_0 = 0.6666666666666666 * Math.pow(x, 3.0);
double t_1 = Math.sqrt((1.0 / Math.PI));
double t_2 = 0.2 * Math.pow(x, 5.0);
double tmp;
if (Math.abs(x) <= 0.4) {
tmp = Math.abs((t_1 * (t_2 + (t_0 + (x * 2.0)))));
} else {
tmp = Math.abs((t_1 * ((0.047619047619047616 * Math.pow(x, 7.0)) + (t_2 + t_0))));
}
return tmp;
}
def code(x): t_0 = 0.6666666666666666 * math.pow(x, 3.0) t_1 = math.sqrt((1.0 / math.pi)) t_2 = 0.2 * math.pow(x, 5.0) tmp = 0 if math.fabs(x) <= 0.4: tmp = math.fabs((t_1 * (t_2 + (t_0 + (x * 2.0))))) else: tmp = math.fabs((t_1 * ((0.047619047619047616 * math.pow(x, 7.0)) + (t_2 + t_0)))) return tmp
function code(x) t_0 = Float64(0.6666666666666666 * (x ^ 3.0)) t_1 = sqrt(Float64(1.0 / pi)) t_2 = Float64(0.2 * (x ^ 5.0)) tmp = 0.0 if (abs(x) <= 0.4) tmp = abs(Float64(t_1 * Float64(t_2 + Float64(t_0 + Float64(x * 2.0))))); else tmp = abs(Float64(t_1 * Float64(Float64(0.047619047619047616 * (x ^ 7.0)) + Float64(t_2 + t_0)))); end return tmp end
function tmp_2 = code(x) t_0 = 0.6666666666666666 * (x ^ 3.0); t_1 = sqrt((1.0 / pi)); t_2 = 0.2 * (x ^ 5.0); tmp = 0.0; if (abs(x) <= 0.4) tmp = abs((t_1 * (t_2 + (t_0 + (x * 2.0))))); else tmp = abs((t_1 * ((0.047619047619047616 * (x ^ 7.0)) + (t_2 + t_0)))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 0.4], N[Abs[N[(t$95$1 * N[(t$95$2 + N[(t$95$0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$1 * N[(N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.6666666666666666 \cdot {x}^{3}\\
t_1 := \sqrt{\frac{1}{\pi}}\\
t_2 := 0.2 \cdot {x}^{5}\\
\mathbf{if}\;\left|x\right| \leq 0.4:\\
\;\;\;\;\left|t_1 \cdot \left(t_2 + \left(t_0 + x \cdot 2\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t_1 \cdot \left(0.047619047619047616 \cdot {x}^{7} + \left(t_2 + t_0\right)\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.40000000000000002Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around 0 99.4%
if 0.40000000000000002 < (fabs.f64 x) Initial program 99.9%
Simplified99.8%
Taylor expanded in x around 0 99.9%
Simplified99.9%
fma-udef99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around inf 99.4%
Final simplification99.4%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.4)
(fabs
(*
(sqrt (/ 1.0 PI))
(+ (* 0.2 (pow x 5.0)) (+ (* 0.6666666666666666 (pow x 3.0)) (* x 2.0)))))
(/
(fabs x)
(fabs (* (sqrt PI) (+ (/ 21.0 (pow x 6.0)) (/ -88.2 (pow x 8.0))))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.4) {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * ((0.2 * pow(x, 5.0)) + ((0.6666666666666666 * pow(x, 3.0)) + (x * 2.0)))));
} else {
tmp = fabs(x) / fabs((sqrt(((double) M_PI)) * ((21.0 / pow(x, 6.0)) + (-88.2 / pow(x, 8.0)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.4) {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * ((0.2 * Math.pow(x, 5.0)) + ((0.6666666666666666 * Math.pow(x, 3.0)) + (x * 2.0)))));
} else {
tmp = Math.abs(x) / Math.abs((Math.sqrt(Math.PI) * ((21.0 / Math.pow(x, 6.0)) + (-88.2 / Math.pow(x, 8.0)))));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.4: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * ((0.2 * math.pow(x, 5.0)) + ((0.6666666666666666 * math.pow(x, 3.0)) + (x * 2.0))))) else: tmp = math.fabs(x) / math.fabs((math.sqrt(math.pi) * ((21.0 / math.pow(x, 6.0)) + (-88.2 / math.pow(x, 8.0))))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.4) tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(0.2 * (x ^ 5.0)) + Float64(Float64(0.6666666666666666 * (x ^ 3.0)) + Float64(x * 2.0))))); else tmp = Float64(abs(x) / abs(Float64(sqrt(pi) * Float64(Float64(21.0 / (x ^ 6.0)) + Float64(-88.2 / (x ^ 8.0)))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.4) tmp = abs((sqrt((1.0 / pi)) * ((0.2 * (x ^ 5.0)) + ((0.6666666666666666 * (x ^ 3.0)) + (x * 2.0))))); else tmp = abs(x) / abs((sqrt(pi) * ((21.0 / (x ^ 6.0)) + (-88.2 / (x ^ 8.0))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.4], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[x], $MachinePrecision] / N[Abs[N[(N[Sqrt[Pi], $MachinePrecision] * N[(N[(21.0 / N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(-88.2 / N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.4:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(0.2 \cdot {x}^{5} + \left(0.6666666666666666 \cdot {x}^{3} + x \cdot 2\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|x\right|}{\left|\sqrt{\pi} \cdot \left(\frac{21}{{x}^{6}} + \frac{-88.2}{{x}^{8}}\right)\right|}\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.40000000000000002Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around 0 99.4%
if 0.40000000000000002 < (fabs.f64 x) Initial program 99.9%
Simplified99.9%
Taylor expanded in x around inf 98.8%
+-commutative98.8%
associate-*r*98.8%
associate-*r*98.8%
distribute-rgt-out98.8%
associate-*r/98.8%
metadata-eval98.8%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (* 0.2 (pow x 5.0))))
(if (<= (fabs x) 0.4)
(fabs
(*
(sqrt (/ 1.0 PI))
(+ t_0 (+ (* 0.6666666666666666 (pow x 3.0)) (* x 2.0)))))
(fabs (* (pow PI -0.5) (+ (* 0.047619047619047616 (pow x 7.0)) t_0))))))
double code(double x) {
double t_0 = 0.2 * pow(x, 5.0);
double tmp;
if (fabs(x) <= 0.4) {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * (t_0 + ((0.6666666666666666 * pow(x, 3.0)) + (x * 2.0)))));
} else {
tmp = fabs((pow(((double) M_PI), -0.5) * ((0.047619047619047616 * pow(x, 7.0)) + t_0)));
}
return tmp;
}
public static double code(double x) {
double t_0 = 0.2 * Math.pow(x, 5.0);
double tmp;
if (Math.abs(x) <= 0.4) {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * (t_0 + ((0.6666666666666666 * Math.pow(x, 3.0)) + (x * 2.0)))));
} else {
tmp = Math.abs((Math.pow(Math.PI, -0.5) * ((0.047619047619047616 * Math.pow(x, 7.0)) + t_0)));
}
return tmp;
}
def code(x): t_0 = 0.2 * math.pow(x, 5.0) tmp = 0 if math.fabs(x) <= 0.4: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * (t_0 + ((0.6666666666666666 * math.pow(x, 3.0)) + (x * 2.0))))) else: tmp = math.fabs((math.pow(math.pi, -0.5) * ((0.047619047619047616 * math.pow(x, 7.0)) + t_0))) return tmp
function code(x) t_0 = Float64(0.2 * (x ^ 5.0)) tmp = 0.0 if (abs(x) <= 0.4) tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(t_0 + Float64(Float64(0.6666666666666666 * (x ^ 3.0)) + Float64(x * 2.0))))); else tmp = abs(Float64((pi ^ -0.5) * Float64(Float64(0.047619047619047616 * (x ^ 7.0)) + t_0))); end return tmp end
function tmp_2 = code(x) t_0 = 0.2 * (x ^ 5.0); tmp = 0.0; if (abs(x) <= 0.4) tmp = abs((sqrt((1.0 / pi)) * (t_0 + ((0.6666666666666666 * (x ^ 3.0)) + (x * 2.0))))); else tmp = abs(((pi ^ -0.5) * ((0.047619047619047616 * (x ^ 7.0)) + t_0))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 0.4], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 + N[(N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.2 \cdot {x}^{5}\\
\mathbf{if}\;\left|x\right| \leq 0.4:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(t_0 + \left(0.6666666666666666 \cdot {x}^{3} + x \cdot 2\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot {x}^{7} + t_0\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.40000000000000002Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around 0 99.4%
if 0.40000000000000002 < (fabs.f64 x) Initial program 99.9%
Simplified99.8%
Taylor expanded in x around inf 98.7%
+-commutative98.7%
associate-*r*98.7%
associate-*r*98.7%
distribute-rgt-out98.7%
associate-*r*98.7%
unpow198.7%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow22.3%
unpow122.3%
unpow122.3%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow98.7%
unpow198.7%
pow-plus98.7%
metadata-eval98.7%
Simplified98.7%
distribute-lft-in98.7%
inv-pow98.7%
sqrt-pow198.7%
metadata-eval98.7%
associate-*l*98.7%
pow-plus98.7%
metadata-eval98.7%
inv-pow98.7%
sqrt-pow198.7%
metadata-eval98.7%
Applied egg-rr98.7%
distribute-lft-out98.7%
Simplified98.7%
Final simplification99.2%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.4)
(fabs
(* (sqrt (/ 1.0 PI)) (+ (* 0.6666666666666666 (pow x 3.0)) (* x 2.0))))
(fabs
(*
(pow PI -0.5)
(+ (* 0.047619047619047616 (pow x 7.0)) (* 0.2 (pow x 5.0)))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.4) {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * ((0.6666666666666666 * pow(x, 3.0)) + (x * 2.0))));
} else {
tmp = fabs((pow(((double) M_PI), -0.5) * ((0.047619047619047616 * pow(x, 7.0)) + (0.2 * pow(x, 5.0)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.4) {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * ((0.6666666666666666 * Math.pow(x, 3.0)) + (x * 2.0))));
} else {
tmp = Math.abs((Math.pow(Math.PI, -0.5) * ((0.047619047619047616 * Math.pow(x, 7.0)) + (0.2 * Math.pow(x, 5.0)))));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.4: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * ((0.6666666666666666 * math.pow(x, 3.0)) + (x * 2.0)))) else: tmp = math.fabs((math.pow(math.pi, -0.5) * ((0.047619047619047616 * math.pow(x, 7.0)) + (0.2 * math.pow(x, 5.0))))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.4) tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(0.6666666666666666 * (x ^ 3.0)) + Float64(x * 2.0)))); else tmp = abs(Float64((pi ^ -0.5) * Float64(Float64(0.047619047619047616 * (x ^ 7.0)) + Float64(0.2 * (x ^ 5.0))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.4) tmp = abs((sqrt((1.0 / pi)) * ((0.6666666666666666 * (x ^ 3.0)) + (x * 2.0)))); else tmp = abs(((pi ^ -0.5) * ((0.047619047619047616 * (x ^ 7.0)) + (0.2 * (x ^ 5.0))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.4], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Power[Pi, -0.5], $MachinePrecision] * N[(N[(0.047619047619047616 * N[Power[x, 7.0], $MachinePrecision]), $MachinePrecision] + N[(0.2 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.4:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(0.6666666666666666 \cdot {x}^{3} + x \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|{\pi}^{-0.5} \cdot \left(0.047619047619047616 \cdot {x}^{7} + 0.2 \cdot {x}^{5}\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.40000000000000002Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around 0 99.1%
if 0.40000000000000002 < (fabs.f64 x) Initial program 99.9%
Simplified99.8%
Taylor expanded in x around inf 98.7%
+-commutative98.7%
associate-*r*98.7%
associate-*r*98.7%
distribute-rgt-out98.7%
associate-*r*98.7%
unpow198.7%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow22.3%
unpow122.3%
unpow122.3%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow98.7%
unpow198.7%
pow-plus98.7%
metadata-eval98.7%
Simplified98.7%
distribute-lft-in98.7%
inv-pow98.7%
sqrt-pow198.7%
metadata-eval98.7%
associate-*l*98.7%
pow-plus98.7%
metadata-eval98.7%
inv-pow98.7%
sqrt-pow198.7%
metadata-eval98.7%
Applied egg-rr98.7%
distribute-lft-out98.7%
Simplified98.7%
Final simplification98.9%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.4)
(fabs
(* (sqrt (/ 1.0 PI)) (+ (* 0.6666666666666666 (pow x 3.0)) (* x 2.0))))
(/ (* x (/ 0.047619047619047616 (pow x -6.0))) (sqrt PI))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.4) {
tmp = fabs((sqrt((1.0 / ((double) M_PI))) * ((0.6666666666666666 * pow(x, 3.0)) + (x * 2.0))));
} else {
tmp = (x * (0.047619047619047616 / pow(x, -6.0))) / sqrt(((double) M_PI));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.4) {
tmp = Math.abs((Math.sqrt((1.0 / Math.PI)) * ((0.6666666666666666 * Math.pow(x, 3.0)) + (x * 2.0))));
} else {
tmp = (x * (0.047619047619047616 / Math.pow(x, -6.0))) / Math.sqrt(Math.PI);
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.4: tmp = math.fabs((math.sqrt((1.0 / math.pi)) * ((0.6666666666666666 * math.pow(x, 3.0)) + (x * 2.0)))) else: tmp = (x * (0.047619047619047616 / math.pow(x, -6.0))) / math.sqrt(math.pi) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.4) tmp = abs(Float64(sqrt(Float64(1.0 / pi)) * Float64(Float64(0.6666666666666666 * (x ^ 3.0)) + Float64(x * 2.0)))); else tmp = Float64(Float64(x * Float64(0.047619047619047616 / (x ^ -6.0))) / sqrt(pi)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.4) tmp = abs((sqrt((1.0 / pi)) * ((0.6666666666666666 * (x ^ 3.0)) + (x * 2.0)))); else tmp = (x * (0.047619047619047616 / (x ^ -6.0))) / sqrt(pi); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.4], N[Abs[N[(N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision] * N[(N[(0.6666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x * N[(0.047619047619047616 / N[Power[x, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.4:\\
\;\;\;\;\left|\sqrt{\frac{1}{\pi}} \cdot \left(0.6666666666666666 \cdot {x}^{3} + x \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{0.047619047619047616}{{x}^{-6}}}{\sqrt{\pi}}\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.40000000000000002Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around 0 99.1%
if 0.40000000000000002 < (fabs.f64 x) Initial program 99.9%
Simplified99.9%
Taylor expanded in x around inf 97.7%
associate-*r*97.6%
*-commutative97.6%
associate-*r/97.6%
metadata-eval97.6%
Simplified97.6%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.1%
add-sqr-sqrt0.1%
fabs-sqr0.1%
add-sqr-sqrt0.1%
expm1-log1p-u0.0%
*-commutative0.0%
div-inv0.0%
pow-flip0.0%
metadata-eval0.0%
Applied egg-rr0.0%
expm1-log1p-u0.1%
div-inv0.1%
Applied egg-rr0.1%
associate-/r*0.1%
associate-*r/0.1%
associate-/r*0.1%
metadata-eval0.1%
Simplified0.1%
Final simplification63.1%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.4) (fabs (* (* x 2.0) (pow PI -0.5))) (/ (* x (/ 0.047619047619047616 (pow x -6.0))) (sqrt PI))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.4) {
tmp = fabs(((x * 2.0) * pow(((double) M_PI), -0.5)));
} else {
tmp = (x * (0.047619047619047616 / pow(x, -6.0))) / sqrt(((double) M_PI));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.4) {
tmp = Math.abs(((x * 2.0) * Math.pow(Math.PI, -0.5)));
} else {
tmp = (x * (0.047619047619047616 / Math.pow(x, -6.0))) / Math.sqrt(Math.PI);
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.4: tmp = math.fabs(((x * 2.0) * math.pow(math.pi, -0.5))) else: tmp = (x * (0.047619047619047616 / math.pow(x, -6.0))) / math.sqrt(math.pi) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.4) tmp = abs(Float64(Float64(x * 2.0) * (pi ^ -0.5))); else tmp = Float64(Float64(x * Float64(0.047619047619047616 / (x ^ -6.0))) / sqrt(pi)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.4) tmp = abs(((x * 2.0) * (pi ^ -0.5))); else tmp = (x * (0.047619047619047616 / (x ^ -6.0))) / sqrt(pi); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.4], N[Abs[N[(N[(x * 2.0), $MachinePrecision] * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x * N[(0.047619047619047616 / N[Power[x, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.4:\\
\;\;\;\;\left|\left(x \cdot 2\right) \cdot {\pi}^{-0.5}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{0.047619047619047616}{{x}^{-6}}}{\sqrt{\pi}}\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.40000000000000002Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 98.0%
*-commutative98.0%
associate-*l*98.0%
unpow198.0%
sqr-pow43.3%
fabs-sqr43.3%
sqr-pow98.0%
unpow198.0%
Simplified98.0%
expm1-log1p-u98.0%
expm1-udef8.7%
inv-pow8.7%
sqrt-pow18.7%
metadata-eval8.7%
Applied egg-rr8.7%
expm1-def98.0%
expm1-log1p98.0%
*-commutative98.0%
Simplified98.0%
if 0.40000000000000002 < (fabs.f64 x) Initial program 99.9%
Simplified99.9%
Taylor expanded in x around inf 97.7%
associate-*r*97.6%
*-commutative97.6%
associate-*r/97.6%
metadata-eval97.6%
Simplified97.6%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.1%
add-sqr-sqrt0.1%
fabs-sqr0.1%
add-sqr-sqrt0.1%
expm1-log1p-u0.0%
*-commutative0.0%
div-inv0.0%
pow-flip0.0%
metadata-eval0.0%
Applied egg-rr0.0%
expm1-log1p-u0.1%
div-inv0.1%
Applied egg-rr0.1%
associate-/r*0.1%
associate-*r/0.1%
associate-/r*0.1%
metadata-eval0.1%
Simplified0.1%
Final simplification62.4%
(FPCore (x) :precision binary64 (if (<= x 1.85) (fabs (* (* x 2.0) (pow PI -0.5))) (/ x (* 21.0 (* (sqrt PI) (pow x -6.0))))))
double code(double x) {
double tmp;
if (x <= 1.85) {
tmp = fabs(((x * 2.0) * pow(((double) M_PI), -0.5)));
} else {
tmp = x / (21.0 * (sqrt(((double) M_PI)) * pow(x, -6.0)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.85) {
tmp = Math.abs(((x * 2.0) * Math.pow(Math.PI, -0.5)));
} else {
tmp = x / (21.0 * (Math.sqrt(Math.PI) * Math.pow(x, -6.0)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.85: tmp = math.fabs(((x * 2.0) * math.pow(math.pi, -0.5))) else: tmp = x / (21.0 * (math.sqrt(math.pi) * math.pow(x, -6.0))) return tmp
function code(x) tmp = 0.0 if (x <= 1.85) tmp = abs(Float64(Float64(x * 2.0) * (pi ^ -0.5))); else tmp = Float64(x / Float64(21.0 * Float64(sqrt(pi) * (x ^ -6.0)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.85) tmp = abs(((x * 2.0) * (pi ^ -0.5))); else tmp = x / (21.0 * (sqrt(pi) * (x ^ -6.0))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.85], N[Abs[N[(N[(x * 2.0), $MachinePrecision] * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(x / N[(21.0 * N[(N[Sqrt[Pi], $MachinePrecision] * N[Power[x, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.85:\\
\;\;\;\;\left|\left(x \cdot 2\right) \cdot {\pi}^{-0.5}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{21 \cdot \left(\sqrt{\pi} \cdot {x}^{-6}\right)}\\
\end{array}
\end{array}
if x < 1.8500000000000001Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 64.5%
*-commutative64.5%
associate-*l*64.5%
unpow164.5%
sqr-pow27.5%
fabs-sqr27.5%
sqr-pow64.5%
unpow164.5%
Simplified64.5%
expm1-log1p-u62.4%
expm1-udef5.6%
inv-pow5.6%
sqrt-pow15.6%
metadata-eval5.6%
Applied egg-rr5.6%
expm1-def62.4%
expm1-log1p64.5%
*-commutative64.5%
Simplified64.5%
if 1.8500000000000001 < x Initial program 99.8%
Simplified99.4%
Taylor expanded in x around inf 39.1%
associate-*r*39.1%
*-commutative39.1%
associate-*r/39.1%
metadata-eval39.1%
Simplified39.1%
expm1-log1p-u38.8%
expm1-udef38.5%
Applied egg-rr3.4%
expm1-def3.4%
expm1-log1p3.5%
associate-*l*3.5%
Simplified3.5%
Final simplification64.5%
(FPCore (x) :precision binary64 (if (<= x 1.85) (fabs (* (* x 2.0) (pow PI -0.5))) (/ x (* (sqrt PI) (* 21.0 (pow x -6.0))))))
double code(double x) {
double tmp;
if (x <= 1.85) {
tmp = fabs(((x * 2.0) * pow(((double) M_PI), -0.5)));
} else {
tmp = x / (sqrt(((double) M_PI)) * (21.0 * pow(x, -6.0)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.85) {
tmp = Math.abs(((x * 2.0) * Math.pow(Math.PI, -0.5)));
} else {
tmp = x / (Math.sqrt(Math.PI) * (21.0 * Math.pow(x, -6.0)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.85: tmp = math.fabs(((x * 2.0) * math.pow(math.pi, -0.5))) else: tmp = x / (math.sqrt(math.pi) * (21.0 * math.pow(x, -6.0))) return tmp
function code(x) tmp = 0.0 if (x <= 1.85) tmp = abs(Float64(Float64(x * 2.0) * (pi ^ -0.5))); else tmp = Float64(x / Float64(sqrt(pi) * Float64(21.0 * (x ^ -6.0)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.85) tmp = abs(((x * 2.0) * (pi ^ -0.5))); else tmp = x / (sqrt(pi) * (21.0 * (x ^ -6.0))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.85], N[Abs[N[(N[(x * 2.0), $MachinePrecision] * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(x / N[(N[Sqrt[Pi], $MachinePrecision] * N[(21.0 * N[Power[x, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.85:\\
\;\;\;\;\left|\left(x \cdot 2\right) \cdot {\pi}^{-0.5}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{\pi} \cdot \left(21 \cdot {x}^{-6}\right)}\\
\end{array}
\end{array}
if x < 1.8500000000000001Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 64.5%
*-commutative64.5%
associate-*l*64.5%
unpow164.5%
sqr-pow27.5%
fabs-sqr27.5%
sqr-pow64.5%
unpow164.5%
Simplified64.5%
expm1-log1p-u62.4%
expm1-udef5.6%
inv-pow5.6%
sqrt-pow15.6%
metadata-eval5.6%
Applied egg-rr5.6%
expm1-def62.4%
expm1-log1p64.5%
*-commutative64.5%
Simplified64.5%
if 1.8500000000000001 < x Initial program 99.8%
Simplified99.4%
Taylor expanded in x around inf 39.1%
associate-*r*39.1%
*-commutative39.1%
associate-*r/39.1%
metadata-eval39.1%
Simplified39.1%
add-sqr-sqrt1.6%
fabs-sqr1.6%
add-sqr-sqrt3.5%
add-sqr-sqrt3.5%
fabs-sqr3.5%
add-sqr-sqrt3.5%
expm1-log1p-u3.4%
*-commutative3.4%
div-inv3.4%
pow-flip3.4%
metadata-eval3.4%
Applied egg-rr3.4%
expm1-log1p-u3.5%
Applied egg-rr3.5%
Final simplification64.5%
(FPCore (x) :precision binary64 (fabs (* (* x 2.0) (pow PI -0.5))))
double code(double x) {
return fabs(((x * 2.0) * pow(((double) M_PI), -0.5)));
}
public static double code(double x) {
return Math.abs(((x * 2.0) * Math.pow(Math.PI, -0.5)));
}
def code(x): return math.fabs(((x * 2.0) * math.pow(math.pi, -0.5)))
function code(x) return abs(Float64(Float64(x * 2.0) * (pi ^ -0.5))) end
function tmp = code(x) tmp = abs(((x * 2.0) * (pi ^ -0.5))); end
code[x_] := N[Abs[N[(N[(x * 2.0), $MachinePrecision] * N[Power[Pi, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\left(x \cdot 2\right) \cdot {\pi}^{-0.5}\right|
\end{array}
Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 64.5%
*-commutative64.5%
associate-*l*64.5%
unpow164.5%
sqr-pow27.5%
fabs-sqr27.5%
sqr-pow64.5%
unpow164.5%
Simplified64.5%
expm1-log1p-u62.4%
expm1-udef5.6%
inv-pow5.6%
sqrt-pow15.6%
metadata-eval5.6%
Applied egg-rr5.6%
expm1-def62.4%
expm1-log1p64.5%
*-commutative64.5%
Simplified64.5%
Final simplification64.5%
(FPCore (x) :precision binary64 (expm1 0.0))
double code(double x) {
return expm1(0.0);
}
public static double code(double x) {
return Math.expm1(0.0);
}
def code(x): return math.expm1(0.0)
function code(x) return expm1(0.0) end
code[x_] := N[(Exp[0.0] - 1), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{expm1}\left(0\right)
\end{array}
Initial program 99.8%
Simplified99.4%
Taylor expanded in x around inf 39.1%
associate-*r*39.1%
*-commutative39.1%
associate-*r/39.1%
metadata-eval39.1%
Simplified39.1%
add-sqr-sqrt1.6%
fabs-sqr1.6%
add-sqr-sqrt3.5%
add-sqr-sqrt3.5%
fabs-sqr3.5%
add-sqr-sqrt3.5%
expm1-log1p-u3.4%
*-commutative3.4%
div-inv3.4%
pow-flip3.4%
metadata-eval3.4%
Applied egg-rr3.4%
Taylor expanded in x around 0 4.0%
Final simplification4.0%
herbie shell --seed 2023337
(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)))))))