| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 20032 |
\[\left(\sqrt{e^{t \cdot t}} \cdot \sqrt{z \cdot 2}\right) \cdot \left(x \cdot 0.5 - y\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 (* (* (sqrt (exp (* t t))) (sqrt (* z 2.0))) (- (* x 0.5) y)))
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 (sqrt(exp((t * t))) * sqrt((z * 2.0))) * ((x * 0.5) - y);
}
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 = (sqrt(exp((t * t))) * sqrt((z * 2.0d0))) * ((x * 0.5d0) - y)
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 (Math.sqrt(Math.exp((t * t))) * Math.sqrt((z * 2.0))) * ((x * 0.5) - y);
}
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 (math.sqrt(math.exp((t * t))) * math.sqrt((z * 2.0))) * ((x * 0.5) - y)
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(sqrt(exp(Float64(t * t))) * sqrt(Float64(z * 2.0))) * Float64(Float64(x * 0.5) - y)) 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 = (sqrt(exp((t * t))) * sqrt((z * 2.0))) * ((x * 0.5) - y); 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[Sqrt[N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\left(\sqrt{e^{t \cdot t}} \cdot \sqrt{z \cdot 2}\right) \cdot \left(x \cdot 0.5 - y\right)
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Results
| Original | 99.4% |
|---|---|
| Target | 99.4% |
| Herbie | 99.8% |
Initial program 98.7%
Simplified99.8%
[Start]98.7% | \[ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\] |
|---|---|
associate-*l* [=>]99.8% | \[ \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot e^{\frac{t \cdot t}{2}}\right)}
\] |
exp-sqrt [=>]99.8% | \[ \left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot \color{blue}{\sqrt{e^{t \cdot t}}}\right)
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 20032 |
| Alternative 2 | |
|---|---|
| Accuracy | 92.4% |
| Cost | 14024 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 13632 |
| Alternative 4 | |
|---|---|
| Accuracy | 79.3% |
| Cost | 7360 |
| Alternative 5 | |
|---|---|
| Accuracy | 83.5% |
| Cost | 7360 |
| Alternative 6 | |
|---|---|
| Accuracy | 31.3% |
| Cost | 6980 |
| Alternative 7 | |
|---|---|
| Accuracy | 55.7% |
| Cost | 6976 |
| Alternative 8 | |
|---|---|
| Accuracy | 16.4% |
| Cost | 6848 |
herbie shell --seed 2023272
(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))))