
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
(* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x)))))) end
function tmp = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(fabs
(*
(/ 1.0 (sqrt PI))
(+
(+ (+ (* 2.0 (fabs x)) (* (/ 2.0 3.0) t_0)) (* (/ 1.0 5.0) t_1))
(* (/ 1.0 21.0) (* (* t_1 (fabs x)) (fabs x))))))))
double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
return fabs(((1.0 / sqrt(((double) M_PI))) * ((((2.0 * fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * fabs(x)) * fabs(x))))));
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * Math.abs(x)) * Math.abs(x))))));
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * math.fabs(x)) * math.fabs(x))))))
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * t_0)) + Float64(Float64(1.0 / 5.0) * t_1)) + Float64(Float64(1.0 / 21.0) * Float64(Float64(t_1 * abs(x)) * abs(x)))))) end
function tmp = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * t_0)) + ((1.0 / 5.0) * t_1)) + ((1.0 / 21.0) * ((t_1 * abs(x)) * abs(x)))))); end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\\
t_1 := \left(t\_0 \cdot \left|x\right|\right) \cdot \left|x\right|\\
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot t\_0\right) + \frac{1}{5} \cdot t\_1\right) + \frac{1}{21} \cdot \left(\left(t\_1 \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(fabs
(*
(/ 1.0 (sqrt PI))
(fma
0.047619047619047616
(pow (fabs x) 7.0)
(fma
(fabs x)
(fma x (* x 0.6666666666666666) 2.0)
(* 0.2 (pow (fabs x) 5.0)))))))
double code(double x) {
return fabs(((1.0 / sqrt(((double) M_PI))) * fma(0.047619047619047616, pow(fabs(x), 7.0), fma(fabs(x), fma(x, (x * 0.6666666666666666), 2.0), (0.2 * pow(fabs(x), 5.0))))));
}
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * fma(0.047619047619047616, (abs(x) ^ 7.0), fma(abs(x), fma(x, Float64(x * 0.6666666666666666), 2.0), Float64(0.2 * (abs(x) ^ 5.0)))))) end
code[x_] := N[Abs[N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(0.047619047619047616 * N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(x * N[(x * 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] + N[(0.2 * N[Power[N[Abs[x], $MachinePrecision], 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{1}{\sqrt{\pi}} \cdot \mathsf{fma}\left(0.047619047619047616, {\left(\left|x\right|\right)}^{7}, \mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right), 0.2 \cdot {\left(\left|x\right|\right)}^{5}\right)\right)\right|
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
+-commutativeN/A
+-commutativeN/A
unpow3N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(*
(/ 1.0 (sqrt PI))
(fabs
(*
x
(fma
x
(* (* x x) (* x (fma x (* x 0.047619047619047616) 0.2)))
(fma x (* x 0.6666666666666666) 2.0))))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs((x * fma(x, ((x * x) * (x * fma(x, (x * 0.047619047619047616), 0.2))), fma(x, (x * 0.6666666666666666), 2.0))));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(x * fma(x, Float64(Float64(x * x) * Float64(x * fma(x, Float64(x * 0.047619047619047616), 0.2))), fma(x, Float64(x * 0.6666666666666666), 2.0))))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(x * 0.047619047619047616), $MachinePrecision] + 0.2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|x \cdot \mathsf{fma}\left(x, \left(x \cdot x\right) \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.047619047619047616, 0.2\right)\right), \mathsf{fma}\left(x, x \cdot 0.6666666666666666, 2\right)\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x)
:precision binary64
(*
(fabs x)
(fabs
(/
(fma
(* x (* x (* x x)))
(fma 0.047619047619047616 (* x x) 0.2)
(fma 0.6666666666666666 (* x x) 2.0))
(sqrt PI)))))
double code(double x) {
return fabs(x) * fabs((fma((x * (x * (x * x))), fma(0.047619047619047616, (x * x), 0.2), fma(0.6666666666666666, (x * x), 2.0)) / sqrt(((double) M_PI))));
}
function code(x) return Float64(abs(x) * abs(Float64(fma(Float64(x * Float64(x * Float64(x * x))), fma(0.047619047619047616, Float64(x * x), 0.2), fma(0.6666666666666666, Float64(x * x), 2.0)) / sqrt(pi)))) end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.047619047619047616 * N[(x * x), $MachinePrecision] + 0.2), $MachinePrecision] + N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|x\right| \cdot \left|\frac{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), \mathsf{fma}\left(0.047619047619047616, x \cdot x, 0.2\right), \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(*
(/ 1.0 (sqrt PI))
(fabs
(*
x
(fma
x
(fma
x
(* (* x x) (fma (* x x) 0.047619047619047616 0.2))
(* x 0.6666666666666666))
2.0)))))
double code(double x) {
return (1.0 / sqrt(((double) M_PI))) * fabs((x * fma(x, fma(x, ((x * x) * fma((x * x), 0.047619047619047616, 0.2)), (x * 0.6666666666666666)), 2.0)));
}
function code(x) return Float64(Float64(1.0 / sqrt(pi)) * abs(Float64(x * fma(x, fma(x, Float64(Float64(x * x) * fma(Float64(x * x), 0.047619047619047616, 0.2)), Float64(x * 0.6666666666666666)), 2.0)))) end
code[x_] := N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(x * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.047619047619047616 + 0.2), $MachinePrecision]), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\pi}} \cdot \left|x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, \left(x \cdot x\right) \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), x \cdot 0.6666666666666666\right), 2\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
distribute-lft-outN/A
lower-fma.f64N/A
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.05)
(fabs
(* x (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI))))
(*
(fabs x)
(fabs
(/ (* x (* x (* x (* 0.047619047619047616 (* x (* x x)))))) (sqrt PI))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.05) {
tmp = fabs((x * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)))));
} else {
tmp = fabs(x) * fabs(((x * (x * (x * (0.047619047619047616 * (x * (x * x)))))) / sqrt(((double) M_PI))));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 0.05) tmp = abs(Float64(x * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))); else tmp = Float64(abs(x) * abs(Float64(Float64(x * Float64(x * Float64(x * Float64(0.047619047619047616 * Float64(x * Float64(x * x)))))) / sqrt(pi)))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.05], N[Abs[N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(x * N[(x * N[(x * N[(0.047619047619047616 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.05:\\
\;\;\;\;\left|x \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{x \cdot \left(x \cdot \left(x \cdot \left(0.047619047619047616 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right)}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.050000000000000003Initial program 99.8%
Applied rewrites99.2%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
mul-fabsN/A
lower-fabs.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
if 0.050000000000000003 < (fabs.f64 x) Initial program 99.9%
Applied rewrites99.9%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.9%
Taylor expanded in x around inf
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
pow-plusN/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.5
Applied rewrites99.5%
Applied rewrites99.5%
Final simplification99.6%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.05)
(fabs
(* x (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI))))
(*
(fabs x)
(fabs
(/ (* x (* x (* x (* x (* 0.047619047619047616 (* x x)))))) (sqrt PI))))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.05) {
tmp = fabs((x * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)))));
} else {
tmp = fabs(x) * fabs(((x * (x * (x * (x * (0.047619047619047616 * (x * x)))))) / sqrt(((double) M_PI))));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 0.05) tmp = abs(Float64(x * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))); else tmp = Float64(abs(x) * abs(Float64(Float64(x * Float64(x * Float64(x * Float64(x * Float64(0.047619047619047616 * Float64(x * x)))))) / sqrt(pi)))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.05], N[Abs[N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(x * N[(x * N[(x * N[(x * N[(0.047619047619047616 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.05:\\
\;\;\;\;\left|x \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(0.047619047619047616 \cdot \left(x \cdot x\right)\right)\right)\right)\right)}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.050000000000000003Initial program 99.8%
Applied rewrites99.2%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
mul-fabsN/A
lower-fabs.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
if 0.050000000000000003 < (fabs.f64 x) Initial program 99.9%
Applied rewrites99.9%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.9%
Taylor expanded in x around inf
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
pow-plusN/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (* x (* x x))))
(if (<= (fabs x) 0.05)
(fabs
(*
x
(/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI))))
(fabs (/ (* t_0 (* t_0 (* 0.047619047619047616 (fabs x)))) (sqrt PI))))))
double code(double x) {
double t_0 = x * (x * x);
double tmp;
if (fabs(x) <= 0.05) {
tmp = fabs((x * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)))));
} else {
tmp = fabs(((t_0 * (t_0 * (0.047619047619047616 * fabs(x)))) / sqrt(((double) M_PI))));
}
return tmp;
}
function code(x) t_0 = Float64(x * Float64(x * x)) tmp = 0.0 if (abs(x) <= 0.05) tmp = abs(Float64(x * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))); else tmp = abs(Float64(Float64(t_0 * Float64(t_0 * Float64(0.047619047619047616 * abs(x)))) / sqrt(pi))); end return tmp end
code[x_] := Block[{t$95$0 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 0.05], N[Abs[N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t$95$0 * N[(t$95$0 * N[(0.047619047619047616 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;\left|x\right| \leq 0.05:\\
\;\;\;\;\left|x \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{t\_0 \cdot \left(t\_0 \cdot \left(0.047619047619047616 \cdot \left|x\right|\right)\right)}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.050000000000000003Initial program 99.8%
Applied rewrites99.2%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
mul-fabsN/A
lower-fabs.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
if 0.050000000000000003 < (fabs.f64 x) Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
cube-prodN/A
unpow2N/A
cube-unmultN/A
pow-sqrN/A
metadata-evalN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.4
Applied rewrites99.4%
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.05)
(fabs
(* x (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI))))
(fabs
(/
(* (* x x) (* (* x x) (* x (* x (* 0.047619047619047616 (fabs x))))))
(sqrt PI)))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.05) {
tmp = fabs((x * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)))));
} else {
tmp = fabs((((x * x) * ((x * x) * (x * (x * (0.047619047619047616 * fabs(x)))))) / sqrt(((double) M_PI))));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 0.05) tmp = abs(Float64(x * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))); else tmp = abs(Float64(Float64(Float64(x * x) * Float64(Float64(x * x) * Float64(x * Float64(x * Float64(0.047619047619047616 * abs(x)))))) / sqrt(pi))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.05], N[Abs[N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(0.047619047619047616 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.05:\\
\;\;\;\;\left|x \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(0.047619047619047616 \cdot \left|x\right|\right)\right)\right)\right)}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.050000000000000003Initial program 99.8%
Applied rewrites99.2%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
mul-fabsN/A
lower-fabs.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
if 0.050000000000000003 < (fabs.f64 x) Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-fabs.f645.9
Applied rewrites5.9%
Taylor expanded in x around inf
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
pow-plusN/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 0.05)
(fabs
(* x (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI))))
(/
(fabs (* x (* (* x (* x x)) (* x (* 0.047619047619047616 (* x x))))))
(sqrt PI))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.05) {
tmp = fabs((x * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)))));
} else {
tmp = fabs((x * ((x * (x * x)) * (x * (0.047619047619047616 * (x * x)))))) / sqrt(((double) M_PI));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 0.05) tmp = abs(Float64(x * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))); else tmp = Float64(abs(Float64(x * Float64(Float64(x * Float64(x * x)) * Float64(x * Float64(0.047619047619047616 * Float64(x * x)))))) / sqrt(pi)); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.05], N[Abs[N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[N[(x * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * N[(0.047619047619047616 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.05:\\
\;\;\;\;\left|x \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|x \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(0.047619047619047616 \cdot \left(x \cdot x\right)\right)\right)\right)\right|}{\sqrt{\pi}}\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.050000000000000003Initial program 99.8%
Applied rewrites99.2%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
mul-fabsN/A
lower-fabs.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
if 0.050000000000000003 < (fabs.f64 x) Initial program 99.9%
Applied rewrites99.9%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.9%
Taylor expanded in x around inf
metadata-evalN/A
metadata-evalN/A
pow-plusN/A
pow-plusN/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-sqrN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
*-commutativeN/A
Applied rewrites99.4%
Final simplification99.5%
(FPCore (x)
:precision binary64
(fabs
(/
(*
(fabs x)
(fma
(* x x)
(fma (* x x) (fma x (* x 0.047619047619047616) 0.2) 0.6666666666666666)
2.0))
(sqrt PI))))
double code(double x) {
return fabs(((fabs(x) * fma((x * x), fma((x * x), fma(x, (x * 0.047619047619047616), 0.2), 0.6666666666666666), 2.0)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(abs(x) * fma(Float64(x * x), fma(Float64(x * x), fma(x, Float64(x * 0.047619047619047616), 0.2), 0.6666666666666666), 2.0)) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[Abs[x], $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.047619047619047616), $MachinePrecision] + 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\left|x\right| \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-fabs.f6466.4
Applied rewrites66.4%
Taylor expanded in x around 0
Applied rewrites99.4%
(FPCore (x)
:precision binary64
(/
(fabs
(*
x
(fma
(* x x)
(fma x (* x (fma (* x x) 0.047619047619047616 0.2)) 0.6666666666666666)
2.0)))
(sqrt PI)))
double code(double x) {
return fabs((x * fma((x * x), fma(x, (x * fma((x * x), 0.047619047619047616, 0.2)), 0.6666666666666666), 2.0))) / sqrt(((double) M_PI));
}
function code(x) return Float64(abs(Float64(x * fma(Float64(x * x), fma(x, Float64(x * fma(Float64(x * x), 0.047619047619047616, 0.2)), 0.6666666666666666), 2.0))) / sqrt(pi)) end
code[x_] := N[(N[Abs[N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.047619047619047616 + 0.2), $MachinePrecision]), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.047619047619047616, 0.2\right), 0.6666666666666666\right), 2\right)\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
lower-fabs.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.1
Applied rewrites91.1%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
rem-sqrt-squareN/A
sqrt-prodN/A
rem-square-sqrtN/A
Applied rewrites91.1%
Taylor expanded in x around 0
Applied rewrites99.4%
(FPCore (x) :precision binary64 (fabs (* x (/ (fma (* x x) (fma x (* x 0.2) 0.6666666666666666) 2.0) (sqrt PI)))))
double code(double x) {
return fabs((x * (fma((x * x), fma(x, (x * 0.2), 0.6666666666666666), 2.0) / sqrt(((double) M_PI)))));
}
function code(x) return abs(Float64(x * Float64(fma(Float64(x * x), fma(x, Float64(x * 0.2), 0.6666666666666666), 2.0) / sqrt(pi)))) end
code[x_] := N[Abs[N[(x * N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.2), $MachinePrecision] + 0.6666666666666666), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|x \cdot \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.2, 0.6666666666666666\right), 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6495.1
Applied rewrites95.1%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
mul-fabsN/A
lower-fabs.f64N/A
lower-*.f6495.1
Applied rewrites95.1%
(FPCore (x) :precision binary64 (if (<= (fabs x) 0.05) (* (fabs x) (fabs (/ 2.0 (sqrt PI)))) (fabs (/ (* (fabs x) (* 0.6666666666666666 (* x x))) (sqrt PI)))))
double code(double x) {
double tmp;
if (fabs(x) <= 0.05) {
tmp = fabs(x) * fabs((2.0 / sqrt(((double) M_PI))));
} else {
tmp = fabs(((fabs(x) * (0.6666666666666666 * (x * x))) / sqrt(((double) M_PI))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (Math.abs(x) <= 0.05) {
tmp = Math.abs(x) * Math.abs((2.0 / Math.sqrt(Math.PI)));
} else {
tmp = Math.abs(((Math.abs(x) * (0.6666666666666666 * (x * x))) / Math.sqrt(Math.PI)));
}
return tmp;
}
def code(x): tmp = 0 if math.fabs(x) <= 0.05: tmp = math.fabs(x) * math.fabs((2.0 / math.sqrt(math.pi))) else: tmp = math.fabs(((math.fabs(x) * (0.6666666666666666 * (x * x))) / math.sqrt(math.pi))) return tmp
function code(x) tmp = 0.0 if (abs(x) <= 0.05) tmp = Float64(abs(x) * abs(Float64(2.0 / sqrt(pi)))); else tmp = abs(Float64(Float64(abs(x) * Float64(0.6666666666666666 * Float64(x * x))) / sqrt(pi))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (abs(x) <= 0.05) tmp = abs(x) * abs((2.0 / sqrt(pi))); else tmp = abs(((abs(x) * (0.6666666666666666 * (x * x))) / sqrt(pi))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 0.05], N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(N[Abs[x], $MachinePrecision] * N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.05:\\
\;\;\;\;\left|x\right| \cdot \left|\frac{2}{\sqrt{\pi}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left|x\right| \cdot \left(0.6666666666666666 \cdot \left(x \cdot x\right)\right)}{\sqrt{\pi}}\right|\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.050000000000000003Initial program 99.8%
Applied rewrites99.2%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites98.8%
if 0.050000000000000003 < (fabs.f64 x) Initial program 99.9%
Applied rewrites99.9%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
lower-fabs.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
Taylor expanded in x around inf
Applied rewrites76.7%
(FPCore (x) :precision binary64 (* (fabs x) (fabs (/ (fma 0.6666666666666666 (* x x) 2.0) (sqrt PI)))))
double code(double x) {
return fabs(x) * fabs((fma(0.6666666666666666, (x * x), 2.0) / sqrt(((double) M_PI))));
}
function code(x) return Float64(abs(x) * abs(Float64(fma(0.6666666666666666, Float64(x * x), 2.0) / sqrt(pi)))) end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|x\right| \cdot \left|\frac{\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.5
Applied rewrites91.5%
(FPCore (x) :precision binary64 (fabs (/ (* (fabs x) (fma 0.6666666666666666 (* x x) 2.0)) (sqrt PI))))
double code(double x) {
return fabs(((fabs(x) * fma(0.6666666666666666, (x * x), 2.0)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(abs(x) * fma(0.6666666666666666, Float64(x * x), 2.0)) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[Abs[x], $MachinePrecision] * N[(0.6666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\left|x\right| \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-*.f64N/A
lower-fabs.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.1
Applied rewrites91.1%
(FPCore (x) :precision binary64 (fabs (/ (* (fabs x) (* (sqrt PI) 2.0)) PI)))
double code(double x) {
return fabs(((fabs(x) * (sqrt(((double) M_PI)) * 2.0)) / ((double) M_PI)));
}
public static double code(double x) {
return Math.abs(((Math.abs(x) * (Math.sqrt(Math.PI) * 2.0)) / Math.PI));
}
def code(x): return math.fabs(((math.fabs(x) * (math.sqrt(math.pi) * 2.0)) / math.pi))
function code(x) return abs(Float64(Float64(abs(x) * Float64(sqrt(pi) * 2.0)) / pi)) end
function tmp = code(x) tmp = abs(((abs(x) * (sqrt(pi) * 2.0)) / pi)); end
code[x_] := N[Abs[N[(N[(N[Abs[x], $MachinePrecision] * N[(N[Sqrt[Pi], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{\left|x\right| \cdot \left(\sqrt{\pi} \cdot 2\right)}{\pi}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.6%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-PI.f6466.9
Applied rewrites66.9%
Final simplification66.9%
(FPCore (x) :precision binary64 (* (fabs x) (fabs (/ 2.0 (sqrt PI)))))
double code(double x) {
return fabs(x) * fabs((2.0 / sqrt(((double) M_PI))));
}
public static double code(double x) {
return Math.abs(x) * Math.abs((2.0 / Math.sqrt(Math.PI)));
}
def code(x): return math.fabs(x) * math.fabs((2.0 / math.sqrt(math.pi)))
function code(x) return Float64(abs(x) * abs(Float64(2.0 / sqrt(pi)))) end
function tmp = code(x) tmp = abs(x) * abs((2.0 / sqrt(pi))); end
code[x_] := N[(N[Abs[x], $MachinePrecision] * N[Abs[N[(2.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left|x\right| \cdot \left|\frac{2}{\sqrt{\pi}}\right|
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites66.9%
(FPCore (x) :precision binary64 (/ (fabs (* x 2.0)) (sqrt PI)))
double code(double x) {
return fabs((x * 2.0)) / sqrt(((double) M_PI));
}
public static double code(double x) {
return Math.abs((x * 2.0)) / Math.sqrt(Math.PI);
}
def code(x): return math.fabs((x * 2.0)) / math.sqrt(math.pi)
function code(x) return Float64(abs(Float64(x * 2.0)) / sqrt(pi)) end
function tmp = code(x) tmp = abs((x * 2.0)) / sqrt(pi); end
code[x_] := N[(N[Abs[N[(x * 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left|x \cdot 2\right|}{\sqrt{\pi}}
\end{array}
Initial program 99.8%
Applied rewrites99.4%
lift-fabs.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
associate-/l*N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites66.9%
lift-*.f64N/A
*-commutativeN/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
rem-sqrt-squareN/A
sqrt-prodN/A
rem-square-sqrtN/A
Applied rewrites66.4%
Final simplification66.4%
herbie shell --seed 2024226
(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)))))))