| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13248 |
\[e^{\left(x + y \cdot \log y\right) - z}
\]
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
(FPCore (x y z) :precision binary64 (let* ((t_0 (exp (- x z)))) (if (<= (* y (log y)) 50.0) (* (pow y y) t_0) t_0)))
double code(double x, double y, double z) {
return exp(((x + (y * log(y))) - z));
}
double code(double x, double y, double z) {
double t_0 = exp((x - z));
double tmp;
if ((y * log(y)) <= 50.0) {
tmp = pow(y, y) * t_0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(((x + (y * log(y))) - z))
end function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x - z))
if ((y * log(y)) <= 50.0d0) then
tmp = (y ** y) * t_0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return Math.exp(((x + (y * Math.log(y))) - z));
}
public static double code(double x, double y, double z) {
double t_0 = Math.exp((x - z));
double tmp;
if ((y * Math.log(y)) <= 50.0) {
tmp = Math.pow(y, y) * t_0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): return math.exp(((x + (y * math.log(y))) - z))
def code(x, y, z): t_0 = math.exp((x - z)) tmp = 0 if (y * math.log(y)) <= 50.0: tmp = math.pow(y, y) * t_0 else: tmp = t_0 return tmp
function code(x, y, z) return exp(Float64(Float64(x + Float64(y * log(y))) - z)) end
function code(x, y, z) t_0 = exp(Float64(x - z)) tmp = 0.0 if (Float64(y * log(y)) <= 50.0) tmp = Float64((y ^ y) * t_0); else tmp = t_0; end return tmp end
function tmp = code(x, y, z) tmp = exp(((x + (y * log(y))) - z)); end
function tmp_2 = code(x, y, z) t_0 = exp((x - z)); tmp = 0.0; if ((y * log(y)) <= 50.0) tmp = (y ^ y) * t_0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision], 50.0], N[(N[Power[y, y], $MachinePrecision] * t$95$0), $MachinePrecision], t$95$0]]
e^{\left(x + y \cdot \log y\right) - z}
\begin{array}{l}
t_0 := e^{x - z}\\
\mathbf{if}\;y \cdot \log y \leq 50:\\
\;\;\;\;{y}^{y} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
if (*.f64 y (log.f64 y)) < 50Initial program 0.0
Simplified0.0
[Start]0.0 | \[ e^{\left(x + y \cdot \log y\right) - z}
\] |
|---|---|
+-commutative [=>]0.0 | \[ e^{\color{blue}{\left(y \cdot \log y + x\right)} - z}
\] |
associate--l+ [=>]0.0 | \[ e^{\color{blue}{y \cdot \log y + \left(x - z\right)}}
\] |
exp-sum [=>]0.0 | \[ \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}}
\] |
*-commutative [=>]0.0 | \[ e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z}
\] |
exp-to-pow [=>]0.0 | \[ \color{blue}{{y}^{y}} \cdot e^{x - z}
\] |
if 50 < (*.f64 y (log.f64 y)) Initial program 0.0
Taylor expanded in y around 0 0.2
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13248 |
| Alternative 2 | |
|---|---|
| Error | 1.1 |
| Cost | 6660 |
| Alternative 3 | |
|---|---|
| Error | 0.6 |
| Cost | 6592 |
| Alternative 4 | |
|---|---|
| Error | 18.9 |
| Cost | 6464 |
herbie shell --seed 2023018
(FPCore (x y z)
:name "Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(exp (+ (- x z) (* (log y) y)))
(exp (- (+ x (* y (log y))) z)))