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

Percentage Accurate: 100.0% → 100.0%
Time: 8.5s
Alternatives: 15
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 15 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: 93.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{+142} \lor \neg \left(x \leq 1.15 \cdot 10^{-6}\right):\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;e^{y \cdot \log y - z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.3e+142) (not (<= x 1.15e-6)))
   (exp (- x z))
   (exp (- (* y (log y)) z))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.3e+142) || !(x <= 1.15e-6)) {
		tmp = exp((x - z));
	} else {
		tmp = exp(((y * log(y)) - z));
	}
	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 ((x <= (-1.3d+142)) .or. (.not. (x <= 1.15d-6))) then
        tmp = exp((x - z))
    else
        tmp = exp(((y * log(y)) - z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.3e+142) || !(x <= 1.15e-6)) {
		tmp = Math.exp((x - z));
	} else {
		tmp = Math.exp(((y * Math.log(y)) - z));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.3e+142) or not (x <= 1.15e-6):
		tmp = math.exp((x - z))
	else:
		tmp = math.exp(((y * math.log(y)) - z))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.3e+142) || !(x <= 1.15e-6))
		tmp = exp(Float64(x - z));
	else
		tmp = exp(Float64(Float64(y * log(y)) - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.3e+142) || ~((x <= 1.15e-6)))
		tmp = exp((x - z));
	else
		tmp = exp(((y * log(y)) - z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.3e+142], N[Not[LessEqual[x, 1.15e-6]], $MachinePrecision]], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+142} \lor \neg \left(x \leq 1.15 \cdot 10^{-6}\right):\\
\;\;\;\;e^{x - z}\\

\mathbf{else}:\\
\;\;\;\;e^{y \cdot \log y - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.30000000000000011e142 or 1.15e-6 < x

    1. Initial program 100.0%

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

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

    if -1.30000000000000011e142 < x < 1.15e-6

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{e^{y \cdot \log y - z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{+142} \lor \neg \left(x \leq 1.15 \cdot 10^{-6}\right):\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;e^{y \cdot \log y - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{+65} \lor \neg \left(x \leq 3.7 \cdot 10^{+22}\right):\\ \;\;\;\;e^{x}\\ \mathbf{else}:\\ \;\;\;\;e^{-z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -3.4e+65) (not (<= x 3.7e+22))) (exp x) (exp (- z))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -3.4e+65) || !(x <= 3.7e+22)) {
		tmp = exp(x);
	} else {
		tmp = exp(-z);
	}
	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 ((x <= (-3.4d+65)) .or. (.not. (x <= 3.7d+22))) then
        tmp = exp(x)
    else
        tmp = exp(-z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -3.4e+65) || !(x <= 3.7e+22)) {
		tmp = Math.exp(x);
	} else {
		tmp = Math.exp(-z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -3.4e+65) or not (x <= 3.7e+22):
		tmp = math.exp(x)
	else:
		tmp = math.exp(-z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -3.4e+65) || !(x <= 3.7e+22))
		tmp = exp(x);
	else
		tmp = exp(Float64(-z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -3.4e+65) || ~((x <= 3.7e+22)))
		tmp = exp(x);
	else
		tmp = exp(-z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.4e+65], N[Not[LessEqual[x, 3.7e+22]], $MachinePrecision]], N[Exp[x], $MachinePrecision], N[Exp[(-z)], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+65} \lor \neg \left(x \leq 3.7 \cdot 10^{+22}\right):\\
\;\;\;\;e^{x}\\

