| Alternative 1 | |
|---|---|
| Error | 99.8% |
| Cost | 39616.00 |
\[\left|{\pi}^{-0.5} \cdot \left(x \cdot \left(\mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + \left(0.047619047619047616 \cdot {x}^{6} + {x}^{4} \cdot 0.2\right)\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
(fma
(pow x 4.0)
0.2
(+
(+ (* 0.047619047619047616 (pow x 6.0)) (* (* x x) 0.6666666666666666))
2.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 * fma(pow(x, 4.0), 0.2, (((0.047619047619047616 * pow(x, 6.0)) + ((x * x) * 0.6666666666666666)) + 2.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((pi ^ -0.5) * Float64(x * fma((x ^ 4.0), 0.2, Float64(Float64(Float64(0.047619047619047616 * (x ^ 6.0)) + Float64(Float64(x * x) * 0.6666666666666666)) + 2.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[Power[Pi, -0.5], $MachinePrecision] * N[(x * N[(N[Power[x, 4.0], $MachinePrecision] * 0.2 + N[(N[(N[(0.047619047619047616 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision] + 2.0), $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|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \left(0.047619047619047616 \cdot {x}^{6} + \left(x \cdot x\right) \cdot 0.6666666666666666\right) + 2\right)\right)\right|
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.8
Applied egg-rr99.8
Applied egg-rr99.8
Simplified99.8
[Start]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right) + {\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)\right|
\] |
|---|---|
distribute-lft-out [=>]99.8 | \[ \left|\color{blue}{{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right) + x \cdot \mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right)\right)}\right|
\] |
distribute-lft-in [<=]99.8 | \[ \left|{\pi}^{-0.5} \cdot \color{blue}{\left(x \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)}\right|
\] |
+-commutative [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \color{blue}{\left(\mathsf{fma}\left(0.2, {x}^{4}, 0.047619047619047616 \cdot {x}^{6}\right) + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}\right)\right|
\] |
fma-udef [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \left(\color{blue}{\left(0.2 \cdot {x}^{4} + 0.047619047619047616 \cdot {x}^{6}\right)} + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right|
\] |
associate-+l+ [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \color{blue}{\left(0.2 \cdot {x}^{4} + \left(0.047619047619047616 \cdot {x}^{6} + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)}\right)\right|
\] |
*-commutative [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \left(\color{blue}{{x}^{4} \cdot 0.2} + \left(0.047619047619047616 \cdot {x}^{6} + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)\right)\right)\right|
\] |
fma-def [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left({x}^{4}, 0.2, 0.047619047619047616 \cdot {x}^{6} + \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}\right)\right|
\] |
fma-def [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \color{blue}{\mathsf{fma}\left(0.047619047619047616, {x}^{6}, \mathsf{fma}\left(0.6666666666666666, x \cdot x, 2\right)\right)}\right)\right)\right|
\] |
fma-udef [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \mathsf{fma}\left(0.047619047619047616, {x}^{6}, \color{blue}{0.6666666666666666 \cdot \left(x \cdot x\right) + 2}\right)\right)\right)\right|
\] |
associate-*r* [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \mathsf{fma}\left(0.047619047619047616, {x}^{6}, \color{blue}{\left(0.6666666666666666 \cdot x\right) \cdot x} + 2\right)\right)\right)\right|
\] |
*-commutative [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \mathsf{fma}\left(0.047619047619047616, {x}^{6}, \color{blue}{x \cdot \left(0.6666666666666666 \cdot x\right)} + 2\right)\right)\right)\right|
\] |
fma-def [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \mathsf{fma}\left(0.047619047619047616, {x}^{6}, \color{blue}{\mathsf{fma}\left(x, 0.6666666666666666 \cdot x, 2\right)}\right)\right)\right)\right|
\] |
*-commutative [=>]99.8 | \[ \left|{\pi}^{-0.5} \cdot \left(x \cdot \mathsf{fma}\left({x}^{4}, 0.2, \mathsf{fma}\left(0.047619047619047616, {x}^{6}, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.6666666666666666}, 2\right)\right)\right)\right)\right|
\] |
Applied egg-rr99.8
Final simplification99.8
| Alternative 1 | |
|---|---|
| Error | 99.8% |
| Cost | 39616.00 |
| Alternative 2 | |
|---|---|
| Error | 98.9% |
| Cost | 32896.00 |
| Alternative 3 | |
|---|---|
| Error | 99.1% |
| Cost | 32772.00 |
| Alternative 4 | |
|---|---|
| Error | 98.9% |
| Cost | 26372.00 |
| Alternative 5 | |
|---|---|
| Error | 98.2% |
| Cost | 26308.00 |
| Alternative 6 | |
|---|---|
| Error | 98.2% |
| Cost | 26116.00 |
| Alternative 7 | |
|---|---|
| Error | 95.1% |
| Cost | 26052.00 |
| Alternative 8 | |
|---|---|
| Error | 98.2% |
| Cost | 26052.00 |
| Alternative 9 | |
|---|---|
| Error | 98.3% |
| Cost | 26052.00 |
| Alternative 10 | |
|---|---|
| Error | 98.3% |
| Cost | 26052.00 |
| Alternative 11 | |
|---|---|
| Error | 92.7% |
| Cost | 19840.00 |
| Alternative 12 | |
|---|---|
| Error | 92.9% |
| Cost | 19456.00 |
herbie shell --seed 2023093
(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)))))))