
(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 9 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))))
(* (pow (fabs x) 7.0) 0.047619047619047616))))))
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)))) + (pow(fabs(x), 7.0) * 0.047619047619047616))));
}
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)))) + (Math.pow(Math.abs(x), 7.0) * 0.047619047619047616))));
}
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)))) + (math.pow(math.fabs(x), 7.0) * 0.047619047619047616))))
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((abs(x) ^ 7.0) * 0.047619047619047616)))) 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)))) + ((abs(x) ^ 7.0) * 0.047619047619047616)))); 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[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] * 0.047619047619047616), $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) + {\left(\left|x\right|\right)}^{7} \cdot 0.047619047619047616\right)\right|
\end{array}
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+
(fma (* (* x x) 0.6666666666666666) x (* x 2.0))
(* 0.2 (* (* (* (* (fabs x) (fabs x)) (fabs x)) (fabs x)) (fabs x))))
(* 0.047619047619047616 (* (* t_0 t_0) (fabs x))))))))
double code(double x) {
double t_0 = (x * x) * x;
return fabs(((1.0 / sqrt(((double) M_PI))) * ((fma(((x * x) * 0.6666666666666666), x, (x * 2.0)) + (0.2 * ((((fabs(x) * fabs(x)) * fabs(x)) * fabs(x)) * fabs(x)))) + (0.047619047619047616 * ((t_0 * t_0) * fabs(x))))));
}
function code(x) t_0 = Float64(Float64(x * x) * x) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(fma(Float64(Float64(x * x) * 0.6666666666666666), x, Float64(x * 2.0)) + Float64(0.2 * Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)))) + Float64(0.047619047619047616 * Float64(Float64(t_0 * t_0) * abs(x)))))) 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[(N[(N[(x * x), $MachinePrecision] * 0.6666666666666666), $MachinePrecision] * x + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] + N[(0.2 * N[(N[(N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $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 \left(\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot 0.6666666666666666, x, x \cdot 2\right) + 0.2 \cdot \left(\left(\left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + 0.047619047619047616 \cdot \left(\left(t\_0 \cdot t\_0\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
swap-sqrN/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-absN/A
unswap-sqrN/A
Applied rewrites99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
pow2N/A
lift-fabs.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites76.5%
lift-/.f64N/A
metadata-eval76.5
Applied rewrites76.5%
lift-/.f64N/A
metadata-eval76.5
Applied rewrites76.5%
(FPCore (x)
:precision binary64
(fabs
(/
(*
(fma
(fma (fma (* x x) 0.047619047619047616 0.2) (* x x) 0.6666666666666666)
(* x x)
2.0)
x)
(sqrt PI))))
double code(double x) {
return fabs(((fma(fma(fma((x * x), 0.047619047619047616, 0.2), (x * x), 0.6666666666666666), (x * x), 2.0) * x) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(fma(fma(Float64(x * x), 0.047619047619047616, 0.2), Float64(x * x), 0.6666666666666666), Float64(x * x), 2.0) * x) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 0.047619047619047616 + 0.2), $MachinePrecision] * N[(x * x), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), x \cdot x, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites99.4%
(FPCore (x) :precision binary64 (fabs (/ (fma x 2.0 (* (* (* (fma 0.2 (* x x) 0.6666666666666666) x) x) x)) (sqrt PI))))
double code(double x) {
return fabs((fma(x, 2.0, (((fma(0.2, (x * x), 0.6666666666666666) * x) * x) * x)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(fma(x, 2.0, Float64(Float64(Float64(fma(0.2, Float64(x * x), 0.6666666666666666) * x) * x) * x)) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(x * 2.0 + N[(N[(N[(N[(0.2 * N[(x * x), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(x, 2, \left(\left(\mathsf{fma}\left(0.2, x \cdot x, 0.6666666666666666\right) \cdot x\right) \cdot x\right) \cdot x\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites93.1%
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
lift-*.f64N/A
pow2N/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
Applied rewrites93.1%
(FPCore (x) :precision binary64 (fabs (/ (* (fma (fma x (* x 0.2) 0.6666666666666666) (* x x) 2.0) x) (sqrt PI))))
double code(double x) {
return fabs(((fma(fma(x, (x * 0.2), 0.6666666666666666), (x * x), 2.0) * x) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(fma(x, Float64(x * 0.2), 0.6666666666666666), Float64(x * x), 2.0) * x) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), x \cdot x, 2\right) \cdot x}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites93.1%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6493.1
Applied rewrites93.1%
(FPCore (x) :precision binary64 (fabs (/ (* (fma (* 0.2 (* x x)) (* x x) 2.0) x) (sqrt PI))))
double code(double x) {
return fabs(((fma((0.2 * (x * x)), (x * x), 2.0) * x) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(Float64(0.2 * Float64(x * x)), Float64(x * x), 2.0) * x) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(N[(0.2 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(0.2 \cdot \left(x \cdot x\right), x \cdot x, 2\right) \cdot x}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites93.1%
Taylor expanded in x around inf
pow2N/A
lift-*.f64N/A
lower-*.f6492.6
Applied rewrites92.6%
(FPCore (x) :precision binary64 (fabs (/ (* (fma 0.6666666666666666 (* x x) 2.0) x) (sqrt PI))))
double code(double x) {
return fabs(((fma(0.6666666666666666, (x * x), 2.0) * x) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(0.6666666666666666, Float64(x * x), 2.0) * x) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] * x), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) \cdot x}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites93.1%
Taylor expanded in x around 0
Applied rewrites88.7%
(FPCore (x) :precision binary64 (fabs (* (/ 1.0 (sqrt PI)) (+ x x))))
double code(double x) {
return fabs(((1.0 / sqrt(((double) M_PI))) * (x + x)));
}
public static double code(double x) {
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * (x + x)));
}
def code(x): return math.fabs(((1.0 / math.sqrt(math.pi)) * (x + x)))
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(x + x))) end
function tmp = code(x) tmp = abs(((1.0 / sqrt(pi)) * (x + x))); end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(x + x\right)\right|
\end{array}
Initial program 99.9%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6432.5
Applied rewrites32.5%
Taylor expanded in x around inf
Applied rewrites67.0%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6467.0
Applied rewrites67.0%
(FPCore (x) :precision binary64 (fabs (/ (* 2.0 x) (sqrt PI))))
double code(double x) {
return fabs(((2.0 * x) / sqrt(((double) M_PI))));
}
public static double code(double x) {
return Math.abs(((2.0 * x) / Math.sqrt(Math.PI)));
}
def code(x): return math.fabs(((2.0 * x) / math.sqrt(math.pi)))
function code(x) return abs(Float64(Float64(2.0 * x) / sqrt(pi))) end
function tmp = code(x) tmp = abs(((2.0 * x) / sqrt(pi))); end
code[x_] := N[Abs[N[(N[(2.0 * x), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{2 \cdot x}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fabs.f64N/A
lower-pow.f6499.9
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites93.1%
Taylor expanded in x around 0
Applied rewrites66.6%
herbie shell --seed 2025088
(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)))))))