Statistics.Distribution.Poisson:$clogProbability from math-functions-0.1.5.2

Percentage Accurate: 99.9% → 99.9%
Time: 12.0s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x \cdot \log y - z\right) - y \end{array} \]
(FPCore (x y z) :precision binary64 (- (- (* x (log y)) z) y))
double code(double x, double y, double z) {
	return ((x * log(y)) - z) - y;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x * log(y)) - z) - y
end function
public static double code(double x, double y, double z) {
	return ((x * Math.log(y)) - z) - y;
}
def code(x, y, z):
	return ((x * math.log(y)) - z) - y
function code(x, y, z)
	return Float64(Float64(Float64(x * log(y)) - z) - y)
end
function tmp = code(x, y, z)
	tmp = ((x * log(y)) - z) - y;
end
code[x_, y_, z_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \log y - z\right) - y
\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 10 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: 99.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\log y, x, \left(0 - y\right) - z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (log y) x (- (- 0.0 y) z)))
double code(double x, double y, double z) {
	return fma(log(y), x, ((0.0 - y) - z));
}
function code(x, y, z)
	return fma(log(y), x, Float64(Float64(0.0 - y) - z))
end
code[x_, y_, z_] := N[(N[Log[y], $MachinePrecision] * x + N[(N[(0.0 - y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\log y, x, \left(0 - y\right) - z\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(x \cdot \log y - z\right) - y \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \color{blue}{\left(x \cdot \log y + \left(\mathsf{neg}\left(z\right)\right)\right)} - y \]
    2. associate--l+N/A

      \[\leadsto \color{blue}{x \cdot \log y + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
    3. *-commutativeN/A

      \[\leadsto \color{blue}{\log y \cdot x} + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right) \]
    4. accelerator-lowering-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
    5. log-lowering-log.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x, \left(\mathsf{neg}\left(z\right)\right) - y\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) - y}\right) \]
    7. neg-sub0N/A

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
    8. --lowering--.f6499.8

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
  4. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(0 - z\right) - y\right)} \]
  5. Final simplification99.8%

    \[\leadsto \mathsf{fma}\left(\log y, x, \left(0 - y\right) - z\right) \]
  6. Add Preprocessing

Alternative 2: 85.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log y \cdot x - y\\ \mathbf{if}\;x \leq -5.8 \cdot 10^{+76}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9.4 \cdot 10^{+116}:\\ \;\;\;\;\left(0 - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* (log y) x) y)))
   (if (<= x -5.8e+76) t_0 (if (<= x 9.4e+116) (- (- 0.0 y) z) t_0))))
