Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 11.2s
Alternatives: 9
Speedup: 1.0×

Specification

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

\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + 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 9 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right) \cdot \log y\right)\right) + y\right)\right)} - z \]
    5. lower-+.f64N/A

      \[\leadsto \color{blue}{\left(x + \left(\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right) \cdot \log y\right)\right) + y\right)\right)} - z \]
    6. lift-*.f64N/A

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

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

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

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

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

      \[\leadsto \left(x + \mathsf{fma}\left(\log y, \mathsf{neg}\left(\color{blue}{\left(\frac{1}{2} + y\right)}\right), y\right)\right) - z \]
    12. distribute-neg-inN/A

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

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

      \[\leadsto \left(x + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) - y}, y\right)\right) - z \]
    15. metadata-eval99.9

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

    \[\leadsto \color{blue}{\left(x + \mathsf{fma}\left(\log y, -0.5 - y, y\right)\right) - z} \]
  5. Add Preprocessing

Alternative 2: 68.0% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+44}:\\
\;\;\;\;y - y \cdot \log y\\

\mathbf{elif}\;t\_0 \leq 10^{+134}:\\
\;\;\;\;\log y \cdot -0.5 - z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1.0000000000000001e44

    1. Initial program 99.7%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

        \[\leadsto \left(\left(x - \log y \cdot \color{blue}{\frac{1}{\frac{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}{{y}^{3} + {\frac{1}{2}}^{3}}}}\right) + y\right) - z \]
      6. un-div-invN/A

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

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

        \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{\frac{{y}^{3} + {\frac{1}{2}}^{3}}{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}}}}\right) + y\right) - z \]
      9. flip3-+N/A

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

        \[\leadsto \left(\left(x - \frac{\log y}{\frac{1}{\color{blue}{y + \frac{1}{2}}}}\right) + y\right) - z \]
      11. lower-/.f6499.5

        \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{y + 0.5}}}\right) + y\right) - z \]
    4. Applied rewrites99.5%

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

      \[\leadsto \color{blue}{y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right)} \]
    6. Step-by-step derivation
      1. cancel-sign-sub-invN/A

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

        \[\leadsto y \cdot \left(1 + \color{blue}{1} \cdot \log \left(\frac{1}{y}\right)\right) \]
      3. *-lft-identityN/A

        \[\leadsto y \cdot \left(1 + \color{blue}{\log \left(\frac{1}{y}\right)}\right) \]
      4. distribute-rgt-inN/A

        \[\leadsto \color{blue}{1 \cdot y + \log \left(\frac{1}{y}\right) \cdot y} \]
      5. *-lft-identityN/A

        \[\leadsto \color{blue}{y} + \log \left(\frac{1}{y}\right) \cdot y \]
      6. cancel-sign-subN/A

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

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

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

        \[\leadsto y - \color{blue}{y \cdot \log y} \]
      10. lower--.f64N/A

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

        \[\leadsto y - \color{blue}{y \cdot \log y} \]
      12. lower-log.f6462.9

        \[\leadsto y - y \cdot \color{blue}{\log y} \]
    7. Applied rewrites62.9%

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

    if -1.0000000000000001e44 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 9.99999999999999921e133

    1. Initial program 100.0%

      \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

        \[\leadsto \left(\left(x - \log y \cdot \color{blue}{\frac{1}{\frac{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}{{y}^{3} + {\frac{1}{2}}^{3}}}}\right) + y\right) - z \]
      6. un-div-invN/A

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

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

        \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{\frac{{y}^{3} + {\frac{1}{2}}^{3}}{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}}}}\right) + y\right) - z \]
      9. flip3-+N/A

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

        \[\leadsto \left(\left(x - \frac{\log y}{\frac{1}{\color{blue}{y + \frac{1}{2}}}}\right) + y\right) - z \]
      11. lower-/.f6499.9

        \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{y + 0.5}}}\right) + y\right) - z \]
    4. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{\left(x - \frac{1}{2} \cdot \log y\right)} - z \]
    6. Step-by-step derivation
      1. cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, \frac{-1}{2}, x\right)} - z \]
      6. lower-log.f6495.2

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, -0.5, x\right) - z \]
    7. Applied rewrites95.2%

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

      \[\leadsto \frac{-1}{2} \cdot \color{blue}{\log y} - z \]
    9. Step-by-step derivation
      1. Applied rewrites88.8%

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

      if 9.99999999999999921e133 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y)

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

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

          \[\leadsto y + \left(\color{blue}{\log y \cdot \left(\mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right)\right)} + x\right) \]
        7. lower-fma.f64N/A

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

          \[\leadsto y + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right), x\right) \]
        9. distribute-neg-inN/A

          \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
        10. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(y\right)\right), x\right) \]
        11. unsub-negN/A

          \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, x\right) \]
        12. lower--.f6495.4

          \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, x\right) \]
      5. Applied rewrites95.4%

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

        \[\leadsto x + \color{blue}{\frac{-1}{2} \cdot \log y} \]
      7. Step-by-step derivation
        1. Applied rewrites94.6%

          \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-0.5}, x\right) \]
      8. Recombined 3 regimes into one program.
      9. Final simplification76.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y + \left(x - \log y \cdot \left(y + 0.5\right)\right) \leq -1 \cdot 10^{+44}:\\ \;\;\;\;y - y \cdot \log y\\ \mathbf{elif}\;y + \left(x - \log y \cdot \left(y + 0.5\right)\right) \leq 10^{+134}:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\ \end{array} \]
      10. Add Preprocessing

      Alternative 3: 60.9% accurate, 1.0× speedup?

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

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

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

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

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

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

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

            \[\leadsto y + \left(\color{blue}{\log y \cdot \left(\mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right)\right)} + x\right) \]
          7. lower-fma.f64N/A

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

            \[\leadsto y + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right), x\right) \]
          9. distribute-neg-inN/A

            \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
          10. metadata-evalN/A

            \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(y\right)\right), x\right) \]
          11. unsub-negN/A

            \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, x\right) \]
          12. lower--.f6470.6

            \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, x\right) \]
        5. Applied rewrites70.6%

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

          \[\leadsto x + \color{blue}{\frac{-1}{2} \cdot \log y} \]
        7. Step-by-step derivation
          1. Applied rewrites70.6%

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

          if 1.7499999999999999e-10 < y < 1.1e10

          1. Initial program 100.0%

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

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
            2. lower-neg.f6471.8

              \[\leadsto \color{blue}{-z} \]
          5. Applied rewrites71.8%

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

          if 1.1e10 < y

          1. Initial program 99.7%

            \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

              \[\leadsto \left(\left(x - \log y \cdot \color{blue}{\frac{1}{\frac{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}{{y}^{3} + {\frac{1}{2}}^{3}}}}\right) + y\right) - z \]
            6. un-div-invN/A

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

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

              \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{\frac{{y}^{3} + {\frac{1}{2}}^{3}}{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}}}}\right) + y\right) - z \]
            9. flip3-+N/A

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

              \[\leadsto \left(\left(x - \frac{\log y}{\frac{1}{\color{blue}{y + \frac{1}{2}}}}\right) + y\right) - z \]
            11. lower-/.f6499.5

              \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{y + 0.5}}}\right) + y\right) - z \]
          4. Applied rewrites99.5%

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

            \[\leadsto \color{blue}{y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right)} \]
          6. Step-by-step derivation
            1. cancel-sign-sub-invN/A

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

              \[\leadsto y \cdot \left(1 + \color{blue}{1} \cdot \log \left(\frac{1}{y}\right)\right) \]
            3. *-lft-identityN/A

              \[\leadsto y \cdot \left(1 + \color{blue}{\log \left(\frac{1}{y}\right)}\right) \]
            4. distribute-rgt-inN/A

              \[\leadsto \color{blue}{1 \cdot y + \log \left(\frac{1}{y}\right) \cdot y} \]
            5. *-lft-identityN/A

              \[\leadsto \color{blue}{y} + \log \left(\frac{1}{y}\right) \cdot y \]
            6. cancel-sign-subN/A

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

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

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

              \[\leadsto y - \color{blue}{y \cdot \log y} \]
            10. lower--.f64N/A

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

              \[\leadsto y - \color{blue}{y \cdot \log y} \]
            12. lower-log.f6473.4

              \[\leadsto y - y \cdot \color{blue}{\log y} \]
          7. Applied rewrites73.4%

            \[\leadsto \color{blue}{y - y \cdot \log y} \]
        8. Recombined 3 regimes into one program.
        9. Add Preprocessing

        Alternative 4: 61.0% accurate, 1.0× speedup?

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

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

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

              \[\leadsto y + \left(\color{blue}{\log y \cdot \left(\mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right)\right)} + x\right) \]
            7. lower-fma.f64N/A

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

              \[\leadsto y + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right), x\right) \]
            9. distribute-neg-inN/A

              \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
            10. metadata-evalN/A

              \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(y\right)\right), x\right) \]
            11. unsub-negN/A

              \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, x\right) \]
            12. lower--.f6470.6

              \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, x\right) \]
          5. Applied rewrites70.6%

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

            \[\leadsto x + \color{blue}{\frac{-1}{2} \cdot \log y} \]
          7. Step-by-step derivation
            1. Applied rewrites70.6%

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

            if 1.7499999999999999e-10 < y < 1.1e10

            1. Initial program 100.0%

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

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
              2. lower-neg.f6471.8

                \[\leadsto \color{blue}{-z} \]
            5. Applied rewrites71.8%

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

            if 1.1e10 < y

            1. Initial program 99.7%

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

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

                \[\leadsto y \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(-1 \cdot \log \left(\frac{1}{y}\right)\right)\right)\right)} \]
              2. mul-1-negN/A

                \[\leadsto y \cdot \left(1 + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{1}{y}\right)\right)\right)}\right)\right)\right) \]
              3. remove-double-negN/A

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

                \[\leadsto y \cdot \color{blue}{\left(\log \left(\frac{1}{y}\right) + 1\right)} \]
              5. distribute-rgt-inN/A

                \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right) \cdot y + 1 \cdot y} \]
              6. log-recN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} \cdot y + 1 \cdot y \]
              7. distribute-lft-neg-inN/A

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

                \[\leadsto \color{blue}{\log y \cdot \left(\mathsf{neg}\left(y\right)\right)} + 1 \cdot y \]
              9. mul-1-negN/A

                \[\leadsto \log y \cdot \color{blue}{\left(-1 \cdot y\right)} + 1 \cdot y \]
              10. *-lft-identityN/A

                \[\leadsto \log y \cdot \left(-1 \cdot y\right) + \color{blue}{y} \]
              11. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 \cdot y, y\right)} \]
              12. lower-log.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, -1 \cdot y, y\right) \]
              13. mul-1-negN/A

                \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{\mathsf{neg}\left(y\right)}, y\right) \]
              14. lower-neg.f6473.4

                \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-y}, y\right) \]
            5. Applied rewrites73.4%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -y, y\right)} \]
          8. Recombined 3 regimes into one program.
          9. Add Preprocessing

          Alternative 5: 61.2% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{+42}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 1.52 \cdot 10^{+57}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= z -6.2e+42) (- z) (if (<= z 1.52e+57) (fma (log y) -0.5 x) (- z))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (z <= -6.2e+42) {
          		tmp = -z;
          	} else if (z <= 1.52e+57) {
          		tmp = fma(log(y), -0.5, x);
          	} else {
          		tmp = -z;
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	tmp = 0.0
          	if (z <= -6.2e+42)
          		tmp = Float64(-z);
          	elseif (z <= 1.52e+57)
          		tmp = fma(log(y), -0.5, x);
          	else
          		tmp = Float64(-z);
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := If[LessEqual[z, -6.2e+42], (-z), If[LessEqual[z, 1.52e+57], N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision], (-z)]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -6.2 \cdot 10^{+42}:\\
          \;\;\;\;-z\\
          
          \mathbf{elif}\;z \leq 1.52 \cdot 10^{+57}:\\
          \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;-z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -6.2000000000000003e42 or 1.51999999999999998e57 < z

            1. Initial program 99.9%

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

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
              2. lower-neg.f6459.5

                \[\leadsto \color{blue}{-z} \]
            5. Applied rewrites59.5%

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

            if -6.2000000000000003e42 < z < 1.51999999999999998e57

            1. Initial program 99.8%

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

              \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

                \[\leadsto y + \left(\color{blue}{\log y \cdot \left(\mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right)\right)} + x\right) \]
              7. lower-fma.f64N/A

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

                \[\leadsto y + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right), x\right) \]
              9. distribute-neg-inN/A

                \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
              10. metadata-evalN/A

                \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(y\right)\right), x\right) \]
              11. unsub-negN/A

                \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, x\right) \]
              12. lower--.f6497.2

                \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, x\right) \]
            5. Applied rewrites97.2%

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

              \[\leadsto x + \color{blue}{\frac{-1}{2} \cdot \log y} \]
            7. Step-by-step derivation
              1. Applied rewrites60.4%

                \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-0.5}, x\right) \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 6: 89.5% accurate, 1.0× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 10500000000:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\ \mathbf{else}:\\ \;\;\;\;y + \mathsf{fma}\left(\log y, -0.5 - y, x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y 10500000000.0)
               (- (fma (log y) -0.5 x) z)
               (+ y (fma (log y) (- -0.5 y) x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= 10500000000.0) {
            		tmp = fma(log(y), -0.5, x) - z;
            	} else {
            		tmp = y + fma(log(y), (-0.5 - y), x);
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= 10500000000.0)
            		tmp = Float64(fma(log(y), -0.5, x) - z);
            	else
            		tmp = Float64(y + fma(log(y), Float64(-0.5 - y), x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, 10500000000.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(y + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq 10500000000:\\
            \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
            
            \mathbf{else}:\\
            \;\;\;\;y + \mathsf{fma}\left(\log y, -0.5 - y, x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < 1.05e10

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, -0.5, x\right) - z \]
              5. Applied rewrites99.4%

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

              if 1.05e10 < y

              1. Initial program 99.7%

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

                \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

                  \[\leadsto y + \left(\color{blue}{\log y \cdot \left(\mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right)\right)} + x\right) \]
                7. lower-fma.f64N/A

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

                  \[\leadsto y + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right), x\right) \]
                9. distribute-neg-inN/A

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
                10. metadata-evalN/A

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(y\right)\right), x\right) \]
                11. unsub-negN/A

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, x\right) \]
                12. lower--.f6487.9

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, x\right) \]
              5. Applied rewrites87.9%

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

            Alternative 7: 89.5% accurate, 1.0× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 11000000000:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\ \mathbf{else}:\\ \;\;\;\;y + \mathsf{fma}\left(\log y, -y, x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y 11000000000.0)
               (- (fma (log y) -0.5 x) z)
               (+ y (fma (log y) (- y) x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= 11000000000.0) {
            		tmp = fma(log(y), -0.5, x) - z;
            	} else {
            		tmp = y + fma(log(y), -y, x);
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= 11000000000.0)
            		tmp = Float64(fma(log(y), -0.5, x) - z);
            	else
            		tmp = Float64(y + fma(log(y), Float64(-y), x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, 11000000000.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(y + N[(N[Log[y], $MachinePrecision] * (-y) + x), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq 11000000000:\\
            \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
            
            \mathbf{else}:\\
            \;\;\;\;y + \mathsf{fma}\left(\log y, -y, x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < 1.1e10

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, -0.5, x\right) - z \]
              5. Applied rewrites99.4%

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

              if 1.1e10 < y

              1. Initial program 99.7%

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

                \[\leadsto \color{blue}{\left(x + y\right) - \log y \cdot \left(\frac{1}{2} + y\right)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

                  \[\leadsto y + \left(\color{blue}{\log y \cdot \left(\mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right)\right)} + x\right) \]
                7. lower-fma.f64N/A

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

                  \[\leadsto y + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(\frac{1}{2} + y\right)\right), x\right) \]
                9. distribute-neg-inN/A

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
                10. metadata-evalN/A

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2}} + \left(\mathsf{neg}\left(y\right)\right), x\right) \]
                11. unsub-negN/A

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, x\right) \]
                12. lower--.f6487.9

                  \[\leadsto y + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, x\right) \]
              5. Applied rewrites87.9%

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

                \[\leadsto y + \mathsf{fma}\left(\log y, -1 \cdot \color{blue}{y}, x\right) \]
              7. Step-by-step derivation
                1. Applied rewrites87.6%

                  \[\leadsto y + \mathsf{fma}\left(\log y, -y, x\right) \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 8: 82.1% accurate, 1.0× speedup?

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

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                if 3.59999999999999996e40 < y

                1. Initial program 99.7%

                  \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f64N/A

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

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

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

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

                    \[\leadsto \left(\left(x - \log y \cdot \color{blue}{\frac{1}{\frac{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}{{y}^{3} + {\frac{1}{2}}^{3}}}}\right) + y\right) - z \]
                  6. un-div-invN/A

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

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

                    \[\leadsto \left(\left(x - \frac{\log y}{\color{blue}{\frac{1}{\frac{{y}^{3} + {\frac{1}{2}}^{3}}{y \cdot y + \left(\frac{1}{2} \cdot \frac{1}{2} - y \cdot \frac{1}{2}\right)}}}}\right) + y\right) - z \]
                  9. flip3-+N/A

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

                    \[\leadsto \left(\left(x - \frac{\log y}{\frac{1}{\color{blue}{y + \frac{1}{2}}}}\right) + y\right) - z \]
                  11. lower-/.f6499.4

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

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

                  \[\leadsto \color{blue}{y \cdot \left(1 - -1 \cdot \log \left(\frac{1}{y}\right)\right)} \]
                6. Step-by-step derivation
                  1. cancel-sign-sub-invN/A

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

                    \[\leadsto y \cdot \left(1 + \color{blue}{1} \cdot \log \left(\frac{1}{y}\right)\right) \]
                  3. *-lft-identityN/A

                    \[\leadsto y \cdot \left(1 + \color{blue}{\log \left(\frac{1}{y}\right)}\right) \]
                  4. distribute-rgt-inN/A

                    \[\leadsto \color{blue}{1 \cdot y + \log \left(\frac{1}{y}\right) \cdot y} \]
                  5. *-lft-identityN/A

                    \[\leadsto \color{blue}{y} + \log \left(\frac{1}{y}\right) \cdot y \]
                  6. cancel-sign-subN/A

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

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

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

                    \[\leadsto y - \color{blue}{y \cdot \log y} \]
                  10. lower--.f64N/A

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

                    \[\leadsto y - \color{blue}{y \cdot \log y} \]
                  12. lower-log.f6475.9

                    \[\leadsto y - y \cdot \color{blue}{\log y} \]
                7. Applied rewrites75.9%

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

              Alternative 9: 29.3% accurate, 39.3× 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 Float64(-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.9%

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

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

                  \[\leadsto \color{blue}{\mathsf{neg}\left(z\right)} \]
                2. lower-neg.f6424.4

                  \[\leadsto \color{blue}{-z} \]
              5. Applied rewrites24.4%

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

              Developer Target 1: 99.8% accurate, 1.0× speedup?

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

              Reproduce

              ?
              herbie shell --seed 2024233 
              (FPCore (x y z)
                :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
                :precision binary64
              
                :alt
                (! :herbie-platform default (- (- (+ y x) z) (* (+ y 1/2) (log y))))
              
                (- (+ (- x (* (+ y 0.5) (log y))) y) z))