
(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 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) (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+
(+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0))
(* (/ 1.0 5.0) (* (* t_0 (fabs x)) (fabs x))))
(* (/ 1.0 21.0) (* (* (* (* x x) x) x) (* (* (fabs x) x) x))))))))
double code(double x) {
double t_0 = (fabs(x) * 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_0 * fabs(x)) * fabs(x)))) + ((1.0 / 21.0) * ((((x * x) * x) * x) * ((fabs(x) * x) * x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * 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_0 * Math.abs(x)) * Math.abs(x)))) + ((1.0 / 21.0) * ((((x * x) * x) * x) * ((Math.abs(x) * x) * x))))));
}
def code(x): t_0 = (math.fabs(x) * 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_0 * math.fabs(x)) * math.fabs(x)))) + ((1.0 / 21.0) * ((((x * x) * x) * x) * ((math.fabs(x) * x) * x))))))
function code(x) t_0 = Float64(Float64(abs(x) * 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) * Float64(Float64(t_0 * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 21.0) * Float64(Float64(Float64(Float64(x * x) * x) * x) * Float64(Float64(abs(x) * x) * x)))))) end
function tmp = code(x) t_0 = (abs(x) * 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_0 * abs(x)) * abs(x)))) + ((1.0 / 21.0) * ((((x * x) * x) * x) * ((abs(x) * x) * x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * 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] * N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(N[Abs[x], $MachinePrecision] * x), $MachinePrecision] * 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|\\
\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 \left(\left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{21} \cdot \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot \left(\left(\left|x\right| \cdot x\right) \cdot x\right)\right)\right)\right|
\end{array}
\end{array}
Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(*
(/ 1.0 (sqrt PI))
(fabs
(fma
(fma
(fma (* (* x x) 0.047619047619047616) x (* x 0.2))
(* x x)
(* x 0.6666666666666666))
(* x x)
(+ x x)))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs(fma(fma(fma(((x * x) * 0.047619047619047616), x, (x * 0.2)), (x * x), (x * 0.6666666666666666)), (x * x), (x + x)));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(fma(fma(fma(Float64(Float64(x * x) * 0.047619047619047616), x, Float64(x * 0.2)), Float64(x * x), Float64(x * 0.6666666666666666)), Float64(x * x), Float64(x + x)))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.047619047619047616), $MachinePrecision] * x + N[(x * 0.2), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot 0.047619047619047616, x, x \cdot 0.2\right), x \cdot x, x \cdot 0.6666666666666666\right), x \cdot x, x + x\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(*
(/ 1.0 (sqrt PI))
(fabs
(fma
(*
(fma (fma (* x x) 0.047619047619047616 0.2) (* x x) 0.6666666666666666)
x)
(* x x)
(+ x x)))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs(fma((fma(fma((x * x), 0.047619047619047616, 0.2), (x * x), 0.6666666666666666) * x), (x * x), (x + x)));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(fma(Float64(fma(fma(Float64(x * x), 0.047619047619047616, 0.2), Float64(x * x), 0.6666666666666666) * x), Float64(x * x), Float64(x + x)))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.047619047619047616 + 0.2), $MachinePrecision] * N[(x * x), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), x \cdot x, 0.6666666666666666\right) \cdot x, x \cdot x, x + x\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.8
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt PI))) (t_1 (* (* x x) x)))
(if (<= x 2.7)
(*
t_0
(fabs (* (fma (fma (* 0.2 x) x 0.6666666666666666) (* x x) 2.0) x)))
(* (* t_0 (* (* t_1 x) t_1)) 0.047619047619047616))))
double code(double x) {
double t_0 = 1.0 / sqrt(((double) M_PI));
double t_1 = (x * x) * x;
double tmp;
if (x <= 2.7) {
tmp = t_0 * fabs((fma(fma((0.2 * x), x, 0.6666666666666666), (x * x), 2.0) * x));
} else {
tmp = (t_0 * ((t_1 * x) * t_1)) * 0.047619047619047616;
}
return tmp;
}
function code(x) t_0 = Float64(1.0 / sqrt(pi)) t_1 = Float64(Float64(x * x) * x) tmp = 0.0 if (x <= 2.7) tmp = Float64(t_0 * abs(Float64(fma(fma(Float64(0.2 * x), x, 0.6666666666666666), Float64(x * x), 2.0) * x))); else tmp = Float64(Float64(t_0 * Float64(Float64(t_1 * x) * t_1)) * 0.047619047619047616); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, 2.7], N[(t$95$0 * N[Abs[N[(N[(N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[(t$95$1 * x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\pi}}\\
t_1 := \left(x \cdot x\right) \cdot x\\
\mathbf{if}\;x \leq 2.7:\\
\;\;\;\;t\_0 \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right|\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \left(\left(t\_1 \cdot x\right) \cdot t\_1\right)\right) \cdot 0.047619047619047616\\
\end{array}
\end{array}
if x < 2.7000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.6%
if 2.7000000000000002 < x Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites3.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lift-sqrt.f64N/A
metadata-evalN/A
sqrt-divN/A
*-commutativeN/A
pow3N/A
pow2N/A
pow2N/A
pow-powN/A
metadata-evalN/A
pow-prod-upN/A
metadata-evalN/A
Applied rewrites3.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt PI))))
(if (<= x 2.7)
(*
t_0
(fabs (* (fma (fma (* 0.2 x) x 0.6666666666666666) (* x x) 2.0) x)))
(* (* (* (* (* x x) x) (* (* x x) (* x x))) t_0) 0.047619047619047616))))
double code(double x) {
double t_0 = 1.0 / sqrt(((double) M_PI));
double tmp;
if (x <= 2.7) {
tmp = t_0 * fabs((fma(fma((0.2 * x), x, 0.6666666666666666), (x * x), 2.0) * x));
} else {
tmp = ((((x * x) * x) * ((x * x) * (x * x))) * t_0) * 0.047619047619047616;
}
return tmp;
}
function code(x) t_0 = Float64(1.0 / sqrt(pi)) tmp = 0.0 if (x <= 2.7) tmp = Float64(t_0 * abs(Float64(fma(fma(Float64(0.2 * x), x, 0.6666666666666666), Float64(x * x), 2.0) * x))); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * x) * Float64(Float64(x * x) * Float64(x * x))) * t_0) * 0.047619047619047616); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.7], N[(t$95$0 * N[Abs[N[(N[(N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\pi}}\\
\mathbf{if}\;x \leq 2.7:\\
\;\;\;\;t\_0 \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right|\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot t\_0\right) \cdot 0.047619047619047616\\
\end{array}
\end{array}
if x < 2.7000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.6%
if 2.7000000000000002 < x Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites3.7%
(FPCore (x)
:precision binary64
(*
(/ 1.0 (sqrt PI))
(fabs
(*
(fma
(fma (fma 0.047619047619047616 (* x x) 0.2) (* x x) 0.6666666666666666)
(* x x)
2.0)
x))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs((fma(fma(fma(0.047619047619047616, (x * x), 0.2), (x * x), 0.6666666666666666), (x * x), 2.0) * x));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(fma(fma(fma(0.047619047619047616, Float64(x * x), 0.2), Float64(x * x), 0.6666666666666666), Float64(x * x), 2.0) * x))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(N[(N[(0.047619047619047616 * N[(x * x), $MachinePrecision] + 0.2), $MachinePrecision] * N[(x * x), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.047619047619047616, x \cdot x, 0.2\right), x \cdot x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(if (<= x 2.7)
(*
(/ 1.0 (sqrt PI))
(fabs (* (fma (fma (* 0.2 x) x 0.6666666666666666) (* x x) 2.0) x)))
(/
(* (* (* x x) (* (* x x) (* x x))) (* 0.047619047619047616 x))
(sqrt PI))))
double code(double x) {
double tmp;
if (x <= 2.7) {
tmp = (1.0 / sqrt(((double) M_PI))) * fabs((fma(fma((0.2 * x), x, 0.6666666666666666), (x * x), 2.0) * x));
} else {
tmp = (((x * x) * ((x * x) * (x * x))) * (0.047619047619047616 * x)) / sqrt(((double) M_PI));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2.7) tmp = Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(fma(fma(Float64(0.2 * x), x, 0.6666666666666666), Float64(x * x), 2.0) * x))); else tmp = Float64(Float64(Float64(Float64(x * x) * Float64(Float64(x * x) * Float64(x * x))) * Float64(0.047619047619047616 * x)) / sqrt(pi)); end return tmp end
code[x_] := If[LessEqual[x, 2.7], N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.047619047619047616 * x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7:\\
\;\;\;\;\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \left(0.047619047619047616 \cdot x\right)}{\sqrt{\pi}}\\
\end{array}
\end{array}
if x < 2.7000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.6%
if 2.7000000000000002 < x Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites3.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites3.7%
Applied rewrites3.7%
(FPCore (x)
:precision binary64
(if (<= x 2.7)
(*
(/ 1.0 (sqrt PI))
(fabs (* (fma (fma (* 0.2 x) x 0.6666666666666666) (* x x) 2.0) x)))
(*
(/ (* (* (* x x) (* x x)) (* (* x x) x)) (sqrt PI))
0.047619047619047616)))
double code(double x) {
double tmp;
if (x <= 2.7) {
tmp = (1.0 / sqrt(((double) M_PI))) * fabs((fma(fma((0.2 * x), x, 0.6666666666666666), (x * x), 2.0) * x));
} else {
tmp = ((((x * x) * (x * x)) * ((x * x) * x)) / sqrt(((double) M_PI))) * 0.047619047619047616;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2.7) tmp = Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(fma(fma(Float64(0.2 * x), x, 0.6666666666666666), Float64(x * x), 2.0) * x))); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * Float64(x * x)) * Float64(Float64(x * x) * x)) / sqrt(pi)) * 0.047619047619047616); end return tmp end
code[x_] := If[LessEqual[x, 2.7], N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7:\\
\;\;\;\;\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)}{\sqrt{\pi}} \cdot 0.047619047619047616\\
\end{array}
\end{array}
if x < 2.7000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.6%
if 2.7000000000000002 < x Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites3.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites3.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
pow-plusN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f643.7
Applied rewrites3.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt PI))))
(if (<= x 2.2)
(* t_0 (fabs (fma (* 0.6666666666666666 x) (* x x) (* x 2.0))))
(* t_0 (fabs (* (* (* (* x x) x) (* x x)) 0.2))))))
double code(double x) {
double t_0 = 1.0 / sqrt(((double) M_PI));
double tmp;
if (x <= 2.2) {
tmp = t_0 * fabs(fma((0.6666666666666666 * x), (x * x), (x * 2.0)));
} else {
tmp = t_0 * fabs(((((x * x) * x) * (x * x)) * 0.2));
}
return tmp;
}
function code(x) t_0 = Float64(1.0 / sqrt(pi)) tmp = 0.0 if (x <= 2.2) tmp = Float64(t_0 * abs(fma(Float64(0.6666666666666666 * x), Float64(x * x), Float64(x * 2.0)))); else tmp = Float64(t_0 * abs(Float64(Float64(Float64(Float64(x * x) * x) * Float64(x * x)) * 0.2))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.2], N[(t$95$0 * N[Abs[N[(N[(0.6666666666666666 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Abs[N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\pi}}\\
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;t\_0 \cdot \left|\mathsf{fma}\left(0.6666666666666666 \cdot x, x \cdot x, x \cdot 2\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left|\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot 0.2\right|\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f6489.8
Applied rewrites89.8%
if 2.2000000000000002 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites93.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow3N/A
pow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6430.7
Applied rewrites30.7%
(FPCore (x) :precision binary64 (* (/ 1.0 (sqrt PI)) (fabs (* (fma (fma (* 0.2 x) x 0.6666666666666666) (* x x) 2.0) x))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs((fma(fma((0.2 * x), x, 0.6666666666666666), (x * x), 2.0) * x));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(fma(fma(Float64(0.2 * x), x, 0.6666666666666666), Float64(x * x), 2.0) * x))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.6%
(FPCore (x) :precision binary64 (if (<= x 2e-17) (* (* (/ 1.0 (sqrt PI)) x) 2.0) (sqrt (/ (* (* (fma 0.6666666666666666 (* x x) 2.0) x) (* 2.0 x)) PI))))
double code(double x) {
double tmp;
if (x <= 2e-17) {
tmp = ((1.0 / sqrt(((double) M_PI))) * x) * 2.0;
} else {
tmp = sqrt((((fma(0.6666666666666666, (x * x), 2.0) * x) * (2.0 * x)) / ((double) M_PI)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2e-17) tmp = Float64(Float64(Float64(1.0 / sqrt(pi)) * x) * 2.0); else tmp = sqrt(Float64(Float64(Float64(fma(0.6666666666666666, Float64(x * x), 2.0) * x) * Float64(2.0 * x)) / pi)); end return tmp end
code[x_] := If[LessEqual[x, 2e-17], N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * 2.0), $MachinePrecision], N[Sqrt[N[(N[(N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision] * N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\left(\frac{1}{\sqrt{\pi}} \cdot x\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) \cdot x\right) \cdot \left(2 \cdot x\right)}{\pi}}\\
\end{array}
\end{array}
if x < 2.00000000000000014e-17Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.4%
if 2.00000000000000014e-17 < x Initial program 99.7%
Applied rewrites99.1%
Taylor expanded in x around 0
Applied rewrites92.3%
lift-/.f64N/A
Applied rewrites92.7%
Taylor expanded in x around 0
Applied rewrites83.8%
(FPCore (x) :precision binary64 (* (/ 1.0 (sqrt PI)) (fabs (fma (* 0.6666666666666666 x) (* x x) (* x 2.0)))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs(fma((0.6666666666666666 * x), (x * x), (x * 2.0)));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(fma(Float64(0.6666666666666666 * x), Float64(x * x), Float64(x * 2.0)))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(N[(0.6666666666666666 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|\mathsf{fma}\left(0.6666666666666666 \cdot x, x \cdot x, x \cdot 2\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f6489.8
Applied rewrites89.8%
(FPCore (x) :precision binary64 (if (<= x 1.7) (* (* (/ 1.0 (sqrt PI)) x) 2.0) (/ (fabs (* (* 0.6666666666666666 (* x x)) x)) (sqrt PI))))
double code(double x) {
double tmp;
if (x <= 1.7) {
tmp = ((1.0 / sqrt(((double) M_PI))) * x) * 2.0;
} else {
tmp = fabs(((0.6666666666666666 * (x * x)) * x)) / sqrt(((double) M_PI));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.7) {
tmp = ((1.0 / Math.sqrt(Math.PI)) * x) * 2.0;
} else {
tmp = Math.abs(((0.6666666666666666 * (x * x)) * x)) / Math.sqrt(Math.PI);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.7: tmp = ((1.0 / math.sqrt(math.pi)) * x) * 2.0 else: tmp = math.fabs(((0.6666666666666666 * (x * x)) * x)) / math.sqrt(math.pi) return tmp
function code(x) tmp = 0.0 if (x <= 1.7) tmp = Float64(Float64(Float64(1.0 / sqrt(pi)) * x) * 2.0); else tmp = Float64(abs(Float64(Float64(0.6666666666666666 * Float64(x * x)) * x)) / sqrt(pi)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.7) tmp = ((1.0 / sqrt(pi)) * x) * 2.0; else tmp = abs(((0.6666666666666666 * (x * x)) * x)) / sqrt(pi); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.7], N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[Abs[N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.7:\\
\;\;\;\;\left(\frac{1}{\sqrt{\pi}} \cdot x\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\left(0.6666666666666666 \cdot \left(x \cdot x\right)\right) \cdot x\right|}{\sqrt{\pi}}\\
\end{array}
\end{array}
if x < 1.69999999999999996Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites34.3%
if 1.69999999999999996 < x Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites89.4%
Taylor expanded in x around inf
pow2N/A
lower-*.f64N/A
lift-*.f6427.3
Applied rewrites27.3%
(FPCore (x) :precision binary64 (/ (fabs (* (fma (* x x) 0.6666666666666666 2.0) x)) (sqrt PI)))
double code(double x) {
return fabs((fma((x * x), 0.6666666666666666, 2.0) * x)) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(Float64(fma(Float64(x * x), 0.6666666666666666, 2.0) * x)) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(N[(N[(x * x), $MachinePrecision] * 0.6666666666666666 + 2.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|\mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right) \cdot x\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites89.4%
(FPCore (x) :precision binary64 (if (<= x 2e-17) (* (* (/ 1.0 (sqrt PI)) x) 2.0) (sqrt (/ (* (* x x) 4.0) PI))))
double code(double x) {
double tmp;
if (x <= 2e-17) {
tmp = ((1.0 / sqrt(((double) M_PI))) * x) * 2.0;
} else {
tmp = sqrt((((x * x) * 4.0) / ((double) M_PI)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2e-17) {
tmp = ((1.0 / Math.sqrt(Math.PI)) * x) * 2.0;
} else {
tmp = Math.sqrt((((x * x) * 4.0) / Math.PI));
}
return tmp;
}
def code(x): tmp = 0 if x <= 2e-17: tmp = ((1.0 / math.sqrt(math.pi)) * x) * 2.0 else: tmp = math.sqrt((((x * x) * 4.0) / math.pi)) return tmp
function code(x) tmp = 0.0 if (x <= 2e-17) tmp = Float64(Float64(Float64(1.0 / sqrt(pi)) * x) * 2.0); else tmp = sqrt(Float64(Float64(Float64(x * x) * 4.0) / pi)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 2e-17) tmp = ((1.0 / sqrt(pi)) * x) * 2.0; else tmp = sqrt((((x * x) * 4.0) / pi)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 2e-17], N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * 2.0), $MachinePrecision], N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] * 4.0), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\left(\frac{1}{\sqrt{\pi}} \cdot x\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x\right) \cdot 4}{\pi}}\\
\end{array}
\end{array}
if x < 2.00000000000000014e-17Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.4%
if 2.00000000000000014e-17 < x Initial program 99.7%
Applied rewrites99.1%
Taylor expanded in x around 0
Applied rewrites92.3%
lift-/.f64N/A
Applied rewrites92.7%
Taylor expanded in x around 0
unpow2N/A
sqr-abs-revN/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6483.2
Applied rewrites83.2%
(FPCore (x) :precision binary64 (* (* (/ 1.0 (sqrt PI)) x) 2.0))
double code(double x) {
return ((1.0 / sqrt(((double) M_PI))) * x) * 2.0;
}
public static double code(double x) {
return ((1.0 / Math.sqrt(Math.PI)) * x) * 2.0;
}
def code(x): return ((1.0 / math.sqrt(math.pi)) * x) * 2.0
function code(x) return Float64(Float64(Float64(1.0 / sqrt(pi)) * x) * 2.0) end
function tmp = code(x) tmp = ((1.0 / sqrt(pi)) * x) * 2.0; end
code[x_] := N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{\sqrt{\pi}} \cdot x\right) \cdot 2
\end{array}
Initial program 99.8%
Applied rewrites99.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites34.3%
(FPCore (x) :precision binary64 (/ (fabs (+ x x)) (sqrt PI)))
double code(double x) {
return fabs((x + x)) / sqrt(((double) M_PI));
}
public static double code(double x) {
return Math.abs((x + x)) / Math.sqrt(Math.PI);
}
def code(x): return math.fabs((x + x)) / math.sqrt(math.pi)
function code(x) return Float64(abs(Float64(x + x)) / sqrt(pi)) end
function tmp = code(x) tmp = abs((x + x)) / sqrt(pi); end
code[x_] := N[(N[Abs[N[(x + x), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|x + x\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites67.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6467.8
Applied rewrites67.8%
herbie shell --seed 2025092
(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)))))))