Average Error: 0.0 → 0.0
Time: 4.8s
Precision: binary64
Cost: 13316
\[e^{\left(x + y \cdot \log y\right) - z} \]
\[\begin{array}{l} t_0 := e^{x - z}\\ \mathbf{if}\;y \leq 145:\\ \;\;\;\;{y}^{y} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(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 145.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 <= 145.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 <= 145.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 <= 145.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 <= 145.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 (y <= 145.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 <= 145.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[y, 145.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 \leq 145:\\
\;\;\;\;{y}^{y} \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[e^{\left(x - z\right) + \log y \cdot y} \]

Derivation

  1. Split input into 2 regimes
  2. if y < 145

    1. Initial program 0.0

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Simplified0.0

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
      Proof

      [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 145 < y

    1. Initial program 0

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Taylor expanded in y around 0 0

      \[\leadsto \color{blue}{e^{x - z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 145:\\ \;\;\;\;{y}^{y} \cdot e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;e^{x - z}\\ \end{array} \]

Alternatives

Alternative 1
Error0.0
Cost13248
\[e^{\left(x + y \cdot \log y\right) - z} \]
Alternative 2
Error1.3
Cost6660
\[\begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{-10}:\\ \;\;\;\;e^{x}\\ \mathbf{else}:\\ \;\;\;\;e^{-z}\\ \end{array} \]
Alternative 3
Error0.6
Cost6592
\[e^{x - z} \]
Alternative 4
Error18.5
Cost6464
\[e^{x} \]
Alternative 5
Error44.5
Cost192
\[x + 1 \]

Error

Reproduce

herbie shell --seed 2023016 
(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)))