double code(double x, double y, double z) {
	double t_0 = (log(y) * x) - y;
	double tmp;
	if (x <= -5.8e+76) {
		tmp = t_0;
	} else if (x <= 9.4e+116) {
		tmp = (0.0 - y) - z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (log(y) * x) - y
    if (x <= (-5.8d+76)) then
        tmp = t_0
    else if (x <= 9.4d+116) then
        tmp = (0.0d0 - y) - z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (Math.log(y) * x) - y;
	double tmp;
	if (x <= -5.8e+76) {
		tmp = t_0;
	} else if (x <= 9.4e+116) {
		tmp = (0.0 - y) - z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (math.log(y) * x) - y
	tmp = 0
	if x <= -5.8e+76:
		tmp = t_0
	elif x <= 9.4e+116:
		tmp = (0.0 - y) - z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(log(y) * x) - y)
	tmp = 0.0
	if (x <= -5.8e+76)
		tmp = t_0;
	elseif (x <= 9.4e+116)
		tmp = Float64(Float64(0.0 - y) - z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (log(y) * x) - y;
	tmp = 0.0;
	if (x <= -5.8e+76)
		tmp = t_0;
	elseif (x <= 9.4e+116)
		tmp = (0.0 - y) - z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[x, -5.8e+76], t$95$0, If[LessEqual[x, 9.4e+116], N[(N[(0.0 - y), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log y \cdot x - y\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 9.4 \cdot 10^{+116}:\\
\;\;\;\;\left(0 - y\right) - z\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8000000000000003e76 or 9.4000000000000007e116 < x

    1. Initial program 99.6%

      \[\left(x \cdot \log y - z\right) - y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right) - z \cdot z}{x \cdot \log y + z}} - y \]
      2. div-subN/A

        \[\leadsto \color{blue}{\left(\frac{\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right)}{x \cdot \log y + z} - \frac{z \cdot z}{x \cdot \log y + z}\right)} - y \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\left(\frac{\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right)}{x \cdot \log y + z} + \left(\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)\right)} - y \]
      4. swap-sqrN/A

        \[\leadsto \left(\frac{\color{blue}{\left(x \cdot x\right) \cdot \left(\log y \cdot \log y\right)}}{x \cdot \log y + z} + \left(\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)\right) - y \]
      5. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(x \cdot x\right) \cdot \frac{\log y \cdot \log y}{x \cdot \log y + z}} + \left(\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)\right) - y \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \frac{\log y \cdot \log y}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)} - y \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{\log y \cdot \log y}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{\log y \cdot \log y}{x \cdot \log y + z}}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      9. pow2N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{\color{blue}{{\log y}^{2}}}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      10. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{\color{blue}{{\log y}^{2}}}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      11. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\color{blue}{\log y}}^{2}}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\color{blue}{\mathsf{fma}\left(x, \log y, z\right)}}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      13. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \color{blue}{\log y}, z\right)}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      14. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \log y, z\right)}, \color{blue}{\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)}\right) - y \]
      15. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \log y, z\right)}, \mathsf{neg}\left(\color{blue}{\frac{z \cdot z}{x \cdot \log y + z}}\right)\right) - y \]
    4. Applied egg-rr29.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \log y, z\right)}, -\frac{z \cdot z}{\mathsf{fma}\left(x, \log y, z\right)}\right)} - y \]
    5. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(\frac{x \cdot \log y}{z} - 1\right)} - y \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{z \cdot \left(\frac{x \cdot \log y}{z} - 1\right)} - y \]
      2. sub-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\frac{x \cdot \log y}{z} + \left(\mathsf{neg}\left(1\right)\right)\right)} - y \]
      3. associate-/l*N/A

        \[\leadsto z \cdot \left(\color{blue}{x \cdot \frac{\log y}{z}} + \left(\mathsf{neg}\left(1\right)\right)\right) - y \]
      4. metadata-evalN/A

        \[\leadsto z \cdot \left(x \cdot \frac{\log y}{z} + \color{blue}{-1}\right) - y \]
      5. accelerator-lowering-fma.f64N/A

        \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(x, \frac{\log y}{z}, -1\right)} - y \]
      6. /-lowering-/.f64N/A

        \[\leadsto z \cdot \mathsf{fma}\left(x, \color{blue}{\frac{\log y}{z}}, -1\right) - y \]
      7. log-lowering-log.f6468.2

        \[\leadsto z \cdot \mathsf{fma}\left(x, \frac{\color{blue}{\log y}}{z}, -1\right) - y \]
    7. Simplified68.2%

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(x, \frac{\log y}{z}, -1\right)} - y \]
    8. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x \cdot \log y} - y \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \log y} - y \]
      2. log-lowering-log.f6488.7

        \[\leadsto x \cdot \color{blue}{\log y} - y \]
    10. Simplified88.7%

      \[\leadsto \color{blue}{x \cdot \log y} - y \]

    if -5.8000000000000003e76 < x < 9.4000000000000007e116

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} - y \]
      2. neg-sub0N/A

        \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
      3. --lowering--.f6486.8

        \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
    5. Simplified86.8%

      \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{+76}:\\ \;\;\;\;\log y \cdot x - y\\ \mathbf{elif}\;x \leq 9.4 \cdot 10^{+116}:\\ \;\;\;\;\left(0 - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log y \cdot x\\ \mathbf{if}\;x \leq -3.9 \cdot 10^{+105}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+117}:\\ \;\;\;\;\left(0 - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (log y) x)))
   (if (<= x -3.9e+105) t_0 (if (<= x 8.4e+117) (- (- 0.0 y) z) t_0))))
