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

Percentage Accurate: 100.0% → 100.0%
Time: 10.0s
Alternatives: 7
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 7 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. Add Preprocessing

Alternative 2: 81.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \log y\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-302}:\\ \;\;\;\;e^{x - z}\\ \mathbf{elif}\;t\_0 \leq 3.25 \cdot 10^{+268}:\\ \;\;\;\;e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(-z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{z}{x \cdot \left(x \cdot x\right)}, -\frac{z}{x \cdot x}\right), \frac{z}{x}\right), \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (log y))))
   (if (<= t_0 -2e-302)
     (exp (- x z))
     (if (<= t_0 3.25e+268)
       (exp
        (fma (- z) (/ z (+ x z)) (fma z (fma z (/ (- 1.0 (/ z x)) x) -1.0) x)))
       (exp
        (fma
         (- z)
         (fma z (fma z (/ z (* x (* x x))) (- (/ z (* x x)))) (/ z x))
         (* (* x x) (/ 1.0 (+ x z)))))))))
double code(double x, double y, double z) {
	double t_0 = y * log(y);
	double tmp;
	if (t_0 <= -2e-302) {
		tmp = exp((x - z));
	} else if (t_0 <= 3.25e+268) {
		tmp = exp(fma(-z, (z / (x + z)), fma(z, fma(z, ((1.0 - (z / x)) / x), -1.0), x)));
	} else {
		tmp = exp(fma(-z, fma(z, fma(z, (z / (x * (x * x))), -(z / (x * x))), (z / x)), ((x * x) * (1.0 / (x + z)))));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(y * log(y))
	tmp = 0.0
	if (t_0 <= -2e-302)
		tmp = exp(Float64(x - z));
	elseif (t_0 <= 3.25e+268)
		tmp = exp(fma(Float64(-z), Float64(z / Float64(x + z)), fma(z, fma(z, Float64(Float64(1.0 - Float64(z / x)) / x), -1.0), x)));
	else
		tmp = exp(fma(Float64(-z), fma(z, fma(z, Float64(z / Float64(x * Float64(x * x))), Float64(-Float64(z / Float64(x * x)))), Float64(z / x)), Float64(Float64(x * x) * Float64(1.0 / Float64(x + z)))));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-302], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 3.25e+268], N[Exp[N[((-z) * N[(z / N[(x + z), $MachinePrecision]), $MachinePrecision] + N[(z * N[(z * N[(N[(1.0 - N[(z / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[((-z) * N[(z * N[(z * N[(z / N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-N[(z / N[(x * x), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] + N[(z / x), $MachinePrecision]), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(1.0 / N[(x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq 3.25 \cdot 10^{+268}:\\
\;\;\;\;e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(-z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{z}{x \cdot \left(x \cdot x\right)}, -\frac{z}{x \cdot x}\right), \frac{z}{x}\right), \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 y (log.f64 y)) < -1.9999999999999999e-302

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x - z}} \]
    4. Step-by-step derivation
      1. lower--.f6498.4

        \[\leadsto e^{\color{blue}{x - z}} \]
    5. Applied rewrites98.4%

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

    if -1.9999999999999999e-302 < (*.f64 y (log.f64 y)) < 3.25e268

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x - z}} \]
    4. Step-by-step derivation
      1. lower--.f6461.3

        \[\leadsto e^{\color{blue}{x - z}} \]
    5. Applied rewrites61.3%

      \[\leadsto e^{\color{blue}{x - z}} \]
    6. Step-by-step derivation
      1. Applied rewrites10.3%

        \[\leadsto e^{\mathsf{fma}\left(\frac{x \cdot x}{\mathsf{fma}\left(x, x \cdot x, \left(z \cdot z\right) \cdot z\right)}, \color{blue}{\mathsf{fma}\left(z, z - x, x \cdot x\right)}, -\frac{z \cdot z}{x + z}\right)} \]
      2. Step-by-step derivation
        1. Applied rewrites57.1%

          \[\leadsto e^{\mathsf{fma}\left(-z, \color{blue}{\frac{z}{x + z}}, \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)} \]
        2. Taylor expanded in z around 0

          \[\leadsto e^{\mathsf{fma}\left(\mathsf{neg}\left(z\right), \frac{z}{x + z}, x + z \cdot \left(z \cdot \left(-1 \cdot \frac{z}{{x}^{2}} + \frac{1}{x}\right) - 1\right)\right)} \]
        3. Applied rewrites65.4%

          \[\leadsto e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)} \]

        if 3.25e268 < (*.f64 y (log.f64 y))

        1. Initial program 100.0%

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

          \[\leadsto e^{\color{blue}{x - z}} \]
        4. Step-by-step derivation
          1. lower--.f6432.1

            \[\leadsto e^{\color{blue}{x - z}} \]
        5. Applied rewrites32.1%

          \[\leadsto e^{\color{blue}{x - z}} \]
        6. Step-by-step derivation
          1. Applied rewrites0.6%

            \[\leadsto e^{\mathsf{fma}\left(\frac{x \cdot x}{\mathsf{fma}\left(x, x \cdot x, \left(z \cdot z\right) \cdot z\right)}, \color{blue}{\mathsf{fma}\left(z, z - x, x \cdot x\right)}, -\frac{z \cdot z}{x + z}\right)} \]
          2. Step-by-step derivation
            1. Applied rewrites39.7%

              \[\leadsto e^{\mathsf{fma}\left(-z, \color{blue}{\frac{z}{x + z}}, \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)} \]
            2. Taylor expanded in z around 0

              \[\leadsto e^{\mathsf{fma}\left(\mathsf{neg}\left(z\right), z \cdot \color{blue}{\left(z \cdot \left(\frac{z}{{x}^{3}} - \frac{1}{{x}^{2}}\right) + \frac{1}{x}\right)}, \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)} \]
            3. Step-by-step derivation
              1. Applied rewrites84.6%

                \[\leadsto e^{\mathsf{fma}\left(-z, \mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, \frac{z}{x \cdot \left(x \cdot x\right)}, \frac{z}{x \cdot \left(-x\right)}\right)}, \frac{z}{x}\right), \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)} \]
            4. Recombined 3 regimes into one program.
            5. Final simplification82.8%

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \log y \leq -2 \cdot 10^{-302}:\\ \;\;\;\;e^{x - z}\\ \mathbf{elif}\;y \cdot \log y \leq 3.25 \cdot 10^{+268}:\\ \;\;\;\;e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(-z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{z}{x \cdot \left(x \cdot x\right)}, -\frac{z}{x \cdot x}\right), \frac{z}{x}\right), \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)}\\ \end{array} \]
            6. Add Preprocessing

            Alternative 3: 94.3% accurate, 0.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot \log y \leq 5 \cdot 10^{+29}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(y, \log y, x\right)}\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= (* y (log y)) 5e+29) (exp (- x z)) (exp (fma y (log y) x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((y * log(y)) <= 5e+29) {
            		tmp = exp((x - z));
            	} else {
            		tmp = exp(fma(y, log(y), x));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (Float64(y * log(y)) <= 5e+29)
            		tmp = exp(Float64(x - z));
            	else
            		tmp = exp(fma(y, log(y), x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision], 5e+29], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Exp[N[(y * N[Log[y], $MachinePrecision] + x), $MachinePrecision]], $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \cdot \log y \leq 5 \cdot 10^{+29}:\\
            \;\;\;\;e^{x - z}\\
            
            \mathbf{else}:\\
            \;\;\;\;e^{\mathsf{fma}\left(y, \log y, x\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 y (log.f64 y)) < 5.0000000000000001e29

              1. Initial program 100.0%

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

                \[\leadsto e^{\color{blue}{x - z}} \]
              4. Step-by-step derivation
                1. lower--.f6497.9

                  \[\leadsto e^{\color{blue}{x - z}} \]
              5. Applied rewrites97.9%

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

              if 5.0000000000000001e29 < (*.f64 y (log.f64 y))

              1. Initial program 100.0%

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

                \[\leadsto e^{\color{blue}{x + y \cdot \log y}} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto e^{\color{blue}{y \cdot \log y + x}} \]
                2. lower-fma.f64N/A

                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(y, \log y, x\right)}} \]
                3. lower-log.f6492.4

                  \[\leadsto e^{\mathsf{fma}\left(y, \color{blue}{\log y}, x\right)} \]
              5. Applied rewrites92.4%

                \[\leadsto e^{\color{blue}{\mathsf{fma}\left(y, \log y, x\right)}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 4: 90.3% accurate, 0.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \log y\\ \mathbf{if}\;t\_0 \leq 3.5 \cdot 10^{+119}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;e^{t\_0}\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* y (log y)))) (if (<= t_0 3.5e+119) (exp (- x z)) (exp t_0))))
            double code(double x, double y, double z) {
            	double t_0 = y * log(y);
            	double tmp;
            	if (t_0 <= 3.5e+119) {
            		tmp = exp((x - z));
            	} else {
            		tmp = exp(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
                real(8) :: t_0
                real(8) :: tmp
                t_0 = y * log(y)
                if (t_0 <= 3.5d+119) then
                    tmp = exp((x - z))
                else
                    tmp = exp(t_0)
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = y * Math.log(y);
            	double tmp;
            	if (t_0 <= 3.5e+119) {
            		tmp = Math.exp((x - z));
            	} else {
            		tmp = Math.exp(t_0);
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = y * math.log(y)
            	tmp = 0
            	if t_0 <= 3.5e+119:
            		tmp = math.exp((x - z))
            	else:
            		tmp = math.exp(t_0)
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(y * log(y))
            	tmp = 0.0
            	if (t_0 <= 3.5e+119)
            		tmp = exp(Float64(x - z));
            	else
            		tmp = exp(t_0);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = y * log(y);
            	tmp = 0.0;
            	if (t_0 <= 3.5e+119)
            		tmp = exp((x - z));
            	else
            		tmp = exp(t_0);
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 3.5e+119], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Exp[t$95$0], $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := y \cdot \log y\\
            \mathbf{if}\;t\_0 \leq 3.5 \cdot 10^{+119}:\\
            \;\;\;\;e^{x - z}\\
            
            \mathbf{else}:\\
            \;\;\;\;e^{t\_0}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 y (log.f64 y)) < 3.5000000000000001e119

              1. Initial program 100.0%

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

                \[\leadsto e^{\color{blue}{x - z}} \]
              4. Step-by-step derivation
                1. lower--.f6492.9

                  \[\leadsto e^{\color{blue}{x - z}} \]
              5. Applied rewrites92.9%

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

              if 3.5000000000000001e119 < (*.f64 y (log.f64 y))

              1. Initial program 100.0%

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

                \[\leadsto e^{\color{blue}{-1 \cdot \left(y \cdot \log \left(\frac{1}{y}\right)\right)}} \]
              4. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto e^{\color{blue}{\mathsf{neg}\left(y \cdot \log \left(\frac{1}{y}\right)\right)}} \]
                2. distribute-rgt-neg-inN/A

                  \[\leadsto e^{\color{blue}{y \cdot \left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)}} \]
                3. log-recN/A

                  \[\leadsto e^{y \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right)\right)} \]
                4. remove-double-negN/A

                  \[\leadsto e^{y \cdot \color{blue}{\log y}} \]
                5. lower-*.f64N/A

                  \[\leadsto e^{\color{blue}{y \cdot \log y}} \]
                6. lower-log.f6491.2

                  \[\leadsto e^{y \cdot \color{blue}{\log y}} \]
              5. Applied rewrites91.2%

                \[\leadsto e^{\color{blue}{y \cdot \log y}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 5: 81.3% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot \log y \leq -2 \cdot 10^{-302}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)}\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= (* y (log y)) -2e-302)
               (exp (- x z))
               (exp
                (fma (- z) (/ z (+ x z)) (fma z (fma z (/ (- 1.0 (/ z x)) x) -1.0) x)))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((y * log(y)) <= -2e-302) {
            		tmp = exp((x - z));
            	} else {
            		tmp = exp(fma(-z, (z / (x + z)), fma(z, fma(z, ((1.0 - (z / x)) / x), -1.0), x)));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (Float64(y * log(y)) <= -2e-302)
            		tmp = exp(Float64(x - z));
            	else
            		tmp = exp(fma(Float64(-z), Float64(z / Float64(x + z)), fma(z, fma(z, Float64(Float64(1.0 - Float64(z / x)) / x), -1.0), x)));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision], -2e-302], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Exp[N[((-z) * N[(z / N[(x + z), $MachinePrecision]), $MachinePrecision] + N[(z * N[(z * N[(N[(1.0 - N[(z / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \cdot \log y \leq -2 \cdot 10^{-302}:\\
            \;\;\;\;e^{x - z}\\
            
            \mathbf{else}:\\
            \;\;\;\;e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 y (log.f64 y)) < -1.9999999999999999e-302

              1. Initial program 100.0%

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

                \[\leadsto e^{\color{blue}{x - z}} \]
              4. Step-by-step derivation
                1. lower--.f6498.4

                  \[\leadsto e^{\color{blue}{x - z}} \]
              5. Applied rewrites98.4%

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

              if -1.9999999999999999e-302 < (*.f64 y (log.f64 y))

              1. Initial program 100.0%

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

                \[\leadsto e^{\color{blue}{x - z}} \]
              4. Step-by-step derivation
                1. lower--.f6458.4

                  \[\leadsto e^{\color{blue}{x - z}} \]
              5. Applied rewrites58.4%

                \[\leadsto e^{\color{blue}{x - z}} \]
              6. Step-by-step derivation
                1. Applied rewrites9.3%

                  \[\leadsto e^{\mathsf{fma}\left(\frac{x \cdot x}{\mathsf{fma}\left(x, x \cdot x, \left(z \cdot z\right) \cdot z\right)}, \color{blue}{\mathsf{fma}\left(z, z - x, x \cdot x\right)}, -\frac{z \cdot z}{x + z}\right)} \]
                2. Step-by-step derivation
                  1. Applied rewrites55.3%

                    \[\leadsto e^{\mathsf{fma}\left(-z, \color{blue}{\frac{z}{x + z}}, \left(x \cdot x\right) \cdot \frac{1}{x + z}\right)} \]
                  2. Taylor expanded in z around 0

                    \[\leadsto e^{\mathsf{fma}\left(\mathsf{neg}\left(z\right), \frac{z}{x + z}, x + z \cdot \left(z \cdot \left(-1 \cdot \frac{z}{{x}^{2}} + \frac{1}{x}\right) - 1\right)\right)} \]
                  3. Applied rewrites62.1%

                    \[\leadsto e^{\mathsf{fma}\left(-z, \frac{z}{x + z}, \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{1 - \frac{z}{x}}{x}, -1\right), x\right)\right)} \]
                3. Recombined 2 regimes into one program.
                4. Add Preprocessing

                Alternative 6: 79.0% accurate, 2.0× speedup?

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

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

                  \[\leadsto e^{\color{blue}{x - z}} \]
                4. Step-by-step derivation
                  1. lower--.f6478.3

                    \[\leadsto e^{\color{blue}{x - z}} \]
                5. Applied rewrites78.3%

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

                Alternative 7: 52.6% accurate, 2.1× speedup?

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

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

                  \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
                4. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto e^{\color{blue}{\mathsf{neg}\left(z\right)}} \]
                  2. lower-neg.f6450.0

                    \[\leadsto e^{\color{blue}{-z}} \]
                5. Applied rewrites50.0%

                  \[\leadsto e^{\color{blue}{-z}} \]
                6. Add Preprocessing

                Developer Target 1: 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 2024220 
                (FPCore (x y z)
                  :name "Statistics.Distribution.Poisson.Internal:probability from math-functions-0.1.5.2"
                  :precision binary64
                
                  :alt
                  (! :herbie-platform default (exp (+ (- x z) (* (log y) y))))
                
                  (exp (- (+ x (* y (log y))) z)))