\mathbf{else}:\\
\;\;\;\;e^{-z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.3999999999999999e65 or 3.6999999999999998e22 < x

    1. Initial program 100.0%

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

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

    if -3.3999999999999999e65 < x < 3.6999999999999998e22

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-168.7%

        \[\leadsto e^{\color{blue}{-z}} \]
    5. Simplified68.7%

      \[\leadsto e^{\color{blue}{-z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{+65} \lor \neg \left(x \leq 3.7 \cdot 10^{+22}\right):\\ \;\;\;\;e^{x}\\ \mathbf{else}:\\ \;\;\;\;e^{-z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 89.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.65 \cdot 10^{+99}:\\ \;\;\;\;e^{x - z}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 3.65e+99) (exp (- x z)) (pow y y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 3.65e+99) {
		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 <= 3.65d+99) 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 <= 3.65e+99) {
		tmp = Math.exp((x - z));
	} else {
		tmp = Math.pow(y, y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 3.65e+99:
		tmp = math.exp((x - z))
	else:
		tmp = math.pow(y, y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 3.65e+99)
		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 <= 3.65e+99)
		tmp = exp((x - z));
	else
		tmp = y ^ y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 3.65e+99], N[Exp[N[(x - z), $MachinePrecision]], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 100.0%

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

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

    if 3.6499999999999999e99 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{e^{y \cdot \log y - z}} \]
    4. Taylor expanded in z around 0 89.3%

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

Alternative 5: 74.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 0.00084:\\ \;\;\;\;e^{-z}\\ \mathbf{else}:\\ \;\;\;\;{y}^{y}\\ \end{array} \end{array} \]
(FPCore (x y z) :precision binary64 (if (<= y 0.00084) (exp (- z)) (pow y y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 0.00084) {
		tmp = exp(-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 <= 0.00084d0) then
        tmp = exp(-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 <= 0.00084) {
		tmp = Math.exp(-z);
	} else {
		tmp = Math.pow(y, y);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 0.00084:
		tmp = math.exp(-z)
	else:
		tmp = math.pow(y, y)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 0.00084)
		tmp = exp(Float64(-z));
	else
		tmp = y ^ y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 0.00084)
		tmp = exp(-z);
	else
		tmp = y ^ y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 0.00084], N[Exp[(-z)], $MachinePrecision], N[Power[y, y], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00084:\\
\;\;\;\;e^{-z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.4000000000000003e-4

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-175.1%

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

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

    if 8.4000000000000003e-4 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{e^{y \cdot \log y - z}} \]
    4. Taylor expanded in z around 0 80.6%

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

Alternative 6: 62.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+107}:\\ \;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;e^{x}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -5.4e+107)
   (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0)))
   (exp x)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.4e+107) {
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	} else {
		tmp = exp(x);
	}
	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 (z <= (-5.4d+107)) then
        tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
    else
        tmp = exp(x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.4e+107) {
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	} else {
		tmp = Math.exp(x);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -5.4e+107:
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0))
	else:
		tmp = math.exp(x)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -5.4e+107)
		tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0)));
	else
		tmp = exp(x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -5.4e+107)
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	else
		tmp = exp(x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -5.4e+107], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[x], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+107}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\

\mathbf{else}:\\
\;\;\;\;e^{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.4000000000000003e107

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-192.3%

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

      \[\leadsto e^{\color{blue}{-z}} \]
    6. Taylor expanded in z around 0 92.3%

      \[\leadsto \color{blue}{1 + z \cdot \left(z \cdot \left(0.5 + -0.16666666666666666 \cdot z\right) - 1\right)} \]
    7. Taylor expanded in z around inf 92.3%

      \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(-0.16666666666666666 \cdot z\right)} - 1\right) \]
    8. Step-by-step derivation
      1. *-commutative92.3%

        \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(z \cdot -0.16666666666666666\right)} - 1\right) \]
    9. Simplified92.3%

      \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(z \cdot -0.16666666666666666\right)} - 1\right) \]

    if -5.4000000000000003e107 < z

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+107}:\\ \;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;e^{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 41.3% accurate, 11.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -4.3e+65)
   (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0)))
   (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.3e+65) {
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
	}
	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 (z <= (-4.3d+65)) then
        tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
    else
        tmp = 1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0)))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.3e+65) {
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -4.3e+65:
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0))
	else:
		tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -4.3e+65)
		tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0)));
	else
		tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -4.3e+65)
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	else
		tmp = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -4.3e+65], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+65}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\

