Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2

Percentage Accurate: 100.0% → 100.0%
Time: 4.4s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ e^{\left(x + y \cdot \log y\right) - z} \end{array} \]
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
double code(double x, double y, double z) {
	return exp(((x + (y * log(y))) - z));
}
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
public static double code(double x, double y, double z) {
	return Math.exp(((x + (y * Math.log(y))) - z));
}
def code(x, y, z):
	return math.exp(((x + (y * math.log(y))) - z))
function code(x, y, z)
	return exp(Float64(Float64(x + Float64(y * log(y))) - z))
end
function tmp = code(x, y, z)
	tmp = exp(((x + (y * log(y))) - z));
end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\left(x + y \cdot \log y\right) - z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\left(x + y \cdot \log y\right) - z} \end{array} \]
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
double code(double x, double y, double z) {
	return exp(((x + (y * log(y))) - z));
}
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
public static double code(double x, double y, double z) {
	return Math.exp(((x + (y * Math.log(y))) - z));
}
def code(x, y, z):
	return math.exp(((x + (y * math.log(y))) - z))
function code(x, y, z)
	return exp(Float64(Float64(x + Float64(y * log(y))) - z))
end
function tmp = code(x, y, z)
	tmp = exp(((x + (y * log(y))) - z));
end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\left(x + y \cdot \log y\right) - z}
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\left(x + y \cdot \log y\right) - z} \end{array} \]
(FPCore (x y z) :precision binary64 (exp (- (+ x (* y (log y))) z)))
double code(double x, double y, double z) {
	return exp(((x + (y * log(y))) - z));
}
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
public static double code(double x, double y, double z) {
	return Math.exp(((x + (y * Math.log(y))) - z));
}
def code(x, y, z):
	return math.exp(((x + (y * math.log(y))) - z))
function code(x, y, z)
	return exp(Float64(Float64(x + Float64(y * log(y))) - z))
end
function tmp = code(x, y, z)
	tmp = exp(((x + (y * log(y))) - z));
end
code[x_, y_, z_] := N[Exp[N[(N[(x + N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\left(x + y \cdot \log y\right) - z}
\end{array}
Derivation
  1. Initial program 100.0%

    \[e^{\left(x + y \cdot \log y\right) - z} \]
  2. Add Preprocessing
  3. Final simplification100.0%

    \[\leadsto e^{\left(x + y \cdot \log y\right) - z} \]
  4. Add Preprocessing

Alternative 2: 90.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{x - z}\\ \mathbf{if}\;y \leq 2100000000:\\ \;\;\;\;{y}^{y} \cdot t\_0\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+62} \lor \neg \left(y \leq 2.5 \cdot 10^{+90}\right) \land y \leq 6.5 \cdot 10^{+102}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (exp (- x z))))
   (if (<= y 2100000000.0)
     (* (pow y y) t_0)
     (if (or (<= y 7.5e+62) (and (not (<= y 2.5e+90)) (<= y 6.5e+102)))
       t_0
       (pow y y)))))
