| Alternative 1 | |
|---|---|
| Accuracy | 99.5% |
| Cost | 13632 |
\[\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot e^{t \cdot t}}
\]
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (pow (exp t) t)))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((z * 2.0) * pow(exp(t), t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * sqrt(((z * 2.0d0) * (exp(t) ** t)))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt(((z * 2.0) * Math.pow(Math.exp(t), t)));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((z * 2.0) * math.pow(math.exp(t), t)))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * (exp(t) ^ t)))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * (exp(t) ^ t))); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot {\left(e^{t}\right)}^{t}}
Results
| Original | 99.5% |
|---|---|
| Target | 99.5% |
| Herbie | 99.5% |
Initial program 99.5%
Simplified99.5%
[Start]99.5 | \[ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\] |
|---|---|
associate-*l* [=>]99.5 | \[ \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot e^{\frac{t \cdot t}{2}}\right)}
\] |
associate-*l/ [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot e^{\color{blue}{\frac{t}{2} \cdot t}}\right)
\] |
exp-prod [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot \color{blue}{{\left(e^{\frac{t}{2}}\right)}^{t}}\right)
\] |
exp-sqrt [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot {\color{blue}{\left(\sqrt{e^{t}}\right)}}^{t}\right)
\] |
Applied egg-rr99.5%
[Start]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)
\] |
|---|---|
add-sqr-sqrt [=>]99.0 | \[ \left(x \cdot 0.5 - y\right) \cdot \color{blue}{\left(\sqrt{\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}} \cdot \sqrt{\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}}\right)}
\] |
sqrt-unprod [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \color{blue}{\sqrt{\left(\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right) \cdot \left(\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}}
\] |
swap-sqr [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\color{blue}{\left(\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}\right) \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}}
\] |
add-sqr-sqrt [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\color{blue}{\left(z \cdot 2\right)} \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}
\] |
pow-prod-down [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot \color{blue}{{\left(\sqrt{e^{t}} \cdot \sqrt{e^{t}}\right)}^{t}}}
\] |
add-sqr-sqrt [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot {\color{blue}{\left(e^{t}\right)}}^{t}}
\] |
Final simplification99.5%
| Alternative 1 | |
|---|---|
| Accuracy | 99.5% |
| Cost | 13632 |
| Alternative 2 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 13568 |
| Alternative 3 | |
|---|---|
| Accuracy | 98.6% |
| Cost | 7360 |
| Alternative 4 | |
|---|---|
| Accuracy | 72.6% |
| Cost | 7113 |
| Alternative 5 | |
|---|---|
| Accuracy | 23.5% |
| Cost | 6980 |
| Alternative 6 | |
|---|---|
| Accuracy | 26.3% |
| Cost | 6980 |
| Alternative 7 | |
|---|---|
| Accuracy | 52.4% |
| Cost | 6980 |
| Alternative 8 | |
|---|---|
| Accuracy | 98.1% |
| Cost | 6976 |
| Alternative 9 | |
|---|---|
| Accuracy | 17.0% |
| Cost | 6848 |
| Alternative 10 | |
|---|---|
| Accuracy | 3.9% |
| Cost | 64 |
herbie shell --seed 2023137
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:herbie-target
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0)))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))