| Alternative 1 | |
|---|---|
| Accuracy | 98.8% |
| Cost | 32960 |
\[\left|\left({\pi}^{-0.5} \cdot x\right) \cdot \left(2 + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\]
(FPCore (x)
:precision binary64
(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)))))))(FPCore (x)
:precision binary64
(fabs
(*
(* (pow PI -0.5) x)
(+
(+ (* 0.6666666666666666 (* x x)) 2.0)
(+ (* 0.2 (pow x 4.0)) (* 0.047619047619047616 (pow x 6.0)))))))double code(double x) {
return fabs(((1.0 / sqrt(((double) M_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))))));
}
double code(double x) {
return fabs(((pow(((double) M_PI), -0.5) * x) * (((0.6666666666666666 * (x * x)) + 2.0) + ((0.2 * pow(x, 4.0)) + (0.047619047619047616 * pow(x, 6.0))))));
}
public static double code(double x) {
return Math.abs(((1.0 / Math.sqrt(Math.PI)) * ((((2.0 * Math.abs(x)) + ((2.0 / 3.0) * ((Math.abs(x) * Math.abs(x)) * Math.abs(x)))) + ((1.0 / 5.0) * ((((Math.abs(x) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)))) + ((1.0 / 21.0) * ((((((Math.abs(x) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x)) * Math.abs(x))))));
}
public static double code(double x) {
return Math.abs(((Math.pow(Math.PI, -0.5) * x) * (((0.6666666666666666 * (x * x)) + 2.0) + ((0.2 * Math.pow(x, 4.0)) + (0.047619047619047616 * Math.pow(x, 6.0))))));
}
def code(x): return math.fabs(((1.0 / math.sqrt(math.pi)) * ((((2.0 * math.fabs(x)) + ((2.0 / 3.0) * ((math.fabs(x) * math.fabs(x)) * math.fabs(x)))) + ((1.0 / 5.0) * ((((math.fabs(x) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)))) + ((1.0 / 21.0) * ((((((math.fabs(x) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x)) * math.fabs(x))))))
def code(x): return math.fabs(((math.pow(math.pi, -0.5) * x) * (((0.6666666666666666 * (x * x)) + 2.0) + ((0.2 * math.pow(x, 4.0)) + (0.047619047619047616 * math.pow(x, 6.0))))))
function code(x) return abs(Float64(Float64(1.0 / sqrt(pi)) * Float64(Float64(Float64(Float64(2.0 * abs(x)) + Float64(Float64(2.0 / 3.0) * Float64(Float64(abs(x) * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 5.0) * Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)))) + Float64(Float64(1.0 / 21.0) * Float64(Float64(Float64(Float64(Float64(Float64(abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)))))) end
function code(x) return abs(Float64(Float64((pi ^ -0.5) * x) * Float64(Float64(Float64(0.6666666666666666 * Float64(x * x)) + 2.0) + Float64(Float64(0.2 * (x ^ 4.0)) + Float64(0.047619047619047616 * (x ^ 6.0)))))) end
function tmp = code(x) tmp = abs(((1.0 / sqrt(pi)) * ((((2.0 * abs(x)) + ((2.0 / 3.0) * ((abs(x) * abs(x)) * abs(x)))) + ((1.0 / 5.0) * ((((abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)))) + ((1.0 / 21.0) * ((((((abs(x) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)) * abs(x)))))); end
function tmp = code(x) tmp = abs((((pi ^ -0.5) * x) * (((0.6666666666666666 * (x * x)) + 2.0) + ((0.2 * (x ^ 4.0)) + (0.047619047619047616 * (x ^ 6.0)))))); end
code[x_] := 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] * N[(N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 5.0), $MachinePrecision] * 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[(N[(1.0 / 21.0), $MachinePrecision] * N[(N[(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] * N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Abs[N[(N[(N[Power[Pi, -0.5], $MachinePrecision] * x), $MachinePrecision] * N[(N[(N[(0.6666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] + N[(N[(0.2 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \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) + \frac{1}{21} \cdot \left(\left(\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) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\left|\left({\pi}^{-0.5} \cdot x\right) \cdot \left(\left(0.6666666666666666 \cdot \left(x \cdot x\right) + 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
Results
Initial program 99.8%
Simplified99.2%
[Start]99.8 | \[ \left|\frac{1}{\sqrt{\pi}} \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \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) + \frac{1}{21} \cdot \left(\left(\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) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)\right|
\] |
|---|---|
associate-*l/ [=>]99.1 | \[ \left|\color{blue}{\frac{1 \cdot \left(\left(\left(2 \cdot \left|x\right| + \frac{2}{3} \cdot \left(\left(\left|x\right| \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right) + \frac{1}{5} \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) + \frac{1}{21} \cdot \left(\left(\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) \cdot \left|x\right|\right) \cdot \left|x\right|\right)\right)}{\sqrt{\pi}}}\right|
\] |
Applied egg-rr99.2%
[Start]99.2 | \[ \left|\frac{\left|x\right|}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
|---|---|
add-log-exp [=>]7.9 | \[ \left|\color{blue}{\log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
*-un-lft-identity [=>]7.9 | \[ \left|\log \color{blue}{\left(1 \cdot e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
log-prod [=>]7.9 | \[ \left|\color{blue}{\left(\log 1 + \log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)\right)} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
metadata-eval [=>]7.9 | \[ \left|\left(\color{blue}{0} + \log \left(e^{\frac{\left|x\right|}{\sqrt{\pi}}}\right)\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
add-log-exp [<=]99.2 | \[ \left|\left(0 + \color{blue}{\frac{\left|x\right|}{\sqrt{\pi}}}\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
add-sqr-sqrt [=>]45.9 | \[ \left|\left(0 + \frac{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}{\sqrt{\pi}}\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
fabs-sqr [=>]45.9 | \[ \left|\left(0 + \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{\sqrt{\pi}}\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
add-sqr-sqrt [<=]99.2 | \[ \left|\left(0 + \frac{\color{blue}{x}}{\sqrt{\pi}}\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
Simplified99.2%
[Start]99.2 | \[ \left|\left(0 + \frac{x}{\sqrt{\pi}}\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
|---|---|
+-lft-identity [=>]99.2 | \[ \left|\color{blue}{\frac{x}{\sqrt{\pi}}} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
Taylor expanded in x around 0 99.2%
Applied egg-rr99.8%
[Start]99.2 | \[ \left|\frac{x}{\sqrt{\pi}} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
|---|---|
clear-num [=>]99.2 | \[ \left|\color{blue}{\frac{1}{\frac{\sqrt{\pi}}{x}}} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
associate-/r/ [=>]99.8 | \[ \left|\color{blue}{\left(\frac{1}{\sqrt{\pi}} \cdot x\right)} \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
pow1/2 [=>]99.8 | \[ \left|\left(\frac{1}{\color{blue}{{\pi}^{0.5}}} \cdot x\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
pow-flip [=>]99.8 | \[ \left|\left(\color{blue}{{\pi}^{\left(-0.5\right)}} \cdot x\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
metadata-eval [=>]99.8 | \[ \left|\left({\pi}^{\color{blue}{-0.5}} \cdot x\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
Applied egg-rr99.8%
[Start]99.8 | \[ \left|\left({\pi}^{-0.5} \cdot x\right) \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
|---|---|
fma-udef [=>]99.8 | \[ \left|\left({\pi}^{-0.5} \cdot x\right) \cdot \left(\color{blue}{\left(0.6666666666666666 \cdot \left(x \cdot x\right) + 2\right)} + \left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 98.8% |
| Cost | 32960 |
| Alternative 2 | |
|---|---|
| Accuracy | 97.9% |
| Cost | 32448 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 26436 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 26180 |
| Alternative 5 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 26052 |
| Alternative 6 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 26052 |
| Alternative 7 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 26052 |
| Alternative 8 | |
|---|---|
| Accuracy | 92.7% |
| Cost | 19456 |
herbie shell --seed 2023136
(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)))))))