Average Error: 0.0 → 0.0
Time: 3.9s
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
      (*.f64 (pow.f64 y y) (exp.f64 (-.f64 x z))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= exp-to-pow_binary64 (exp.f64 (*.f64 (log.f64 y) y))) (exp.f64 (-.f64 x z))): 2 points increase in error, 0 points decrease in error
      (*.f64 (exp.f64 (Rewrite<= *-commutative_binary64 (*.f64 y (log.f64 y)))) (exp.f64 (-.f64 x z))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= exp-sum_binary64 (exp.f64 (+.f64 (*.f64 y (log.f64 y)) (-.f64 x z)))): 0 points increase in error, 50 points decrease in error
      (exp.f64 (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (*.f64 y (log.f64 y)) x) z))): 0 points increase in error, 0 points decrease in error
      (exp.f64 (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 x (*.f64 y (log.f64 y)))) z)): 0 points increase in error, 0 points decrease in error

    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.4
Cost6660
\[\begin{array}{l} \mathbf{if}\;z \leq 1.08 \cdot 10^{-10}:\\ \;\;\;\;e^{x}\\ \mathbf{else}:\\ \;\;\;\;e^{-z}\\ \end{array} \]
Alternative 3
Error0.6
Cost6592
\[e^{x - z} \]
Alternative 4
Error19.3
Cost6464
\[e^{x} \]
Alternative 5
Error44.8
Cost192
\[x + 1 \]

Error

Reproduce

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