
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
(* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x)))))) end
function tmp = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
Herbie found 15 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 (pow (fabs x) (/ 7.0 2.0))))
(fabs
(*
(/ 1.0 (sqrt PI))
(fma
(* t_1 t_1)
0.047619047619047616
(fma
2.0
(fabs x)
(fma 0.6666666666666666 t_0 (* (* t_0 (* x x)) 0.2))))))))
double code(double x) {
double t_0 = fabs(((x * x) * x));
double t_1 = pow(fabs(x), (7.0 / 2.0));
return fabs(((1.0 / sqrt(((double) M_PI))) * fma((t_1 * t_1), 0.047619047619047616, fma(2.0, fabs(x), fma(0.6666666666666666, t_0, ((t_0 * (x * x)) * 0.2))))));
}
function code(x) t_0 = abs(Float64(Float64(x * x) * x)) t_1 = abs(x) ^ Float64(7.0 / 2.0) return abs(Float64(Float64(1.0 / sqrt(pi)) * fma(Float64(t_1 * t_1), 0.047619047619047616, fma(2.0, abs(x), fma(0.6666666666666666, t_0, Float64(Float64(t_0 * Float64(x * x)) * 0.2)))))) end
code[x_] := Block[{t$95$0 = N[Abs[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Abs[x], $MachinePrecision], N[(7.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * 0.047619047619047616 + N[(2.0 * N[Abs[x], $MachinePrecision] + N[(0.6666666666666666 * t$95$0 + N[(N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\left(x \cdot x\right) \cdot x\right|\\
t_1 := {\left(\left|x\right|\right)}^{\left(\frac{7}{2}\right)}\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(t\_1 \cdot t\_1, 0.047619047619047616, \mathsf{fma}\left(2, \left|x\right|, \mathsf{fma}\left(0.6666666666666666, t\_0, \left(t\_0 \cdot \left(x \cdot x\right)\right) \cdot 0.2\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (fabs (* (* x x) x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(fma
(pow (fabs x) 7.0)
0.047619047619047616
(fma
2.0
(fabs x)
(fma 0.6666666666666666 t_0 (* (* t_0 (* x x)) 0.2))))))))
double code(double x) {
double t_0 = fabs(((x * x) * x));
return fabs(((1.0 / sqrt(((double) M_PI))) * fma(pow(fabs(x), 7.0), 0.047619047619047616, fma(2.0, fabs(x), fma(0.6666666666666666, t_0, ((t_0 * (x * x)) * 0.2))))));
}
function code(x) t_0 = abs(Float64(Float64(x * x) * x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * fma((abs(x) ^ 7.0), 0.047619047619047616, fma(2.0, abs(x), fma(0.6666666666666666, t_0, Float64(Float64(t_0 * Float64(x * x)) * 0.2)))))) end
code[x_] := Block[{t$95$0 = N[Abs[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616 + N[(2.0 * N[Abs[x], $MachinePrecision] + N[(0.6666666666666666 * t$95$0 + N[(N[(t$95$0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\left(x \cdot x\right) \cdot x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, \mathsf{fma}\left(2, \left|x\right|, \mathsf{fma}\left(0.6666666666666666, t\_0, \left(t\_0 \cdot \left(x \cdot x\right)\right) \cdot 0.2\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(fabs
(/
(fma
(*
(fma
(* (pow x 4.0) (fabs x))
0.047619047619047616
(fma 0.2 (fabs (* (* x x) x)) (* 0.6666666666666666 (fabs x))))
x)
x
(* (fabs x) 2.0))
(sqrt PI))))
double code(double x) {
return fabs((fma((fma((pow(x, 4.0) * fabs(x)), 0.047619047619047616, fma(0.2, fabs(((x * x) * x)), (0.6666666666666666 * fabs(x)))) * x), x, (fabs(x) * 2.0)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(fma(Float64(fma(Float64((x ^ 4.0) * abs(x)), 0.047619047619047616, fma(0.2, abs(Float64(Float64(x * x) * x)), Float64(0.6666666666666666 * abs(x)))) * x), x, Float64(abs(x) * 2.0)) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(N[(N[(N[Power[x, 4.0], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * 0.047619047619047616 + N[(0.2 * N[Abs[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] + N[(0.6666666666666666 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x + N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(\mathsf{fma}\left({x}^{4} \cdot \left|x\right|, 0.047619047619047616, \mathsf{fma}\left(0.2, \left|\left(x \cdot x\right) \cdot x\right|, 0.6666666666666666 \cdot \left|x\right|\right)\right) \cdot x, x, \left|x\right| \cdot 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites67.5%
Taylor expanded in x around 0
Applied rewrites99.4%
Applied rewrites99.4%
(FPCore (x)
:precision binary64
(fabs
(*
(/ 1.0 (sqrt PI))
(fma
(pow (fabs x) 7.0)
0.047619047619047616
(fma 2.0 (fabs x) (* (* (* x x) (fabs (* (* x x) x))) 0.2))))))
double code(double x) {
return fabs(((1.0 / sqrt(((double) M_PI))) * fma(pow(fabs(x), 7.0), 0.047619047619047616, fma(2.0, fabs(x), (((x * x) * fabs(((x * x) * x))) * 0.2)))));
}
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * fma((abs(x) ^ 7.0), 0.047619047619047616, fma(2.0, abs(x), Float64(Float64(Float64(x * x) * abs(Float64(Float64(x * x) * x))) * 0.2))))) end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616 + N[(2.0 * N[Abs[x], $MachinePrecision] + N[(N[(N[(x * x), $MachinePrecision] * N[Abs[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left({\left(\left|x\right|\right)}^{7}, 0.047619047619047616, \mathsf{fma}\left(2, \left|x\right|, \left(\left(x \cdot x\right) \cdot \left|\left(x \cdot x\right) \cdot x\right|\right) \cdot 0.2\right)\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites99.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 PI))))
(if (<= x 2.2)
(fabs
(fma
(* (* 0.6666666666666666 (* x x)) (fabs x))
t_0
(* (* t_0 (fabs x)) 2.0)))
(fabs (/ (* (* 0.047619047619047616 (pow x 6.0)) (fabs x)) (sqrt PI))))))
double code(double x) {
double t_0 = sqrt((1.0 / ((double) M_PI)));
double tmp;
if (x <= 2.2) {
tmp = fabs(fma(((0.6666666666666666 * (x * x)) * fabs(x)), t_0, ((t_0 * fabs(x)) * 2.0)));
} else {
tmp = fabs((((0.047619047619047616 * pow(x, 6.0)) * fabs(x)) / sqrt(((double) M_PI))));
}
return tmp;
}
function code(x) t_0 = sqrt(Float64(1.0 / pi)) tmp = 0.0 if (x <= 2.2) tmp = abs(fma(Float64(Float64(0.6666666666666666 * Float64(x * x)) * abs(x)), t_0, Float64(Float64(t_0 * abs(x)) * 2.0))); else tmp = abs(Float64(Float64(Float64(0.047619047619047616 * (x ^ 6.0)) * abs(x)) / sqrt(pi))); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / Pi), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.2], N[Abs[N[(N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\pi}}\\
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;\left|\mathsf{fma}\left(\left(0.6666666666666666 \cdot \left(x \cdot x\right)\right) \cdot \left|x\right|, t\_0, \left(t\_0 \cdot \left|x\right|\right) \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites67.5%
Taylor expanded in x around 0
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites89.1%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites36.6%
Applied rewrites36.6%
Taylor expanded in x around 0
Applied rewrites36.6%
(FPCore (x) :precision binary64 (if (<= x 1.86) (fabs (* (/ 1.0 (sqrt PI)) (* (fabs x) 2.0))) (fabs (/ (* (* 0.047619047619047616 (pow x 6.0)) (fabs x)) (sqrt PI)))))
double code(double x) {
double tmp;
if (x <= 1.86) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) * 2.0)));
} else {
tmp = fabs((((0.047619047619047616 * pow(x, 6.0)) * fabs(x)) / sqrt(((double) M_PI))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.86) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) * 2.0)));
} else {
tmp = Math.abs((((0.047619047619047616 * Math.pow(x, 6.0)) * Math.abs(x)) / Math.sqrt(Math.PI)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.86: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) * 2.0))) else: tmp = math.fabs((((0.047619047619047616 * math.pow(x, 6.0)) * math.fabs(x)) / math.sqrt(math.pi))) return tmp
function code(x) tmp = 0.0 if (x <= 1.86) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) * 2.0))); else tmp = abs(Float64(Float64(Float64(0.047619047619047616 * (x ^ 6.0)) * abs(x)) / sqrt(pi))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.86) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) * 2.0))); else tmp = abs((((0.047619047619047616 * (x ^ 6.0)) * abs(x)) / sqrt(pi))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.86], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.86:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(0.047619047619047616 \cdot {x}^{6}\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < 1.8600000000000001Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites67.9%
if 1.8600000000000001 < x Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites36.6%
Applied rewrites36.6%
Taylor expanded in x around 0
Applied rewrites36.6%
(FPCore (x)
:precision binary64
(if (<= x 1.86)
(fabs (* (/ 1.0 (sqrt PI)) (* (fabs x) 2.0)))
(fabs
(/
(* (* 0.047619047619047616 (* (* (* x x) (* x x)) (* x x))) (fabs x))
(sqrt PI)))))
double code(double x) {
double tmp;
if (x <= 1.86) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) * 2.0)));
} else {
tmp = fabs((((0.047619047619047616 * (((x * x) * (x * x)) * (x * x))) * fabs(x)) / sqrt(((double) M_PI))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.86) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) * 2.0)));
} else {
tmp = Math.abs((((0.047619047619047616 * (((x * x) * (x * x)) * (x * x))) * Math.abs(x)) / Math.sqrt(Math.PI)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.86: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) * 2.0))) else: tmp = math.fabs((((0.047619047619047616 * (((x * x) * (x * x)) * (x * x))) * math.fabs(x)) / math.sqrt(math.pi))) return tmp
function code(x) tmp = 0.0 if (x <= 1.86) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) * 2.0))); else tmp = abs(Float64(Float64(Float64(0.047619047619047616 * Float64(Float64(Float64(x * x) * Float64(x * x)) * Float64(x * x))) * abs(x)) / sqrt(pi))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.86) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) * 2.0))); else tmp = abs((((0.047619047619047616 * (((x * x) * (x * x)) * (x * x))) * abs(x)) / sqrt(pi))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.86], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(0.047619047619047616 * N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.86:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(0.047619047619047616 \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < 1.8600000000000001Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites67.9%
if 1.8600000000000001 < x Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites36.6%
Applied rewrites36.6%
Applied rewrites36.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(fabs
(*
(/ 1.0 (sqrt PI))
(fma (* (/ 1.0 21.0) (fabs x)) (* t_0 t_0) (* (fabs x) 2.0))))))
double code(double x) {
double t_0 = (x * x) * x;
return fabs(((1.0 / sqrt(((double) M_PI))) * fma(((1.0 / 21.0) * fabs(x)), (t_0 * t_0), (fabs(x) * 2.0))));
}
function code(x) t_0 = Float64(Float64(x * x) * x) return abs(Float64(Float64(1.0 / sqrt(pi)) * fma(Float64(Float64(1.0 / 21.0) * abs(x)), Float64(t_0 * t_0), Float64(abs(x) * 2.0)))) end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 / 21.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(\frac{1}{21} \cdot \left|x\right|, t\_0 \cdot t\_0, \left|x\right| \cdot 2\right)\right|
\end{array}
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites98.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(if (<= x 1.86)
(fabs (* (/ 1.0 (sqrt PI)) (* (fabs x) 2.0)))
(fabs (/ (* (* 0.047619047619047616 (* t_0 t_0)) (fabs x)) (sqrt PI))))))
double code(double x) {
double t_0 = (x * x) * x;
double tmp;
if (x <= 1.86) {
tmp = fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) * 2.0)));
} else {
tmp = fabs((((0.047619047619047616 * (t_0 * t_0)) * fabs(x)) / sqrt(((double) M_PI))));
}
return tmp;
}
public static double code(double x) {
double t_0 = (x * x) * x;
double tmp;
if (x <= 1.86) {
tmp = Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) * 2.0)));
} else {
tmp = Math.abs((((0.047619047619047616 * (t_0 * t_0)) * Math.abs(x)) / Math.sqrt(Math.PI)));
}
return tmp;
}
def code(x): t_0 = (x * x) * x tmp = 0 if x <= 1.86: tmp = math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) * 2.0))) else: tmp = math.fabs((((0.047619047619047616 * (t_0 * t_0)) * math.fabs(x)) / math.sqrt(math.pi))) return tmp
function code(x) t_0 = Float64(Float64(x * x) * x) tmp = 0.0 if (x <= 1.86) tmp = abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) * 2.0))); else tmp = abs(Float64(Float64(Float64(0.047619047619047616 * Float64(t_0 * t_0)) * abs(x)) / sqrt(pi))); end return tmp end
function tmp_2 = code(x) t_0 = (x * x) * x; tmp = 0.0; if (x <= 1.86) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) * 2.0))); else tmp = abs((((0.047619047619047616 * (t_0 * t_0)) * abs(x)) / sqrt(pi))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, 1.86], N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(0.047619047619047616 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
\mathbf{if}\;x \leq 1.86:\\
\;\;\;\;\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(0.047619047619047616 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if x < 1.8600000000000001Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites67.9%
if 1.8600000000000001 < x Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites36.6%
Applied rewrites36.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(fabs
(/ (+ (* (fabs x) 2.0) (/ (* (* t_0 t_0) (fabs x)) 21.0)) (sqrt PI)))))
double code(double x) {
double t_0 = (x * x) * x;
return fabs((((fabs(x) * 2.0) + (((t_0 * t_0) * fabs(x)) / 21.0)) / sqrt(((double) M_PI))));
}
public static double code(double x) {
double t_0 = (x * x) * x;
return Math.abs((((Math.abs(x) * 2.0) + (((t_0 * t_0) * Math.abs(x)) / 21.0)) / Math.sqrt(Math.PI)));
}
def code(x): t_0 = (x * x) * x return math.fabs((((math.fabs(x) * 2.0) + (((t_0 * t_0) * math.fabs(x)) / 21.0)) / math.sqrt(math.pi)))
function code(x) t_0 = Float64(Float64(x * x) * x) return abs(Float64(Float64(Float64(abs(x) * 2.0) + Float64(Float64(Float64(t_0 * t_0) * abs(x)) / 21.0)) / sqrt(pi))) end
function tmp = code(x) t_0 = (x * x) * x; tmp = abs((((abs(x) * 2.0) + (((t_0 * t_0) * abs(x)) / 21.0)) / sqrt(pi))); end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision] + N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / 21.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
\left|\frac{\left|x\right| \cdot 2 + \frac{\left(t\_0 \cdot t\_0\right) \cdot \left|x\right|}{21}}{\sqrt{\pi}}\right|
\end{array}
\end{array}
Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites98.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt PI))))
(if (<= x 1.75)
(fabs (* t_0 (* (fabs x) 2.0)))
(fabs (* t_0 (* (* (* x x) (fabs (* (* x x) x))) 0.2))))))
double code(double x) {
double t_0 = 1.0 / sqrt(((double) M_PI));
double tmp;
if (x <= 1.75) {
tmp = fabs((t_0 * (fabs(x) * 2.0)));
} else {
tmp = fabs((t_0 * (((x * x) * fabs(((x * x) * x))) * 0.2)));
}
return tmp;
}
public static double code(double x) {
double t_0 = 1.0 / Math.sqrt(Math.PI);
double tmp;
if (x <= 1.75) {
tmp = Math.abs((t_0 * (Math.abs(x) * 2.0)));
} else {
tmp = Math.abs((t_0 * (((x * x) * Math.abs(((x * x) * x))) * 0.2)));
}
return tmp;
}
def code(x): t_0 = 1.0 / math.sqrt(math.pi) tmp = 0 if x <= 1.75: tmp = math.fabs((t_0 * (math.fabs(x) * 2.0))) else: tmp = math.fabs((t_0 * (((x * x) * math.fabs(((x * x) * x))) * 0.2))) return tmp
function code(x) t_0 = Float64(1.0 / sqrt(pi)) tmp = 0.0 if (x <= 1.75) tmp = abs(Float64(t_0 * Float64(abs(x) * 2.0))); else tmp = abs(Float64(t_0 * Float64(Float64(Float64(x * x) * abs(Float64(Float64(x * x) * x))) * 0.2))); end return tmp end
function tmp_2 = code(x) t_0 = 1.0 / sqrt(pi); tmp = 0.0; if (x <= 1.75) tmp = abs((t_0 * (abs(x) * 2.0))); else tmp = abs((t_0 * (((x * x) * abs(((x * x) * x))) * 0.2))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.75], N[Abs[N[(t$95$0 * N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$0 * N[(N[(N[(x * x), $MachinePrecision] * N[Abs[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\pi}}\\
\mathbf{if}\;x \leq 1.75:\\
\;\;\;\;\left|t\_0 \cdot \left(\left|x\right| \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|t\_0 \cdot \left(\left(\left(x \cdot x\right) \cdot \left|\left(x \cdot x\right) \cdot x\right|\right) \cdot 0.2\right)\right|\\
\end{array}
\end{array}
if x < 1.75Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites67.9%
if 1.75 < x Initial program 99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites31.0%
(FPCore (x) :precision binary64 (fabs (/ (* (fma 0.6666666666666666 (* x x) 2.0) (fabs x)) (sqrt PI))))
double code(double x) {
return fabs(((fma(0.6666666666666666, (x * x), 2.0) * fabs(x)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(0.6666666666666666, Float64(x * x), 2.0) * abs(x)) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites67.5%
Taylor expanded in x around 0
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites88.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (/ 1.0 (sqrt PI)))
(t_2 (* (* t_0 (fabs x)) (fabs x))))
(if (<=
(fabs
(*
t_1
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_2))
(* (/ 1.0 21.0) (* (* t_2 (fabs x)) (fabs x))))))
5e-9)
(fabs (* t_1 (* (fabs x) 2.0)))
(fabs (/ (* (sqrt (* x x)) 2.0) (sqrt PI))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = 1.0 / sqrt(((double) M_PI));
double t_2 = (t_0 * fabs(x)) * fabs(x);
double tmp;
if (fabs((t_1 * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * fabs(x)) * fabs(x)))))) <= 5e-9) {
tmp = fabs((t_1 * (fabs(x) * 2.0)));
} else {
tmp = fabs(((sqrt((x * x)) * 2.0) / sqrt(((double) M_PI))));
}
return tmp;
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = 1.0 / Math.sqrt(Math.PI);
double t_2 = (t_0 * Math.abs(x)) * Math.abs(x);
double tmp;
if (Math.abs((t_1 * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * Math.abs(x)) * Math.abs(x)))))) <= 5e-9) {
tmp = Math.abs((t_1 * (Math.abs(x) * 2.0)));
} else {
tmp = Math.abs(((Math.sqrt((x * x)) * 2.0) / Math.sqrt(Math.PI)));
}
return tmp;
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = 1.0 / math.sqrt(math.pi) t_2 = (t_0 * math.fabs(x)) * math.fabs(x) tmp = 0 if math.fabs((t_1 * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * math.fabs(x)) * math.fabs(x)))))) <= 5e-9: tmp = math.fabs((t_1 * (math.fabs(x) * 2.0))) else: tmp = math.fabs(((math.sqrt((x * x)) * 2.0) / math.sqrt(math.pi))) return tmp
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(1.0 / sqrt(pi)) t_2 = Float64(Float64(t_0 * abs(x)) * abs(x)) tmp = 0.0 if (abs(Float64(t_1 * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_2)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_2 * abs(x)) * abs(x)))))) <= 5e-9) tmp = abs(Float64(t_1 * Float64(abs(x) * 2.0))); else tmp = abs(Float64(Float64(sqrt(Float64(x * x)) * 2.0) / sqrt(pi))); end return tmp end
function tmp_2 = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = 1.0 / sqrt(pi); t_2 = (t_0 * abs(x)) * abs(x); tmp = 0.0; if (abs((t_1 * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_2)) + ((1.0 / 21.0) * ((t_2 * abs(x)) * abs(x)))))) <= 5e-9) tmp = abs((t_1 * (abs(x) * 2.0))); else tmp = abs(((sqrt((x * x)) * 2.0) / sqrt(pi))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[N[(t$95$1 * 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$2), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$2 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 5e-9], N[Abs[N[(t$95$1 * N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sqrt[N[(x * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision] / N[Sqrt[Pi], $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 := \frac{1}{\sqrt{\pi}}\\
t_2 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\mathbf{if}\;\left|t\_1 \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_2\right) + \frac{1}{21} \cdot \left(\left(t\_2 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right| \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\left|t\_1 \cdot \left(\left|x\right| \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\sqrt{x \cdot x} \cdot 2}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) < 5.0000000000000001e-9Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
if 5.0000000000000001e-9 < (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites8.9%
Applied rewrites52.8%
(FPCore (x) :precision binary64 (fabs (* (/ 1.0 (sqrt PI)) (* (fabs x) 2.0))))
double code(double x) {
return fabs(((1.0 / sqrt(((double) M_PI))) * (fabs(x) * 2.0)));
}
public static double code(double x) {
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * (Math.abs(x) * 2.0)));
}
def code(x): return math.fabs(((1.0 / math.sqrt(math.pi)) * (math.fabs(x) * 2.0)))
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(abs(x) * 2.0))) end
function tmp = code(x) tmp = abs(((1.0 / sqrt(pi)) * (abs(x) * 2.0))); end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot 2\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites67.9%
(FPCore (x) :precision binary64 (fabs (/ (* (fabs x) 2.0) (sqrt PI))))
double code(double x) {
return fabs(((fabs(x) * 2.0) / sqrt(((double) M_PI))));
}
public static double code(double x) {
return Math.abs(((Math.abs(x) * 2.0) / Math.sqrt(Math.PI)));
}
def code(x): return math.fabs(((math.fabs(x) * 2.0) / math.sqrt(math.pi)))
function code(x) return abs(Float64(Float64(abs(x) * 2.0) / sqrt(pi))) end
function tmp = code(x) tmp = abs(((abs(x) * 2.0) / sqrt(pi))); end
code[x_] := N[Abs[N[(N[(N[Abs[x], $MachinePrecision] * 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\left|x\right| \cdot 2}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites67.5%
herbie shell --seed 2025134
(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)))))))