double code(double x, double y, double z) {
	double t_0 = log(y) * x;
	double tmp;
	if (x <= -3.9e+105) {
		tmp = t_0;
	} else if (x <= 8.4e+117) {
		tmp = (0.0 - y) - z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = log(y) * x
    if (x <= (-3.9d+105)) then
        tmp = t_0
    else if (x <= 8.4d+117) then
        tmp = (0.0d0 - y) - z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = Math.log(y) * x;
	double tmp;
	if (x <= -3.9e+105) {
		tmp = t_0;
	} else if (x <= 8.4e+117) {
		tmp = (0.0 - y) - z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = math.log(y) * x
	tmp = 0
	if x <= -3.9e+105:
		tmp = t_0
	elif x <= 8.4e+117:
		tmp = (0.0 - y) - z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(log(y) * x)
	tmp = 0.0
	if (x <= -3.9e+105)
		tmp = t_0;
	elseif (x <= 8.4e+117)
		tmp = Float64(Float64(0.0 - y) - z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = log(y) * x;
	tmp = 0.0;
	if (x <= -3.9e+105)
		tmp = t_0;
	elseif (x <= 8.4e+117)
		tmp = (0.0 - y) - z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -3.9e+105], t$95$0, If[LessEqual[x, 8.4e+117], N[(N[(0.0 - y), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log y \cdot x\\
\mathbf{if}\;x \leq -3.9 \cdot 10^{+105}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 8.4 \cdot 10^{+117}:\\
\;\;\;\;\left(0 - y\right) - z\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.89999999999999978e105 or 8.4000000000000005e117 < x

    1. Initial program 99.6%

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

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

        \[\leadsto \color{blue}{x \cdot \log y + 0} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, 0\right)} \]
      3. log-lowering-log.f6473.7

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\log y}, 0\right) \]
    5. Simplified73.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

        \[\leadsto \color{blue}{x \cdot \log y} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} \]
      4. log-lowering-log.f6473.7

        \[\leadsto \color{blue}{\log y} \cdot x \]
    7. Applied egg-rr73.7%

      \[\leadsto \color{blue}{\log y \cdot x} \]

    if -3.89999999999999978e105 < x < 8.4000000000000005e117

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} - y \]
      2. neg-sub0N/A

        \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
      3. --lowering--.f6486.1

        \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
    5. Simplified86.1%

      \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
  3. Recombined 2 regimes into one program.
  4. Final simplification82.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+105}:\\ \;\;\;\;\log y \cdot x\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+117}:\\ \;\;\;\;\left(0 - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{+48}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, 0 - z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, 0 - y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.55e+48) (fma (log y) x (- 0.0 z)) (fma (log y) x (- 0.0 y))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.55e+48) {
		tmp = fma(log(y), x, (0.0 - z));
	} else {
		tmp = fma(log(y), x, (0.0 - y));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.55e+48)
		tmp = fma(log(y), x, Float64(0.0 - z));
	else
		tmp = fma(log(y), x, Float64(0.0 - y));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, 1.55e+48], N[(N[Log[y], $MachinePrecision] * x + N[(0.0 - z), $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + N[(0.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, 0 - z\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, 0 - y\right)\\


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

    1. Initial program 99.8%

      \[\left(x \cdot \log y - z\right) - y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\left(x \cdot \log y + \left(\mathsf{neg}\left(z\right)\right)\right)} - y \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{x \cdot \log y + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right) \]
      4. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
      5. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x, \left(\mathsf{neg}\left(z\right)\right) - y\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) - y}\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
      8. --lowering--.f6499.8

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(0 - z\right) - y\right)} \]
    5. Taylor expanded in z around inf

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-1 \cdot z}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(z\right)}\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - z}\right) \]
      3. --lowering--.f6489.8

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - z}\right) \]
    7. Simplified89.8%

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - z}\right) \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(z\right)}\right) \]
      2. unpow1N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{{z}^{1}}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left({z}^{\color{blue}{\left(3 - 2\right)}}\right)\right) \]
      4. pow-divN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\frac{{z}^{3}}{{z}^{2}}}\right)\right) \]
      5. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}}{{z}^{2}}\right)\right) \]
      6. pow2N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{z \cdot z}}\right)\right) \]
      7. sqr-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)}}\right)\right) \]
      8. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(0 - z\right)} \cdot \left(\mathsf{neg}\left(z\right)\right)}\right)\right) \]
      9. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \color{blue}{\left(0 - z\right)}}\right)\right) \]
      10. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{\left(z \cdot z\right)}^{\left(\frac{3}{2}\right)}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      11. sqr-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      12. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\left(\color{blue}{\left(0 - z\right)} \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      13. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\left(\left(0 - z\right) \cdot \color{blue}{\left(0 - z\right)}\right)}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      14. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{\left(0 - z\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(0 - z\right)}^{\left(\frac{3}{2}\right)}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      15. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{\left(0 - z\right)}^{3}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      16. pow2N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\left(0 - z\right)}^{3}}{\color{blue}{{\left(0 - z\right)}^{2}}}\right)\right) \]
      17. pow-divN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{{\left(0 - z\right)}^{\left(3 - 2\right)}}\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left({\left(0 - z\right)}^{\color{blue}{1}}\right)\right) \]
      19. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left({\left(0 - z\right)}^{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}}\right)\right) \]
      20. pow-flipN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\frac{1}{{\left(0 - z\right)}^{-1}}}\right)\right) \]
      21. inv-powN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{1}{\color{blue}{\frac{1}{0 - z}}}\right)\right) \]
      22. remove-double-divN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\left(0 - z\right)}\right)\right) \]
      23. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(\left(0 - z\right)\right)}\right) \]
      24. flip3--N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {z}^{3}}{0 \cdot 0 + \left(z \cdot z + 0 \cdot z\right)}}\right)\right) \]
    9. Applied egg-rr89.8%

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-z}\right) \]

    if 1.55000000000000003e48 < y

    1. Initial program 99.9%

      \[\left(x \cdot \log y - z\right) - y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\left(x \cdot \log y + \left(\mathsf{neg}\left(z\right)\right)\right)} - y \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{x \cdot \log y + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right) \]
      4. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
      5. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x, \left(\mathsf{neg}\left(z\right)\right) - y\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) - y}\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
      8. --lowering--.f6499.9

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(0 - z\right) - y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-1 \cdot y}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(y\right)}\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - y}\right) \]
      3. --lowering--.f6486.2

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - y}\right) \]
    7. Simplified86.2%

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - y}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{+48}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, 0 - z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, 0 - y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8.4 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, 0 - z\right)\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x - y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 8.4e+47) (fma (log y) x (- 0.0 z)) (- (* (log y) x) y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 8.4e+47) {
		tmp = fma(log(y), x, (0.0 - z));
	} else {
		tmp = (log(y) * x) - y;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= 8.4e+47)
		tmp = fma(log(y), x, Float64(0.0 - z));
	else
		tmp = Float64(Float64(log(y) * x) - y);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, 8.4e+47], N[(N[Log[y], $MachinePrecision] * x + N[(0.0 - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.4 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, 0 - z\right)\\

\mathbf{else}:\\
\;\;\;\;\log y \cdot x - y\\


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

    1. Initial program 99.8%

      \[\left(x \cdot \log y - z\right) - y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\left(x \cdot \log y + \left(\mathsf{neg}\left(z\right)\right)\right)} - y \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{x \cdot \log y + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} + \left(\left(\mathsf{neg}\left(z\right)\right) - y\right) \]
      4. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(\mathsf{neg}\left(z\right)\right) - y\right)} \]
      5. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x, \left(\mathsf{neg}\left(z\right)\right) - y\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) - y}\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
      8. --lowering--.f6499.8

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\left(0 - z\right)} - y\right) \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \left(0 - z\right) - y\right)} \]
    5. Taylor expanded in z around inf

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-1 \cdot z}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(z\right)}\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - z}\right) \]
      3. --lowering--.f6489.8

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - z}\right) \]
    7. Simplified89.8%

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{0 - z}\right) \]
    8. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(z\right)}\right) \]
      2. unpow1N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{{z}^{1}}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left({z}^{\color{blue}{\left(3 - 2\right)}}\right)\right) \]
      4. pow-divN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\frac{{z}^{3}}{{z}^{2}}}\right)\right) \]
      5. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}}{{z}^{2}}\right)\right) \]
      6. pow2N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{z \cdot z}}\right)\right) \]
      7. sqr-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)}}\right)\right) \]
      8. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(0 - z\right)} \cdot \left(\mathsf{neg}\left(z\right)\right)}\right)\right) \]
      9. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \color{blue}{\left(0 - z\right)}}\right)\right) \]
      10. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{\left(z \cdot z\right)}^{\left(\frac{3}{2}\right)}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      11. sqr-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      12. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\left(\color{blue}{\left(0 - z\right)} \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      13. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\left(\left(0 - z\right) \cdot \color{blue}{\left(0 - z\right)}\right)}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      14. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{\left(0 - z\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(0 - z\right)}^{\left(\frac{3}{2}\right)}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      15. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{\color{blue}{{\left(0 - z\right)}^{3}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right)\right) \]
      16. pow2N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{{\left(0 - z\right)}^{3}}{\color{blue}{{\left(0 - z\right)}^{2}}}\right)\right) \]
      17. pow-divN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{{\left(0 - z\right)}^{\left(3 - 2\right)}}\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left({\left(0 - z\right)}^{\color{blue}{1}}\right)\right) \]
      19. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left({\left(0 - z\right)}^{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}}\right)\right) \]
      20. pow-flipN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\frac{1}{{\left(0 - z\right)}^{-1}}}\right)\right) \]
      21. inv-powN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\frac{1}{\color{blue}{\frac{1}{0 - z}}}\right)\right) \]
      22. remove-double-divN/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\left(0 - z\right)}\right)\right) \]
      23. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{\mathsf{neg}\left(\left(0 - z\right)\right)}\right) \]
      24. flip3--N/A

        \[\leadsto \mathsf{fma}\left(\log y, x, \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {z}^{3}}{0 \cdot 0 + \left(z \cdot z + 0 \cdot z\right)}}\right)\right) \]
    9. Applied egg-rr89.8%

      \[\leadsto \mathsf{fma}\left(\log y, x, \color{blue}{-z}\right) \]

    if 8.4e47 < y

    1. Initial program 99.9%

      \[\left(x \cdot \log y - z\right) - y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right) - z \cdot z}{x \cdot \log y + z}} - y \]
      2. div-subN/A

        \[\leadsto \color{blue}{\left(\frac{\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right)}{x \cdot \log y + z} - \frac{z \cdot z}{x \cdot \log y + z}\right)} - y \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\left(\frac{\left(x \cdot \log y\right) \cdot \left(x \cdot \log y\right)}{x \cdot \log y + z} + \left(\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)\right)} - y \]
      4. swap-sqrN/A

        \[\leadsto \left(\frac{\color{blue}{\left(x \cdot x\right) \cdot \left(\log y \cdot \log y\right)}}{x \cdot \log y + z} + \left(\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)\right) - y \]
      5. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(x \cdot x\right) \cdot \frac{\log y \cdot \log y}{x \cdot \log y + z}} + \left(\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)\right) - y \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \frac{\log y \cdot \log y}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right)} - y \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{\log y \cdot \log y}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{\log y \cdot \log y}{x \cdot \log y + z}}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      9. pow2N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{\color{blue}{{\log y}^{2}}}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      10. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{\color{blue}{{\log y}^{2}}}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      11. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\color{blue}{\log y}}^{2}}{x \cdot \log y + z}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\color{blue}{\mathsf{fma}\left(x, \log y, z\right)}}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      13. log-lowering-log.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \color{blue}{\log y}, z\right)}, \mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)\right) - y \]
      14. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \log y, z\right)}, \color{blue}{\mathsf{neg}\left(\frac{z \cdot z}{x \cdot \log y + z}\right)}\right) - y \]
      15. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \log y, z\right)}, \mathsf{neg}\left(\color{blue}{\frac{z \cdot z}{x \cdot \log y + z}}\right)\right) - y \]
    4. Applied egg-rr63.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \frac{{\log y}^{2}}{\mathsf{fma}\left(x, \log y, z\right)}, -\frac{z \cdot z}{\mathsf{fma}\left(x, \log y, z\right)}\right)} - y \]
    5. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(\frac{x \cdot \log y}{z} - 1\right)} - y \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{z \cdot \left(\frac{x \cdot \log y}{z} - 1\right)} - y \]
      2. sub-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\frac{x \cdot \log y}{z} + \left(\mathsf{neg}\left(1\right)\right)\right)} - y \]
      3. associate-/l*N/A

        \[\leadsto z \cdot \left(\color{blue}{x \cdot \frac{\log y}{z}} + \left(\mathsf{neg}\left(1\right)\right)\right) - y \]
      4. metadata-evalN/A

        \[\leadsto z \cdot \left(x \cdot \frac{\log y}{z} + \color{blue}{-1}\right) - y \]
      5. accelerator-lowering-fma.f64N/A

        \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(x, \frac{\log y}{z}, -1\right)} - y \]
      6. /-lowering-/.f64N/A

        \[\leadsto z \cdot \mathsf{fma}\left(x, \color{blue}{\frac{\log y}{z}}, -1\right) - y \]
      7. log-lowering-log.f6487.1

        \[\leadsto z \cdot \mathsf{fma}\left(x, \frac{\color{blue}{\log y}}{z}, -1\right) - y \]
    7. Simplified87.1%

      \[\leadsto \color{blue}{z \cdot \mathsf{fma}\left(x, \frac{\log y}{z}, -1\right)} - y \]
    8. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x \cdot \log y} - y \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \log y} - y \]
      2. log-lowering-log.f6486.2

        \[\leadsto x \cdot \color{blue}{\log y} - y \]
    10. Simplified86.2%

      \[\leadsto \color{blue}{x \cdot \log y} - y \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8.4 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, 0 - z\right)\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.9% accurate, 1.0× speedup?

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

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

    \[\left(x \cdot \log y - z\right) - y \]
  2. Add Preprocessing
  3. Final simplification99.8%

    \[\leadsto \left(\log y \cdot x - z\right) - y \]
  4. Add Preprocessing