\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.30000000000000046e65

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-187.3%

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

      \[\leadsto e^{\color{blue}{-z}} \]
    6. Taylor expanded in z around 0 76.9%

      \[\leadsto \color{blue}{1 + z \cdot \left(z \cdot \left(0.5 + -0.16666666666666666 \cdot z\right) - 1\right)} \]
    7. Taylor expanded in z around inf 76.9%

      \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(-0.16666666666666666 \cdot z\right)} - 1\right) \]
    8. Step-by-step derivation
      1. *-commutative76.9%

        \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(z \cdot -0.16666666666666666\right)} - 1\right) \]
    9. Simplified76.9%

      \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(z \cdot -0.16666666666666666\right)} - 1\right) \]

    if -4.30000000000000046e65 < z

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x}} \]
    4. Taylor expanded in x around 0 32.5%

      \[\leadsto \color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 41.3% accurate, 12.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -3.1e+65)
   (+ 1.0 (* z (+ (* z (* z -0.16666666666666666)) -1.0)))
   (+ 1.0 (* x (+ 1.0 (* x (* x 0.16666666666666666)))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -3.1e+65) {
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
	}
	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 (z <= (-3.1d+65)) then
        tmp = 1.0d0 + (z * ((z * (z * (-0.16666666666666666d0))) + (-1.0d0)))
    else
        tmp = 1.0d0 + (x * (1.0d0 + (x * (x * 0.16666666666666666d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -3.1e+65) {
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -3.1e+65:
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0))
	else:
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -3.1e+65)
		tmp = Float64(1.0 + Float64(z * Float64(Float64(z * Float64(z * -0.16666666666666666)) + -1.0)));
	else
		tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(x * 0.16666666666666666)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -3.1e+65)
		tmp = 1.0 + (z * ((z * (z * -0.16666666666666666)) + -1.0));
	else
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -3.1e+65], N[(1.0 + N[(z * N[(N[(z * N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+65}:\\
\;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\

\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.09999999999999991e65

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-187.3%

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

      \[\leadsto e^{\color{blue}{-z}} \]
    6. Taylor expanded in z around 0 76.9%

      \[\leadsto \color{blue}{1 + z \cdot \left(z \cdot \left(0.5 + -0.16666666666666666 \cdot z\right) - 1\right)} \]
    7. Taylor expanded in z around inf 76.9%

      \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(-0.16666666666666666 \cdot z\right)} - 1\right) \]
    8. Step-by-step derivation
      1. *-commutative76.9%

        \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(z \cdot -0.16666666666666666\right)} - 1\right) \]
    9. Simplified76.9%

      \[\leadsto 1 + z \cdot \left(z \cdot \color{blue}{\left(z \cdot -0.16666666666666666\right)} - 1\right) \]

    if -3.09999999999999991e65 < z

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x}} \]
    4. Taylor expanded in x around 0 32.5%

      \[\leadsto \color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)} \]
    5. Taylor expanded in x around inf 32.4%

      \[\leadsto 1 + x \cdot \left(1 + x \cdot \color{blue}{\left(0.16666666666666666 \cdot x\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative32.4%

        \[\leadsto 1 + x \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 0.16666666666666666\right)}\right) \]
    7. Simplified32.4%

      \[\leadsto 1 + x \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 0.16666666666666666\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.1 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot \left(z \cdot -0.16666666666666666\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 40.0% accurate, 12.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 3.3 \cdot 10^{+71}:\\ \;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x 3.3e+71)
   (+ 1.0 (* z (+ (* z 0.5) -1.0)))
   (+ 1.0 (* x (+ 1.0 (* x (* x 0.16666666666666666)))))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= 3.3e+71) {
		tmp = 1.0 + (z * ((z * 0.5) + -1.0));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
	}
	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 (x <= 3.3d+71) then
        tmp = 1.0d0 + (z * ((z * 0.5d0) + (-1.0d0)))
    else
        tmp = 1.0d0 + (x * (1.0d0 + (x * (x * 0.16666666666666666d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= 3.3e+71) {
		tmp = 1.0 + (z * ((z * 0.5) + -1.0));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= 3.3e+71:
		tmp = 1.0 + (z * ((z * 0.5) + -1.0))
	else:
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= 3.3e+71)
		tmp = Float64(1.0 + Float64(z * Float64(Float64(z * 0.5) + -1.0)));
	else
		tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(x * 0.16666666666666666)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 3.3e+71)
		tmp = 1.0 + (z * ((z * 0.5) + -1.0));
	else
		tmp = 1.0 + (x * (1.0 + (x * (x * 0.16666666666666666))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, 3.3e+71], N[(1.0 + N[(z * N[(N[(z * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.3 \cdot 10^{+71}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\

\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.2999999999999998e71

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-160.0%

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

      \[\leadsto e^{\color{blue}{-z}} \]
    6. Taylor expanded in z around 0 33.2%

      \[\leadsto \color{blue}{1 + z \cdot \left(0.5 \cdot z - 1\right)} \]

    if 3.2999999999999998e71 < x

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x}} \]
    4. Taylor expanded in x around 0 76.7%

      \[\leadsto \color{blue}{1 + x \cdot \left(1 + x \cdot \left(0.5 + 0.16666666666666666 \cdot x\right)\right)} \]
    5. Taylor expanded in x around inf 76.7%

      \[\leadsto 1 + x \cdot \left(1 + x \cdot \color{blue}{\left(0.16666666666666666 \cdot x\right)}\right) \]
    6. Step-by-step derivation
      1. *-commutative76.7%

        \[\leadsto 1 + x \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 0.16666666666666666\right)}\right) \]
    7. Simplified76.7%

      \[\leadsto 1 + x \cdot \left(1 + x \cdot \color{blue}{\left(x \cdot 0.16666666666666666\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification40.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.3 \cdot 10^{+71}:\\ \;\;\;\;1 + z \cdot \left(z \cdot 0.5 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 36.4% accurate, 14.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -4.3e+65) (+ 1.0 (* z (* z 0.5))) (+ 1.0 (* x (+ 1.0 (* x 0.5))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.3e+65) {
		tmp = 1.0 + (z * (z * 0.5));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * 0.5)));
	}
	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 (z <= (-4.3d+65)) then
        tmp = 1.0d0 + (z * (z * 0.5d0))
    else
        tmp = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.3e+65) {
		tmp = 1.0 + (z * (z * 0.5));
	} else {
		tmp = 1.0 + (x * (1.0 + (x * 0.5)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -4.3e+65:
		tmp = 1.0 + (z * (z * 0.5))
	else:
		tmp = 1.0 + (x * (1.0 + (x * 0.5)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -4.3e+65)
		tmp = Float64(1.0 + Float64(z * Float64(z * 0.5)));
	else
		tmp = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -4.3e+65)
		tmp = 1.0 + (z * (z * 0.5));
	else
		tmp = 1.0 + (x * (1.0 + (x * 0.5)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -4.3e+65], N[(1.0 + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+65}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.30000000000000046e65

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-187.3%

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

      \[\leadsto e^{\color{blue}{-z}} \]
    6. Taylor expanded in z around 0 65.0%

      \[\leadsto \color{blue}{1 + z \cdot \left(0.5 \cdot z - 1\right)} \]
    7. Taylor expanded in z around inf 65.0%

      \[\leadsto 1 + z \cdot \color{blue}{\left(0.5 \cdot z\right)} \]

    if -4.30000000000000046e65 < z

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x}} \]
    4. Taylor expanded in x around 0 31.3%

      \[\leadsto \color{blue}{1 + x \cdot \left(1 + 0.5 \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(1 + x \cdot 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 36.3% accurate, 17.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.02 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(x \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -2.02e+65) (+ 1.0 (* z (* z 0.5))) (+ 1.0 (* x (* x 0.5)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -2.02e+65) {
		tmp = 1.0 + (z * (z * 0.5));
	} else {
		tmp = 1.0 + (x * (x * 0.5));
	}
	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 (z <= (-2.02d+65)) then
        tmp = 1.0d0 + (z * (z * 0.5d0))
    else
        tmp = 1.0d0 + (x * (x * 0.5d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -2.02e+65) {
		tmp = 1.0 + (z * (z * 0.5));
	} else {
		tmp = 1.0 + (x * (x * 0.5));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -2.02e+65:
		tmp = 1.0 + (z * (z * 0.5))
	else:
		tmp = 1.0 + (x * (x * 0.5))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -2.02e+65)
		tmp = Float64(1.0 + Float64(z * Float64(z * 0.5)));
	else
		tmp = Float64(1.0 + Float64(x * Float64(x * 0.5)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -2.02e+65)
		tmp = 1.0 + (z * (z * 0.5));
	else
		tmp = 1.0 + (x * (x * 0.5));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -2.02e+65], N[(1.0 + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.02 \cdot 10^{+65}:\\
\;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.0199999999999999e65

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
    4. Step-by-step derivation
      1. neg-mul-187.3%

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

      \[\leadsto e^{\color{blue}{-z}} \]
    6. Taylor expanded in z around 0 65.0%

      \[\leadsto \color{blue}{1 + z \cdot \left(0.5 \cdot z - 1\right)} \]
    7. Taylor expanded in z around inf 65.0%

      \[\leadsto 1 + z \cdot \color{blue}{\left(0.5 \cdot z\right)} \]

    if -2.0199999999999999e65 < z

    1. Initial program 100.0%

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

      \[\leadsto e^{\color{blue}{x}} \]
    4. Taylor expanded in x around 0 31.3%

      \[\leadsto \color{blue}{1 + x \cdot \left(1 + 0.5 \cdot x\right)} \]
    5. Taylor expanded in x around inf 31.1%

      \[\leadsto 1 + x \cdot \color{blue}{\left(0.5 \cdot x\right)} \]
    6. Step-by-step derivation
      1. *-commutative31.1%

        \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot 0.5\right)} \]
    7. Simplified31.1%

      \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot 0.5\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.02 \cdot 10^{+65}:\\ \;\;\;\;1 + z \cdot \left(z \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(x \cdot 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 28.2% accurate, 29.6× speedup?

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

\\
1 + x \cdot \left(x \cdot 0.5\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto e^{\color{blue}{x}} \]
  4. Taylor expanded in x around 0 27.1%

    \[\leadsto \color{blue}{1 + x \cdot \left(1 + 0.5 \cdot x\right)} \]
  5. Taylor expanded in x around inf 27.0%

    \[\leadsto 1 + x \cdot \color{blue}{\left(0.5 \cdot x\right)} \]
  6. Step-by-step derivation
    1. *-commutative27.0%

      \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot 0.5\right)} \]
  7. Simplified27.0%

    \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot 0.5\right)} \]
  8. Add Preprocessing

Alternative 13: 14.4% accurate, 69.0× speedup?

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

\\
1 - 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 56.7%

    \[\leadsto e^{\color{blue}{-1 \cdot z}} \]
  4. Step-by-step derivation
    1. neg-mul-156.7%

      \[\leadsto e^{\color{blue}{-z}} \]
  5. Simplified56.7%

    \[\leadsto e^{\color{blue}{-z}} \]
  6. Taylor expanded in z around 0 15.2%

    \[\leadsto \color{blue}{1 + -1 \cdot z} \]
  7. Step-by-step derivation
    1. neg-mul-115.2%

      \[\leadsto 1 + \color{blue}{\left(-z\right)} \]
    2. unsub-neg15.2%

      \[\leadsto \color{blue}{1 - z} \]
  8. Simplified15.2%

    \[\leadsto \color{blue}{1 - z} \]
  9. Add Preprocessing

Alternative 14: 14.5% 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. Add Preprocessing
  3. Taylor expanded in x around inf 48.7%

    \[\leadsto e^{\color{blue}{x}} \]
  4. Taylor expanded in x around 0 15.0%

    \[\leadsto \color{blue}{1 + x} \]
  5. Final simplification15.0%

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

Alternative 15: 14.2% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
	return 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 = 1.0d0
end function
public static double code(double x, double y, double z) {
	return 1.0;
}
def code(x, y, z):
	return 1.0
function code(x, y, z)
	return 1.0
end
function tmp = code(x, y, z)
	tmp = 1.0;
end
code[x_, y_, z_] := 1.0
\begin{array}{l}

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

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

    \[\leadsto e^{\color{blue}{x}} \]
  4. Taylor expanded in x around 0 14.9%

    \[\leadsto \color{blue}{1} \]
  5. 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 2024181 
(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)))