| Alternative 1 | |
|---|---|
| Accuracy | 98.7% |
| Cost | 7488 |
\[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)
\]
(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 z) (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 + z) * 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 + z) * 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 + z) * 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 + z) * 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 + z) * exp(Float64(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 + z) * 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 + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $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 + z\right) \cdot e^{t \cdot 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-log-exp [=>]7.2 | \[ \left(x \cdot 0.5 - y\right) \cdot \color{blue}{\log \left(e^{\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}}\right)}
\] |
*-un-lft-identity [=>]7.2 | \[ \left(x \cdot 0.5 - y\right) \cdot \log \color{blue}{\left(1 \cdot e^{\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}}\right)}
\] |
log-prod [=>]7.2 | \[ \left(x \cdot 0.5 - y\right) \cdot \color{blue}{\left(\log 1 + \log \left(e^{\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}}\right)\right)}
\] |
metadata-eval [=>]7.2 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(\color{blue}{0} + \log \left(e^{\sqrt{z \cdot 2} \cdot {\left(\sqrt{e^{t}}\right)}^{t}}\right)\right)
\] |
add-log-exp [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \color{blue}{\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 \left(0 + \color{blue}{\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 \left(0 + \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)}}\right)
\] |
swap-sqr [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \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)}}\right)
\] |
add-sqr-sqrt [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\color{blue}{\left(z \cdot 2\right)} \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}\right)
\] |
add-log-exp [=>]5.0 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\color{blue}{\log \left(e^{z \cdot 2}\right)} \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}\right)
\] |
exp-lft-sqr [=>]5.0 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\log \color{blue}{\left(e^{z} \cdot e^{z}\right)} \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}\right)
\] |
log-prod [=>]5.0 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\color{blue}{\left(\log \left(e^{z}\right) + \log \left(e^{z}\right)\right)} \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}\right)
\] |
add-log-exp [<=]14.0 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\left(\color{blue}{z} + \log \left(e^{z}\right)\right) \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}\right)
\] |
add-log-exp [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\left(z + \color{blue}{z}\right) \cdot \left({\left(\sqrt{e^{t}}\right)}^{t} \cdot {\left(\sqrt{e^{t}}\right)}^{t}\right)}\right)
\] |
pow-prod-down [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\left(z + z\right) \cdot \color{blue}{{\left(\sqrt{e^{t}} \cdot \sqrt{e^{t}}\right)}^{t}}}\right)
\] |
add-sqr-sqrt [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\left(z + z\right) \cdot {\color{blue}{\left(e^{t}\right)}}^{t}}\right)
\] |
Simplified99.5%
[Start]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \left(0 + \sqrt{\left(z + z\right) \cdot {\left(e^{t}\right)}^{t}}\right)
\] |
|---|---|
+-lft-identity [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \color{blue}{\sqrt{\left(z + z\right) \cdot {\left(e^{t}\right)}^{t}}}
\] |
Taylor expanded in z around 0 99.5%
Simplified99.5%
[Start]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{{t}^{2}}\right)}
\] |
|---|---|
associate-*r* [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\color{blue}{\left(2 \cdot z\right) \cdot e^{{t}^{2}}}}
\] |
unpow2 [=>]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot e^{\color{blue}{t \cdot t}}}
\] |
count-2 [<=]99.5 | \[ \left(x \cdot 0.5 - y\right) \cdot \sqrt{\color{blue}{\left(z + z\right)} \cdot e^{t \cdot t}}
\] |
Final simplification99.5%
| Alternative 1 | |
|---|---|
| Accuracy | 98.7% |
| Cost | 7488 |
| Alternative 2 | |
|---|---|
| Accuracy | 98.7% |
| Cost | 7360 |
| Alternative 3 | |
|---|---|
| Accuracy | 18.8% |
| Cost | 7236 |
| Alternative 4 | |
|---|---|
| Accuracy | 33.5% |
| Cost | 7176 |
| Alternative 5 | |
|---|---|
| Accuracy | 23.3% |
| Cost | 7108 |
| Alternative 6 | |
|---|---|
| Accuracy | 98.2% |
| Cost | 6976 |
| Alternative 7 | |
|---|---|
| Accuracy | 7.4% |
| Cost | 448 |
| Alternative 8 | |
|---|---|
| Accuracy | 5.9% |
| Cost | 320 |
| Alternative 9 | |
|---|---|
| Accuracy | 6.0% |
| Cost | 192 |
herbie shell --seed 2023136
(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))))