double code(double x, double y, double z) {
	double t_0 = exp((x - z));
	double tmp;
	if (y <= 2100000000.0) {
		tmp = pow(y, y) * t_0;
	} else if ((y <= 7.5e+62) || (!(y <= 2.5e+90) && (y <= 6.5e+102))) {
		tmp = t_0;
	} else {
		tmp = pow(y, y);
	}
	return tmp;
}
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 <= 2100000000.0d0) then
        tmp = (y ** y) * t_0
    else if ((y <= 7.5d+62) .or. (.not. (y <= 2.5d+90)) .and. (y <= 6.5d+102)) then
        tmp = t_0
    else
        tmp = y ** y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = Math.exp((x - z));
	double tmp;
	if (y <= 2100000000.0) {
		tmp = Math.pow(y, y) * t_0;
	} else if ((y <= 7.5e+62) || (!(y <= 2.5e+90) && (y <= 6.5e+102))) {
		tmp = t_0;
	} else {
		tmp = Math.pow(y, y);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.exp((x - z))
	tmp = 0
	if y <= 2100000000.0:
		tmp = math.pow(y, y) * t_0
	elif (y <= 7.5e+62) or (not (y <= 2.5e+90) and (y <= 6.5e+102)):
		tmp = t_0
	else:
		tmp = math.pow(y, y)
	return tmp
function code(x, y, z)
	t_0 = exp(Float64(x - z))
	tmp = 0.0
	if (y <= 2100000000.0)
		tmp = Float64((y ^ y) * t_0);
	elseif ((y <= 7.5e+62) || (!(y <= 2.5e+90) && (y <= 6.5e+102)))
		tmp = t_0;
	else
		tmp = y ^ y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = exp((x - z));
	tmp = 0.0;
	if (y <= 2100000000.0)
		tmp = (y ^ y) * t_0;
	elseif ((y <= 7.5e+62) || (~((y <= 2.5e+90)) && (y <= 6.5e+102)))
		tmp = t_0;
	else
		tmp = y ^ y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2100000000.0], N[(N[Power[y, y], $MachinePrecision] * t$95$0), $MachinePrecision], If[Or[LessEqual[y, 7.5e+62], And[N[Not[LessEqual[y, 2.5e+90]], $MachinePrecision], LessEqual[y, 6.5e+102]]], t$95$0, N[Power[y, y], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{x - z}\\
\mathbf{if}\;y \leq 2100000000:\\
\;\;\;\;{y}^{y} \cdot t\_0\\

\mathbf{elif}\;y \leq 7.5 \cdot 10^{+62} \lor \neg \left(y \leq 2.5 \cdot 10^{+90}\right) \land y \leq 6.5 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;{y}^{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.1e9

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
      2. associate--l+100.0%

        \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
      3. exp-sum99.2%

        \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
      4. *-commutative99.2%

        \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
      5. exp-to-pow99.2%

        \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
    4. Add Preprocessing

    if 2.1e9 < y < 7.49999999999999998e62 or 2.5000000000000002e90 < y < 6.5000000000000004e102

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 75.7%

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

    if 7.49999999999999998e62 < y < 2.5000000000000002e90 or 6.5000000000000004e102 < y

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
      2. associate--l+100.0%

        \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
      3. exp-sum60.2%

        \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
      4. *-commutative60.2%

        \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
      5. exp-to-pow60.2%

        \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
    3. Simplified60.2%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 67.7%

      \[\leadsto \color{blue}{e^{x} \cdot {y}^{y}} \]
    6. Step-by-step derivation
      1. *-commutative67.7%

        \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    7. Simplified67.7%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    8. Taylor expanded in x around 0 89.1%

      \[\leadsto \color{blue}{{y}^{y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2100000000:\\ \;\;\;\;{y}^{y} \cdot e^{x - z}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{+62} \lor \neg \left(y \leq 2.5 \cdot 10^{+90}\right) \land y \leq 6.5 \cdot 10^{+102}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 90.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{+63}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \end{array} \]
(FPCore (x y z) :precision binary64 (if (<= y 8e+63) (exp (- x z)) (pow y y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 8e+63) {
		tmp = exp((x - z));
	} else {
		tmp = pow(y, y);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 8d+63) then
        tmp = exp((x - z))
    else
        tmp = y ** y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 8e+63) {
		tmp = Math.exp((x - z));
	} else {
		tmp = Math.pow(y, y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 8e+63:
		tmp = math.exp((x - z))
	else:
		tmp = math.pow(y, y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 8e+63)
		tmp = exp(Float64(x - z));
	else
		tmp = y ^ y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 8e+63)
		tmp = exp((x - z));
	else
		tmp = y ^ y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 8e+63], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+63}:\\
\;\;\;\;e^{x - z}\\

\mathbf{else}:\\
\;\;\;\;{y}^{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.00000000000000046e63

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 93.5%

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

    if 8.00000000000000046e63 < y

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
      2. associate--l+100.0%

        \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
      3. exp-sum59.5%

        \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
      4. *-commutative59.5%

        \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
      5. exp-to-pow59.5%

        \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
    3. Simplified59.5%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 67.3%

      \[\leadsto \color{blue}{e^{x} \cdot {y}^{y}} \]
    6. Step-by-step derivation
      1. *-commutative67.3%

        \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    7. Simplified67.3%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    8. Taylor expanded in x around 0 87.3%

      \[\leadsto \color{blue}{{y}^{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{+63}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 22000:\\ \;\;\;\;e^{x}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \end{array} \]
(FPCore (x y z) :precision binary64 (if (<= y 22000.0) (exp x) (pow y y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 22000.0) {
		tmp = exp(x);
	} else {
		tmp = pow(y, y);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 22000.0d0) then
        tmp = exp(x)
    else
        tmp = y ** y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 22000.0) {
		tmp = Math.exp(x);
	} else {
		tmp = Math.pow(y, y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 22000.0:
		tmp = math.exp(x)
	else:
		tmp = math.pow(y, y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 22000.0)
		tmp = exp(x);
	else
		tmp = y ^ y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 22000.0)
		tmp = exp(x);
	else
		tmp = y ^ y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 22000.0], N[Exp[x], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 22000:\\
\;\;\;\;e^{x}\\

\mathbf{else}:\\
\;\;\;\;{y}^{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 22000

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
      2. associate--l+100.0%

        \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
      3. exp-sum99.2%

        \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
      4. *-commutative99.2%

        \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
      5. exp-to-pow99.2%

        \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 69.8%

      \[\leadsto \color{blue}{e^{x} \cdot {y}^{y}} \]
    6. Step-by-step derivation
      1. *-commutative69.8%

        \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    7. Simplified69.8%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    8. Taylor expanded in y around 0 69.0%

      \[\leadsto \color{blue}{e^{x}} \]

    if 22000 < y

    1. Initial program 100.0%

      \[e^{\left(x + y \cdot \log y\right) - z} \]
    2. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
      2. associate--l+100.0%

        \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
      3. exp-sum59.6%

        \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
      4. *-commutative59.6%

        \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
      5. exp-to-pow59.6%

        \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
    3. Simplified59.6%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 66.3%

      \[\leadsto \color{blue}{e^{x} \cdot {y}^{y}} \]
    6. Step-by-step derivation
      1. *-commutative66.3%

        \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    7. Simplified66.3%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
    8. Taylor expanded in x around 0 83.4%

      \[\leadsto \color{blue}{{y}^{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 22000:\\ \;\;\;\;e^{x}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 52.7% accurate, 2.0× speedup?

\[\begin{array}{l} \\ e^{x} \end{array} \]
(FPCore (x y z) :precision binary64 (exp x))
double code(double x, double y, double z) {
	return exp(x);
}
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)
end function
public static double code(double x, double y, double z) {
	return Math.exp(x);
}
def code(x, y, z):
	return math.exp(x)
function code(x, y, z)
	return exp(x)
end
function tmp = code(x, y, z)
	tmp = exp(x);
end
code[x_, y_, z_] := N[Exp[x], $MachinePrecision]
\begin{array}{l}

\\
e^{x}
\end{array}
Derivation
  1. Initial program 100.0%

    \[e^{\left(x + y \cdot \log y\right) - z} \]
  2. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
    2. associate--l+100.0%

      \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
    3. exp-sum78.1%

      \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
    4. *-commutative78.1%

      \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
    5. exp-to-pow78.1%

      \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
  3. Simplified78.1%

    \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
  4. Add Preprocessing
  5. Taylor expanded in z around 0 67.9%

    \[\leadsto \color{blue}{e^{x} \cdot {y}^{y}} \]
  6. Step-by-step derivation
    1. *-commutative67.9%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
  7. Simplified67.9%

    \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
  8. Taylor expanded in y around 0 47.1%

    \[\leadsto \color{blue}{e^{x}} \]
  9. Final simplification47.1%

    \[\leadsto e^{x} \]
  10. Add Preprocessing

Alternative 6: 14.6% accurate, 69.0× speedup?

\[\begin{array}{l} \\ x + 1 \end{array} \]
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
	return x + 1.0;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
	return x + 1.0;
}
def code(x, y, z):
	return x + 1.0
function code(x, y, z)
	return Float64(x + 1.0)
end
function tmp = code(x, y, z)
	tmp = x + 1.0;
end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}

\\
x + 1
\end{array}
Derivation
  1. Initial program 100.0%

    \[e^{\left(x + y \cdot \log y\right) - z} \]
  2. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto e^{\color{blue}{\left(y \cdot \log y + x\right)} - z} \]
    2. associate--l+100.0%

      \[\leadsto e^{\color{blue}{y \cdot \log y + \left(x - z\right)}} \]
    3. exp-sum78.1%

      \[\leadsto \color{blue}{e^{y \cdot \log y} \cdot e^{x - z}} \]
    4. *-commutative78.1%

      \[\leadsto e^{\color{blue}{\log y \cdot y}} \cdot e^{x - z} \]
    5. exp-to-pow78.1%

      \[\leadsto \color{blue}{{y}^{y}} \cdot e^{x - z} \]
  3. Simplified78.1%

    \[\leadsto \color{blue}{{y}^{y} \cdot e^{x - z}} \]
  4. Add Preprocessing
  5. Taylor expanded in z around 0 67.9%

    \[\leadsto \color{blue}{e^{x} \cdot {y}^{y}} \]
  6. Step-by-step derivation
    1. *-commutative67.9%

      \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
  7. Simplified67.9%

    \[\leadsto \color{blue}{{y}^{y} \cdot e^{x}} \]
  8. Taylor expanded in x around 0 35.8%

    \[\leadsto \color{blue}{x \cdot {y}^{y} + {y}^{y}} \]
  9. Step-by-step derivation
    1. distribute-lft1-in46.8%

      \[\leadsto \color{blue}{\left(x + 1\right) \cdot {y}^{y}} \]
    2. *-commutative46.8%

      \[\leadsto \color{blue}{{y}^{y} \cdot \left(x + 1\right)} \]
  10. Simplified46.8%

    \[\leadsto \color{blue}{{y}^{y} \cdot \left(x + 1\right)} \]
  11. Taylor expanded in y around 0 12.6%

    \[\leadsto \color{blue}{1 + x} \]
  12. Final simplification12.6%

    \[\leadsto x + 1 \]
  13. Add Preprocessing

Developer target: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\left(x - z\right) + \log y \cdot y} \end{array} \]
(FPCore (x y z) :precision binary64 (exp (+ (- x z) (* (log y) y))))
double code(double x, double y, double z) {
	return exp(((x - z) + (log(y) * y)));
}
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 - z) + (log(y) * y)))
end function
public static double code(double x, double y, double z) {
	return Math.exp(((x - z) + (Math.log(y) * y)));
}
def code(x, y, z):
	return math.exp(((x - z) + (math.log(y) * y)))
function code(x, y, z)
	return exp(Float64(Float64(x - z) + Float64(log(y) * y)))
end
function tmp = code(x, y, z)
	tmp = exp(((x - z) + (log(y) * y)));
end
code[x_, y_, z_] := N[Exp[N[(N[(x - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\left(x - z\right) + \log y \cdot y}
\end{array}

Reproduce

?
herbie shell --seed 2024115 
(FPCore (x y z)
  :name "Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (exp (+ (- x z) (* (log y) y)))

  (exp (- (+ x (* y (log y))) z)))