Alternative 7: 51.8% accurate, 11.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{+48}:\\
\;\;\;\;0 - z\\

\mathbf{else}:\\
\;\;\;\;0 - y\\


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

    1. Initial program 99.8%

      \[\left(x \cdot \log y - z\right) - y \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}{\left(x \cdot \log y - z\right) + y}} \]
      2. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(x \cdot \log y - z\right) + y}{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(x \cdot \log y - z\right) + y}{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}}} \]
      4. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}{\left(x \cdot \log y - z\right) + y}}}} \]
      5. flip--N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x \cdot \log y - z\right) - y}}} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\left(x \cdot \log y - z\right) - y}}} \]
      7. associate--l-N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \log y - \left(z + y\right)}}} \]
      8. --lowering--.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \log y - \left(z + y\right)}}} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \log y} - \left(z + y\right)}} \]
      10. log-lowering-log.f64N/A

        \[\leadsto \frac{1}{\frac{1}{x \cdot \color{blue}{\log y} - \left(z + y\right)}} \]
      11. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{x \cdot \log y - \color{blue}{\left(y + z\right)}}} \]
      12. +-lowering-+.f6499.6

        \[\leadsto \frac{1}{\frac{1}{x \cdot \log y - \color{blue}{\left(y + z\right)}}} \]
    4. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot \log y - \left(y + z\right)}}} \]
    5. Taylor expanded in z around inf

      \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f6446.1

        \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
    7. Simplified46.1%

      \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
    8. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{-1} \cdot z} \]
      2. metadata-evalN/A

        \[\leadsto \color{blue}{-1} \cdot z \]
      3. neg-mul-1N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
      4. unpow1N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{{z}^{1}}\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{neg}\left({z}^{\color{blue}{\left(3 - 2\right)}}\right) \]
      6. pow-divN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{{z}^{3}}{{z}^{2}}}\right) \]
      7. sqr-powN/A

        \[\leadsto \mathsf{neg}\left(\frac{\color{blue}{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}}{{z}^{2}}\right) \]
      8. pow2N/A

        \[\leadsto \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{z \cdot z}}\right) \]
      9. sqr-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)}}\right) \]
      10. sub0-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(0 - z\right)} \cdot \left(\mathsf{neg}\left(z\right)\right)}\right) \]
      11. sub0-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \color{blue}{\left(0 - z\right)}}\right) \]
      12. pow-prod-downN/A

        \[\leadsto \mathsf{neg}\left(\frac{\color{blue}{{\left(z \cdot z\right)}^{\left(\frac{3}{2}\right)}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right) \]
      13. sqr-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{{\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right) \]
      14. sub0-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{{\left(\color{blue}{\left(0 - z\right)} \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right) \]
      15. sub0-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{{\left(\left(0 - z\right) \cdot \color{blue}{\left(0 - z\right)}\right)}^{\left(\frac{3}{2}\right)}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right) \]
      16. pow-prod-downN/A

        \[\leadsto \mathsf{neg}\left(\frac{\color{blue}{{\left(0 - z\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(0 - z\right)}^{\left(\frac{3}{2}\right)}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right) \]
      17. sqr-powN/A

        \[\leadsto \mathsf{neg}\left(\frac{\color{blue}{{\left(0 - z\right)}^{3}}}{\left(0 - z\right) \cdot \left(0 - z\right)}\right) \]
      18. pow2N/A

        \[\leadsto \mathsf{neg}\left(\frac{{\left(0 - z\right)}^{3}}{\color{blue}{{\left(0 - z\right)}^{2}}}\right) \]
      19. pow-divN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{{\left(0 - z\right)}^{\left(3 - 2\right)}}\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{neg}\left({\left(0 - z\right)}^{\color{blue}{1}}\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{neg}\left({\left(0 - z\right)}^{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}}\right) \]
      22. pow-flipN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{{\left(0 - z\right)}^{-1}}}\right) \]
      23. inv-powN/A

        \[\leadsto \mathsf{neg}\left(\frac{1}{\color{blue}{\frac{1}{0 - z}}}\right) \]
      24. remove-double-divN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(0 - z\right)}\right) \]
      25. neg-lowering-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(0 - z\right)\right)} \]
    9. Applied egg-rr46.2%

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

    if 1.24999999999999993e48 < y

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{\mathsf{neg}\left(y\right)} \]
      2. neg-sub0N/A

        \[\leadsto \color{blue}{0 - y} \]
      3. --lowering--.f6468.9

        \[\leadsto \color{blue}{0 - y} \]
    5. Simplified68.9%

      \[\leadsto \color{blue}{0 - y} \]
    6. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(y\right)} \]
      2. neg-lowering-neg.f6468.9

        \[\leadsto \color{blue}{-y} \]
    7. Applied egg-rr68.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.25 \cdot 10^{+48}:\\ \;\;\;\;0 - z\\ \mathbf{else}:\\ \;\;\;\;0 - y\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 65.8% accurate, 16.0× speedup?

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

