| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 26048 |
\[\cos x \cdot {\left({\left(e^{5}\right)}^{x}\right)}^{\left(x + x\right)}
\]
(FPCore (x) :precision binary64 (* (cos x) (exp (* 10.0 (* x x)))))
(FPCore (x) :precision binary64 (* (cos x) (pow (pow (exp 80.0) x) (* x 0.125))))
double code(double x) {
return cos(x) * exp((10.0 * (x * x)));
}
double code(double x) {
return cos(x) * pow(pow(exp(80.0), x), (x * 0.125));
}
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * exp((10.0d0 * (x * x)))
end function
real(8) function code(x)
real(8), intent (in) :: x
code = cos(x) * ((exp(80.0d0) ** x) ** (x * 0.125d0))
end function
public static double code(double x) {
return Math.cos(x) * Math.exp((10.0 * (x * x)));
}
public static double code(double x) {
return Math.cos(x) * Math.pow(Math.pow(Math.exp(80.0), x), (x * 0.125));
}
def code(x): return math.cos(x) * math.exp((10.0 * (x * x)))
def code(x): return math.cos(x) * math.pow(math.pow(math.exp(80.0), x), (x * 0.125))
function code(x) return Float64(cos(x) * exp(Float64(10.0 * Float64(x * x)))) end
function code(x) return Float64(cos(x) * ((exp(80.0) ^ x) ^ Float64(x * 0.125))) end
function tmp = code(x) tmp = cos(x) * exp((10.0 * (x * x))); end
function tmp = code(x) tmp = cos(x) * ((exp(80.0) ^ x) ^ (x * 0.125)); end
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Exp[N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[Power[N[Exp[80.0], $MachinePrecision], x], $MachinePrecision], N[(x * 0.125), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\cos x \cdot {\left({\left(e^{80}\right)}^{x}\right)}^{\left(x \cdot 0.125\right)}
Results
Initial program 94.4%
Simplified95.2%
[Start]94.4 | \[ \cos x \cdot e^{10 \cdot \left(x \cdot x\right)}
\] |
|---|---|
exp-prod [=>]95.2 | \[ \cos x \cdot \color{blue}{{\left(e^{10}\right)}^{\left(x \cdot x\right)}}
\] |
Applied egg-rr95.3%
Applied egg-rr99.4%
Applied egg-rr99.0%
Simplified99.2%
[Start]99.0 | \[ \cos x \cdot \left({\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x}{8}\right)} \cdot {\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x}{8}\right)}\right)
\] |
|---|---|
metadata-eval [<=]99.0 | \[ \cos x \cdot \left({\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x}{\color{blue}{\frac{2}{0.25}}}\right)} \cdot {\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x}{8}\right)}\right)
\] |
associate-/l* [<=]99.0 | \[ \cos x \cdot \left({\left({\left(e^{40}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 0.25}{2}\right)}} \cdot {\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x}{8}\right)}\right)
\] |
metadata-eval [<=]99.0 | \[ \cos x \cdot \left({\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x \cdot 0.25}{2}\right)} \cdot {\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x}{\color{blue}{\frac{2}{0.25}}}\right)}\right)
\] |
associate-/l* [<=]99.0 | \[ \cos x \cdot \left({\left({\left(e^{40}\right)}^{x}\right)}^{\left(\frac{x \cdot 0.25}{2}\right)} \cdot {\left({\left(e^{40}\right)}^{x}\right)}^{\color{blue}{\left(\frac{x \cdot 0.25}{2}\right)}}\right)
\] |
sqr-pow [<=]99.2 | \[ \cos x \cdot \color{blue}{{\left({\left(e^{40}\right)}^{x}\right)}^{\left(x \cdot 0.25\right)}}
\] |
Applied egg-rr0.0%
Simplified99.5%
[Start]0.0 | \[ e^{\mathsf{log1p}\left(\cos x \cdot {\left(e^{x \cdot 80}\right)}^{\left(x \cdot 0.125\right)}\right)} + -1
\] |
|---|---|
metadata-eval [<=]0.0 | \[ e^{\mathsf{log1p}\left(\cos x \cdot {\left(e^{x \cdot 80}\right)}^{\left(x \cdot 0.125\right)}\right)} + \color{blue}{\left(-1\right)}
\] |
sub-neg [<=]0.0 | \[ \color{blue}{e^{\mathsf{log1p}\left(\cos x \cdot {\left(e^{x \cdot 80}\right)}^{\left(x \cdot 0.125\right)}\right)} - 1}
\] |
expm1-def [=>]0.0 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos x \cdot {\left(e^{x \cdot 80}\right)}^{\left(x \cdot 0.125\right)}\right)\right)}
\] |
expm1-log1p [=>]95.0 | \[ \color{blue}{\cos x \cdot {\left(e^{x \cdot 80}\right)}^{\left(x \cdot 0.125\right)}}
\] |
sqr-pow [=>]95.0 | \[ \cos x \cdot \color{blue}{\left({\left(e^{x \cdot 80}\right)}^{\left(\frac{x \cdot 0.125}{2}\right)} \cdot {\left(e^{x \cdot 80}\right)}^{\left(\frac{x \cdot 0.125}{2}\right)}\right)}
\] |
sqr-pow [<=]95.0 | \[ \cos x \cdot \color{blue}{{\left(e^{x \cdot 80}\right)}^{\left(x \cdot 0.125\right)}}
\] |
*-commutative [=>]95.0 | \[ \cos x \cdot {\left(e^{\color{blue}{80 \cdot x}}\right)}^{\left(x \cdot 0.125\right)}
\] |
exp-prod [=>]99.5 | \[ \cos x \cdot {\color{blue}{\left({\left(e^{80}\right)}^{x}\right)}}^{\left(x \cdot 0.125\right)}
\] |
Final simplification99.5%
| Alternative 1 | |
|---|---|
| Accuracy | 98.3% |
| Cost | 26048 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 26048 |
| Alternative 3 | |
|---|---|
| Accuracy | 98.0% |
| Cost | 25920 |
| Alternative 4 | |
|---|---|
| Accuracy | 95.2% |
| Cost | 19584 |
| Alternative 5 | |
|---|---|
| Accuracy | 95.2% |
| Cost | 19584 |
| Alternative 6 | |
|---|---|
| Accuracy | 94.4% |
| Cost | 13248 |
| Alternative 7 | |
|---|---|
| Accuracy | 94.4% |
| Cost | 13248 |
| Alternative 8 | |
|---|---|
| Accuracy | 9.6% |
| Cost | 6464 |
| Alternative 9 | |
|---|---|
| Accuracy | 1.5% |
| Cost | 64 |
herbie shell --seed 2023141
(FPCore (x)
:name "ENA, Section 1.4, Exercise 1"
:precision binary64
:pre (and (<= 1.99 x) (<= x 2.01))
(* (cos x) (exp (* 10.0 (* x x)))))