
(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}
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}
Herbie found 14 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}
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}
(FPCore (x)
:precision binary64
(*
(*
(fabs
(fma
(/ (* (* x x) (fma (* 0.2 x) x 0.6666666666666666)) 2.0)
1.0
(fma 0.023809523809523808 (* (* (* (* (* x x) x) x) x) x) 1.0)))
(/ 1.0 (sqrt PI)))
(* 2.0 (fabs x))))double code(double x) {
return (fabs(fma((((x * x) * fma((0.2 * x), x, 0.6666666666666666)) / 2.0), 1.0, fma(0.023809523809523808, (((((x * x) * x) * x) * x) * x), 1.0))) * (1.0 / sqrt(((double) M_PI)))) * (2.0 * fabs(x));
}
function code(x) return Float64(Float64(abs(fma(Float64(Float64(Float64(x * x) * fma(Float64(0.2 * x), x, 0.6666666666666666)) / 2.0), 1.0, fma(0.023809523809523808, Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * x) * x), 1.0))) * Float64(1.0 / sqrt(pi))) * Float64(2.0 * abs(x))) end
code[x_] := N[(N[(N[Abs[N[(N[(N[(N[(x * x), $MachinePrecision] * N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] * 1.0 + N[(0.023809523809523808 * N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left|\mathsf{fma}\left(\frac{\left(x \cdot x\right) \cdot \mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right)}{2}, 1, \mathsf{fma}\left(0.023809523809523808, \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot x, 1\right)\right)\right| \cdot \frac{1}{\sqrt{\pi}}\right) \cdot \left(2 \cdot \left|x\right|\right)
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(*
0.5641895835477563
(fabs
(fma
(fabs x)
(fma (* 0.2 (* x x)) (* x x) (* (* t_0 t_0) 0.047619047619047616))
(* (fabs x) (fma (* x x) 0.6666666666666666 2.0)))))))double code(double x) {
double t_0 = (x * x) * x;
return 0.5641895835477563 * fabs(fma(fabs(x), fma((0.2 * (x * x)), (x * x), ((t_0 * t_0) * 0.047619047619047616)), (fabs(x) * fma((x * x), 0.6666666666666666, 2.0))));
}
function code(x) t_0 = Float64(Float64(x * x) * x) return Float64(0.5641895835477563 * abs(fma(abs(x), fma(Float64(0.2 * Float64(x * x)), Float64(x * x), Float64(Float64(t_0 * t_0) * 0.047619047619047616)), Float64(abs(x) * fma(Float64(x * x), 0.6666666666666666, 2.0))))) end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, N[(0.5641895835477563 * N[Abs[N[(N[Abs[x], $MachinePrecision] * N[(N[(0.2 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.047619047619047616), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.6666666666666666 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
0.5641895835477563 \cdot \left|\mathsf{fma}\left(\left|x\right|, \mathsf{fma}\left(0.2 \cdot \left(x \cdot x\right), x \cdot x, \left(t\_0 \cdot t\_0\right) \cdot 0.047619047619047616\right), \left|x\right| \cdot \mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right)\right)\right|
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Evaluated real constant99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(*
(fabs
(*
(/
(fma
(* (fma (* 0.2 x) x 0.6666666666666666) 0.5)
(* x x)
(fma (* 0.023809523809523808 t_0) t_0 1.0))
1.772453850905516)
x))
2.0)))double code(double x) {
double t_0 = (x * x) * x;
return fabs(((fma((fma((0.2 * x), x, 0.6666666666666666) * 0.5), (x * x), fma((0.023809523809523808 * t_0), t_0, 1.0)) / 1.772453850905516) * x)) * 2.0;
}
function code(x) t_0 = Float64(Float64(x * x) * x) return Float64(abs(Float64(Float64(fma(Float64(fma(Float64(0.2 * x), x, 0.6666666666666666) * 0.5), Float64(x * x), fma(Float64(0.023809523809523808 * t_0), t_0, 1.0)) / 1.772453850905516) * x)) * 2.0) end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, N[(N[Abs[N[(N[(N[(N[(N[(N[(0.2 * x), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision] * 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(N[(0.023809523809523808 * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision] / 1.772453850905516), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
\left|\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot x, x, 0.6666666666666666\right) \cdot 0.5, x \cdot x, \mathsf{fma}\left(0.023809523809523808 \cdot t\_0, t\_0, 1\right)\right)}{1.772453850905516} \cdot x\right| \cdot 2
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Evaluated real constant99.8%
(FPCore (x)
:precision binary64
(*
(/
(fabs
(*
(fma
x
(fma
(* 0.5 (fma (* x 0.2) x 0.6666666666666666))
x
(* 0.023809523809523808 (* (* (* (* x x) x) x) x)))
1.0)
x))
(sqrt PI))
2.0))double code(double x) {
return (fabs((fma(x, fma((0.5 * fma((x * 0.2), x, 0.6666666666666666)), x, (0.023809523809523808 * ((((x * x) * x) * x) * x))), 1.0) * x)) / sqrt(((double) M_PI))) * 2.0;
}
function code(x) return Float64(Float64(abs(Float64(fma(x, fma(Float64(0.5 * fma(Float64(x * 0.2), x, 0.6666666666666666)), x, Float64(0.023809523809523808 * Float64(Float64(Float64(Float64(x * x) * x) * x) * x))), 1.0) * x)) / sqrt(pi)) * 2.0) end
code[x_] := N[(N[(N[Abs[N[(N[(x * N[(N[(0.5 * N[(N[(x * 0.2), $MachinePrecision] * x + 0.6666666666666666), $MachinePrecision]), $MachinePrecision] * x + N[(0.023809523809523808 * N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
\frac{\left|\mathsf{fma}\left(x, \mathsf{fma}\left(0.5 \cdot \mathsf{fma}\left(x \cdot 0.2, x, 0.6666666666666666\right), x, 0.023809523809523808 \cdot \left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right)\right), 1\right) \cdot x\right|}{\sqrt{\pi}} \cdot 2
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.4%
(FPCore (x)
:precision binary64
(if (<= (fabs x) 6800.0)
(*
(fabs
(*
(/
(fma
(* (fma (* 0.2 (fabs x)) (fabs x) 0.6666666666666666) 0.5)
(* (fabs x) (fabs x))
1.0)
(sqrt PI))
(fabs x)))
2.0)
(fabs
(*
0.047619047619047616
(/ (* (pow (fabs x) 6.0) (fabs (fabs x))) (sqrt PI))))))double code(double x) {
double tmp;
if (fabs(x) <= 6800.0) {
tmp = fabs(((fma((fma((0.2 * fabs(x)), fabs(x), 0.6666666666666666) * 0.5), (fabs(x) * fabs(x)), 1.0) / sqrt(((double) M_PI))) * fabs(x))) * 2.0;
} else {
tmp = fabs((0.047619047619047616 * ((pow(fabs(x), 6.0) * fabs(fabs(x))) / sqrt(((double) M_PI)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (abs(x) <= 6800.0) tmp = Float64(abs(Float64(Float64(fma(Float64(fma(Float64(0.2 * abs(x)), abs(x), 0.6666666666666666) * 0.5), Float64(abs(x) * abs(x)), 1.0) / sqrt(pi)) * abs(x))) * 2.0); else tmp = abs(Float64(0.047619047619047616 * Float64(Float64((abs(x) ^ 6.0) * abs(abs(x))) / sqrt(pi)))); end return tmp end
code[x_] := If[LessEqual[N[Abs[x], $MachinePrecision], 6800.0], N[(N[Abs[N[(N[(N[(N[(N[(N[(0.2 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision] + 0.6666666666666666), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision], N[Abs[N[(0.047619047619047616 * N[(N[(N[Power[N[Abs[x], $MachinePrecision], 6.0], $MachinePrecision] * N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 6800:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.2 \cdot \left|x\right|, \left|x\right|, 0.6666666666666666\right) \cdot 0.5, \left|x\right| \cdot \left|x\right|, 1\right)}{\sqrt{\pi}} \cdot \left|x\right|\right| \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left|0.047619047619047616 \cdot \frac{{\left(\left|x\right|\right)}^{6} \cdot \left|\left|x\right|\right|}{\sqrt{\pi}}\right|\\
\end{array}
if x < 6800Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites93.7%
if 6800 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.1%
Applied rewrites37.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (fabs (fabs x))))
(if (<= (fabs x) 6800.0)
(fabs
(fma
(* (/ t_0 (sqrt PI)) (* (fabs x) (fabs x)))
0.6666666666666666
(* t_0 1.1283791670955126)))
(fabs
(* 0.047619047619047616 (/ (* (pow (fabs x) 6.0) t_0) (sqrt PI)))))))double code(double x) {
double t_0 = fabs(fabs(x));
double tmp;
if (fabs(x) <= 6800.0) {
tmp = fabs(fma(((t_0 / sqrt(((double) M_PI))) * (fabs(x) * fabs(x))), 0.6666666666666666, (t_0 * 1.1283791670955126)));
} else {
tmp = fabs((0.047619047619047616 * ((pow(fabs(x), 6.0) * t_0) / sqrt(((double) M_PI)))));
}
return tmp;
}
function code(x) t_0 = abs(abs(x)) tmp = 0.0 if (abs(x) <= 6800.0) tmp = abs(fma(Float64(Float64(t_0 / sqrt(pi)) * Float64(abs(x) * abs(x))), 0.6666666666666666, Float64(t_0 * 1.1283791670955126))); else tmp = abs(Float64(0.047619047619047616 * Float64(Float64((abs(x) ^ 6.0) * t_0) / sqrt(pi)))); end return tmp end
code[x_] := Block[{t$95$0 = N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 6800.0], N[Abs[N[(N[(N[(t$95$0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.6666666666666666 + N[(t$95$0 * 1.1283791670955126), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(0.047619047619047616 * N[(N[(N[Power[N[Abs[x], $MachinePrecision], 6.0], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|\left|x\right|\right|\\
\mathbf{if}\;\left|x\right| \leq 6800:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{t\_0}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left|x\right|\right), 0.6666666666666666, t\_0 \cdot 1.1283791670955126\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|0.047619047619047616 \cdot \frac{{\left(\left|x\right|\right)}^{6} \cdot t\_0}{\sqrt{\pi}}\right|\\
\end{array}
if x < 6800Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6489.1%
Applied rewrites89.1%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6489.1%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6489.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
Applied rewrites89.5%
Evaluated real constant89.5%
if 6800 < x Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6437.1%
Applied rewrites37.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (fabs (fabs x))))
(if (<= (fabs x) 6800.0)
(fabs
(fma
(* (/ t_0 (sqrt PI)) (* (fabs x) (fabs x)))
0.6666666666666666
(* t_0 1.1283791670955126)))
(/ (fabs (* (pow t_0 7.0) 0.047619047619047616)) (sqrt PI)))))double code(double x) {
double t_0 = fabs(fabs(x));
double tmp;
if (fabs(x) <= 6800.0) {
tmp = fabs(fma(((t_0 / sqrt(((double) M_PI))) * (fabs(x) * fabs(x))), 0.6666666666666666, (t_0 * 1.1283791670955126)));
} else {
tmp = fabs((pow(t_0, 7.0) * 0.047619047619047616)) / sqrt(((double) M_PI));
}
return tmp;
}
function code(x) t_0 = abs(abs(x)) tmp = 0.0 if (abs(x) <= 6800.0) tmp = abs(fma(Float64(Float64(t_0 / sqrt(pi)) * Float64(abs(x) * abs(x))), 0.6666666666666666, Float64(t_0 * 1.1283791670955126))); else tmp = Float64(abs(Float64((t_0 ^ 7.0) * 0.047619047619047616)) / sqrt(pi)); end return tmp end
code[x_] := Block[{t$95$0 = N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 6800.0], N[Abs[N[(N[(N[(t$95$0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.6666666666666666 + N[(t$95$0 * 1.1283791670955126), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[N[(N[Power[t$95$0, 7.0], $MachinePrecision] * 0.047619047619047616), $MachinePrecision]], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|\left|x\right|\right|\\
\mathbf{if}\;\left|x\right| \leq 6800:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{t\_0}{\sqrt{\pi}} \cdot \left(\left|x\right| \cdot \left|x\right|\right), 0.6666666666666666, t\_0 \cdot 1.1283791670955126\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|{t\_0}^{7} \cdot 0.047619047619047616\right|}{\sqrt{\pi}}\\
\end{array}
if x < 6800Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6489.1%
Applied rewrites89.1%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6489.1%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6489.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
Applied rewrites89.5%
Evaluated real constant89.5%
if 6800 < x Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f6437.1%
Applied rewrites37.1%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow3N/A
pow3N/A
*-commutativeN/A
lower-*.f64N/A
swap-sqrN/A
pow3N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
pow1/2N/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
sqrt-pow2N/A
rem-sqrt-square-revN/A
lift-fabs.f64N/A
lift-pow.f6437.1%
Applied rewrites37.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (fabs (fabs x)))
(t_1 (* (fabs x) (fabs x)))
(t_2 (* t_1 (fabs x))))
(if (<= (fabs x) 6800.0)
(fabs
(fma
(* (/ t_0 (sqrt PI)) t_1)
0.6666666666666666
(* t_0 1.1283791670955126)))
(/
(fabs (* t_2 (* (* 0.047619047619047616 t_2) t_0)))
1.772453850905516))))double code(double x) {
double t_0 = fabs(fabs(x));
double t_1 = fabs(x) * fabs(x);
double t_2 = t_1 * fabs(x);
double tmp;
if (fabs(x) <= 6800.0) {
tmp = fabs(fma(((t_0 / sqrt(((double) M_PI))) * t_1), 0.6666666666666666, (t_0 * 1.1283791670955126)));
} else {
tmp = fabs((t_2 * ((0.047619047619047616 * t_2) * t_0))) / 1.772453850905516;
}
return tmp;
}
function code(x) t_0 = abs(abs(x)) t_1 = Float64(abs(x) * abs(x)) t_2 = Float64(t_1 * abs(x)) tmp = 0.0 if (abs(x) <= 6800.0) tmp = abs(fma(Float64(Float64(t_0 / sqrt(pi)) * t_1), 0.6666666666666666, Float64(t_0 * 1.1283791670955126))); else tmp = Float64(abs(Float64(t_2 * Float64(Float64(0.047619047619047616 * t_2) * t_0))) / 1.772453850905516); end return tmp end
code[x_] := Block[{t$95$0 = N[Abs[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 6800.0], N[Abs[N[(N[(N[(t$95$0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * 0.6666666666666666 + N[(t$95$0 * 1.1283791670955126), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Abs[N[(t$95$2 * N[(N[(0.047619047619047616 * t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 1.772453850905516), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left|\left|x\right|\right|\\
t_1 := \left|x\right| \cdot \left|x\right|\\
t_2 := t\_1 \cdot \left|x\right|\\
\mathbf{if}\;\left|x\right| \leq 6800:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{t\_0}{\sqrt{\pi}} \cdot t\_1, 0.6666666666666666, t\_0 \cdot 1.1283791670955126\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|t\_2 \cdot \left(\left(0.047619047619047616 \cdot t\_2\right) \cdot t\_0\right)\right|}{1.772453850905516}\\
\end{array}
if x < 6800Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6489.1%
Applied rewrites89.1%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6489.1%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6489.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
Applied rewrites89.5%
Evaluated real constant89.5%
if 6800 < x Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f6437.1%
Applied rewrites37.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow3N/A
pow3N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-fabs.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites37.1%
Evaluated real constant37.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(*
(fabs
(*
(/
(fma
0.3333333333333333
(* x x)
(fma (* 0.023809523809523808 t_0) t_0 1.0))
(sqrt PI))
x))
2.0)))double code(double x) {
double t_0 = (x * x) * x;
return fabs(((fma(0.3333333333333333, (x * x), fma((0.023809523809523808 * t_0), t_0, 1.0)) / sqrt(((double) M_PI))) * x)) * 2.0;
}
function code(x) t_0 = Float64(Float64(x * x) * x) return Float64(abs(Float64(Float64(fma(0.3333333333333333, Float64(x * x), fma(Float64(0.023809523809523808 * t_0), t_0, 1.0)) / sqrt(pi)) * x)) * 2.0) end
code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, N[(N[Abs[N[(N[(N[(0.3333333333333333 * N[(x * x), $MachinePrecision] + N[(N[(0.023809523809523808 * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
\left|\frac{\mathsf{fma}\left(0.3333333333333333, x \cdot x, \mathsf{fma}\left(0.023809523809523808 \cdot t\_0, t\_0, 1\right)\right)}{\sqrt{\pi}} \cdot x\right| \cdot 2
\end{array}
Initial program 99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites99.2%
(FPCore (x) :precision binary64 (fabs (/ (- (* -0.047619047619047616 (pow (fabs x) 7.0)) (* 2.0 (fabs x))) (- (sqrt PI)))))
double code(double x) {
return fabs((((-0.047619047619047616 * pow(fabs(x), 7.0)) - (2.0 * fabs(x))) / -sqrt(((double) M_PI))));
}
public static double code(double x) {
return Math.abs((((-0.047619047619047616 * Math.pow(Math.abs(x), 7.0)) - (2.0 * Math.abs(x))) / -Math.sqrt(Math.PI)));
}
def code(x): return math.fabs((((-0.047619047619047616 * math.pow(math.fabs(x), 7.0)) - (2.0 * math.fabs(x))) / -math.sqrt(math.pi)))
function code(x) return abs(Float64(Float64(Float64(-0.047619047619047616 * (abs(x) ^ 7.0)) - Float64(2.0 * abs(x))) / Float64(-sqrt(pi)))) end
function tmp = code(x) tmp = abs((((-0.047619047619047616 * (abs(x) ^ 7.0)) - (2.0 * abs(x))) / -sqrt(pi))); end
code[x_] := N[Abs[N[(N[(N[(-0.047619047619047616 * N[Power[N[Abs[x], $MachinePrecision], 7.0], $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[Pi], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]
\left|\frac{-0.047619047619047616 \cdot {\left(\left|x\right|\right)}^{7} - 2 \cdot \left|x\right|}{-\sqrt{\pi}}\right|
Initial program 99.8%
Applied rewrites99.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-*.f64N/A
lower-fabs.f6498.4%
Applied rewrites98.4%
(FPCore (x) :precision binary64 (fabs (fma (* (/ (fabs x) (sqrt PI)) (* x x)) 0.6666666666666666 (* (fabs x) 1.1283791670955126))))
double code(double x) {
return fabs(fma(((fabs(x) / sqrt(((double) M_PI))) * (x * x)), 0.6666666666666666, (fabs(x) * 1.1283791670955126)));
}
function code(x) return abs(fma(Float64(Float64(abs(x) / sqrt(pi)) * Float64(x * x)), 0.6666666666666666, Float64(abs(x) * 1.1283791670955126))) end
code[x_] := N[Abs[N[(N[(N[(N[Abs[x], $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.6666666666666666 + N[(N[Abs[x], $MachinePrecision] * 1.1283791670955126), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\mathsf{fma}\left(\frac{\left|x\right|}{\sqrt{\pi}} \cdot \left(x \cdot x\right), 0.6666666666666666, \left|x\right| \cdot 1.1283791670955126\right)\right|
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6489.1%
Applied rewrites89.1%
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6489.1%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6489.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
Applied rewrites89.5%
Evaluated real constant89.5%
(FPCore (x) :precision binary64 (fabs (/ (* (fma (* x x) 0.6666666666666666 2.0) (fabs x)) (sqrt PI))))
double code(double x) {
return fabs(((fma((x * x), 0.6666666666666666, 2.0) * fabs(x)) / sqrt(((double) M_PI))));
}
function code(x) return abs(Float64(Float64(fma(Float64(x * x), 0.6666666666666666, 2.0) * abs(x)) / sqrt(pi))) end
code[x_] := N[Abs[N[(N[(N[(N[(x * x), $MachinePrecision] * 0.6666666666666666 + 2.0), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{\mathsf{fma}\left(x \cdot x, 0.6666666666666666, 2\right) \cdot \left|x\right|}{\sqrt{\pi}}\right|
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6489.1%
Applied rewrites89.1%
lift-fma.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
div-add-revN/A
Applied rewrites89.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* (fabs x) (fabs x)) (fabs x)))
(t_1 (* (* t_0 (fabs x)) (fabs x))))
(if (<=
(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))))))
2e+306)
(fabs (* (fabs x) 1.1283791670955126))
(fabs (* 2.0 (sqrt (/ (* x x) PI)))))))double code(double x) {
double t_0 = (fabs(x) * fabs(x)) * fabs(x);
double t_1 = (t_0 * fabs(x)) * fabs(x);
double tmp;
if (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)))))) <= 2e+306) {
tmp = fabs((fabs(x) * 1.1283791670955126));
} else {
tmp = fabs((2.0 * sqrt(((x * x) / ((double) M_PI)))));
}
return tmp;
}
public static double code(double x) {
double t_0 = (Math.abs(x) * Math.abs(x)) * Math.abs(x);
double t_1 = (t_0 * Math.abs(x)) * Math.abs(x);
double tmp;
if (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)))))) <= 2e+306) {
tmp = Math.abs((Math.abs(x) * 1.1283791670955126));
} else {
tmp = Math.abs((2.0 * Math.sqrt(((x * x) / Math.PI))));
}
return tmp;
}
def code(x): t_0 = (math.fabs(x) * math.fabs(x)) * math.fabs(x) t_1 = (t_0 * math.fabs(x)) * math.fabs(x) tmp = 0 if 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)))))) <= 2e+306: tmp = math.fabs((math.fabs(x) * 1.1283791670955126)) else: tmp = math.fabs((2.0 * math.sqrt(((x * x) / math.pi)))) return tmp
function code(x) t_0 = Float64(Float64(abs(x) * abs(x)) * abs(x)) t_1 = Float64(Float64(t_0 * abs(x)) * abs(x)) tmp = 0.0 if (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)))))) <= 2e+306) tmp = abs(Float64(abs(x) * 1.1283791670955126)); else tmp = abs(Float64(2.0 * sqrt(Float64(Float64(x * x) / pi)))); end return tmp end
function tmp_2 = code(x) t_0 = (abs(x) * abs(x)) * abs(x); t_1 = (t_0 * abs(x)) * abs(x); tmp = 0.0; if (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)))))) <= 2e+306) tmp = abs((abs(x) * 1.1283791670955126)); else tmp = abs((2.0 * sqrt(((x * x) / pi)))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], 2e+306], N[Abs[N[(N[Abs[x], $MachinePrecision] * 1.1283791670955126), $MachinePrecision]], $MachinePrecision], N[Abs[N[(2.0 * N[Sqrt[N[(N[(x * x), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\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|\\
\mathbf{if}\;\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| \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\left|\left|x\right| \cdot 1.1283791670955126\right|\\
\mathbf{else}:\\
\;\;\;\;\left|2 \cdot \sqrt{\frac{x \cdot x}{\pi}}\right|\\
\end{array}
if (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) < 2e306Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6467.1%
Applied rewrites67.1%
Evaluated real constant67.3%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
mult-flipN/A
distribute-lft-outN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-eval67.5%
Applied rewrites67.5%
if 2e306 < (fabs.f64 (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 (PI.f64))) (+.f64 (+.f64 (+.f64 (*.f64 #s(literal 2 binary64) (fabs.f64 x)) (*.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 5 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))) (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 21 binary64)) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)) (fabs.f64 x)))))) Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6467.1%
Applied rewrites67.1%
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
lift-sqrt.f64N/A
sqrt-undivN/A
lower-sqrt.f64N/A
lower-/.f64N/A
lift-*.f6454.6%
Applied rewrites54.6%
(FPCore (x) :precision binary64 (fabs (* (fabs x) 1.1283791670955126)))
double code(double x) {
return fabs((fabs(x) * 1.1283791670955126));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = abs((abs(x) * 1.1283791670955126d0))
end function
public static double code(double x) {
return Math.abs((Math.abs(x) * 1.1283791670955126));
}
def code(x): return math.fabs((math.fabs(x) * 1.1283791670955126))
function code(x) return abs(Float64(abs(x) * 1.1283791670955126)) end
function tmp = code(x) tmp = abs((abs(x) * 1.1283791670955126)); end
code[x_] := N[Abs[N[(N[Abs[x], $MachinePrecision] * 1.1283791670955126), $MachinePrecision]], $MachinePrecision]
\left|\left|x\right| \cdot 1.1283791670955126\right|
Initial program 99.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
lower-sqrt.f64N/A
lower-PI.f6467.1%
Applied rewrites67.1%
Evaluated real constant67.3%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
mult-flipN/A
distribute-lft-outN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-eval67.5%
Applied rewrites67.5%
herbie shell --seed 2025204
(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)))))))