\\
\left(0 - y\right) - z
\end{array}
Derivation
  1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right)} - y \]
    2. neg-sub0N/A

      \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
    3. --lowering--.f6466.4

      \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
  5. Simplified66.4%

    \[\leadsto \color{blue}{\left(0 - z\right)} - y \]
  6. Final simplification66.4%

    \[\leadsto \left(0 - y\right) - z \]
  7. Add Preprocessing

Alternative 9: 33.9% accurate, 28.0× speedup?

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

\\
0 - y
\end{array}
Derivation
  1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{\mathsf{neg}\left(y\right)} \]
    2. neg-sub0N/A

      \[\leadsto \color{blue}{0 - y} \]
    3. --lowering--.f6434.8

      \[\leadsto \color{blue}{0 - y} \]
  5. Simplified34.8%

    \[\leadsto \color{blue}{0 - y} \]
  6. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(y\right)} \]
    2. neg-lowering-neg.f6434.8

      \[\leadsto \color{blue}{-y} \]
  7. Applied egg-rr34.8%

    \[\leadsto \color{blue}{-y} \]
  8. Final simplification34.8%

    \[\leadsto 0 - y \]
  9. Add Preprocessing

Alternative 10: 2.2% accurate, 112.0× speedup?

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

\\
z
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(x \cdot \log y - z\right) - y \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--N/A

      \[\leadsto \color{blue}{\frac{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}{\left(x \cdot \log y - z\right) + y}} \]
    2. clear-numN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(x \cdot \log y - z\right) + y}{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(x \cdot \log y - z\right) + y}{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}}} \]
    4. clear-numN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\left(x \cdot \log y - z\right) \cdot \left(x \cdot \log y - z\right) - y \cdot y}{\left(x \cdot \log y - z\right) + y}}}} \]
    5. flip--N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x \cdot \log y - z\right) - y}}} \]
    6. /-lowering-/.f64N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\left(x \cdot \log y - z\right) - y}}} \]
    7. associate--l-N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \log y - \left(z + y\right)}}} \]
    8. --lowering--.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \log y - \left(z + y\right)}}} \]
    9. *-lowering-*.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \log y} - \left(z + y\right)}} \]
    10. log-lowering-log.f64N/A

      \[\leadsto \frac{1}{\frac{1}{x \cdot \color{blue}{\log y} - \left(z + y\right)}} \]
    11. +-commutativeN/A

      \[\leadsto \frac{1}{\frac{1}{x \cdot \log y - \color{blue}{\left(y + z\right)}}} \]
    12. +-lowering-+.f6499.6

      \[\leadsto \frac{1}{\frac{1}{x \cdot \log y - \color{blue}{\left(y + z\right)}}} \]
  4. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot \log y - \left(y + z\right)}}} \]
  5. Taylor expanded in z around inf

    \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
  6. Step-by-step derivation
    1. /-lowering-/.f6432.9

      \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
  7. Simplified32.9%

    \[\leadsto \frac{1}{\color{blue}{\frac{-1}{z}}} \]
  8. Step-by-step derivation
    1. frac-2negN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(z\right)}}} \]
    2. metadata-evalN/A

      \[\leadsto \frac{1}{\frac{\color{blue}{1}}{\mathsf{neg}\left(z\right)}} \]
    3. sub0-negN/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{0 - z}}} \]
    4. inv-powN/A

      \[\leadsto \frac{1}{\color{blue}{{\left(0 - z\right)}^{-1}}} \]
    5. pow-flipN/A

      \[\leadsto \color{blue}{{\left(0 - z\right)}^{\left(\mathsf{neg}\left(-1\right)\right)}} \]
    6. metadata-evalN/A

      \[\leadsto {\left(0 - z\right)}^{\color{blue}{1}} \]
    7. metadata-evalN/A

      \[\leadsto {\left(0 - z\right)}^{\color{blue}{\left(3 - 2\right)}} \]
    8. pow-divN/A

      \[\leadsto \color{blue}{\frac{{\left(0 - z\right)}^{3}}{{\left(0 - z\right)}^{2}}} \]
    9. sqr-powN/A

      \[\leadsto \frac{\color{blue}{{\left(0 - z\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(0 - z\right)}^{\left(\frac{3}{2}\right)}}}{{\left(0 - z\right)}^{2}} \]
    10. pow-prod-downN/A

      \[\leadsto \frac{\color{blue}{{\left(\left(0 - z\right) \cdot \left(0 - z\right)\right)}^{\left(\frac{3}{2}\right)}}}{{\left(0 - z\right)}^{2}} \]
    11. sub0-negN/A

      \[\leadsto \frac{{\left(\color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \left(0 - z\right)\right)}^{\left(\frac{3}{2}\right)}}{{\left(0 - z\right)}^{2}} \]
    12. sub0-negN/A

      \[\leadsto \frac{{\left(\left(\mathsf{neg}\left(z\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}\right)}^{\left(\frac{3}{2}\right)}}{{\left(0 - z\right)}^{2}} \]
    13. sqr-negN/A

      \[\leadsto \frac{{\color{blue}{\left(z \cdot z\right)}}^{\left(\frac{3}{2}\right)}}{{\left(0 - z\right)}^{2}} \]
    14. pow-prod-downN/A

      \[\leadsto \frac{\color{blue}{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}}{{\left(0 - z\right)}^{2}} \]
    15. pow2N/A

      \[\leadsto \frac{{z}^{\left(\frac{3}{2}\right)} \cdot {z}^{\left(\frac{3}{2}\right)}}{\color{blue}{\left(0 - z\right) \cdot \left(0 - z\right)}} \]
    16. sqr-powN/A

      \[\leadsto \frac{\color{blue}{{z}^{3}}}{\left(0 - z\right) \cdot \left(0 - z\right)} \]
    17. sub0-negN/A

      \[\leadsto \frac{{z}^{3}}{\color{blue}{\left(\mathsf{neg}\left(z\right)\right)} \cdot \left(0 - z\right)} \]
    18. sub0-negN/A

      \[\leadsto \frac{{z}^{3}}{\left(\mathsf{neg}\left(z\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(z\right)\right)}} \]
    19. sqr-negN/A

      \[\leadsto \frac{{z}^{3}}{\color{blue}{z \cdot z}} \]
    20. pow2N/A

      \[\leadsto \frac{{z}^{3}}{\color{blue}{{z}^{2}}} \]
    21. pow-divN/A

      \[\leadsto \color{blue}{{z}^{\left(3 - 2\right)}} \]
    22. metadata-evalN/A

      \[\leadsto {z}^{\color{blue}{1}} \]
    23. unpow12.3

      \[\leadsto \color{blue}{z} \]
  9. Applied egg-rr2.3%

    \[\leadsto \color{blue}{z} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024196 
(FPCore (x y z)
  :name "Statistics.Distribution.Poisson:$clogProbability from math-functions-0.1.5.2"
  :precision binary64
  (- (- (* x (log y)) z) y))