Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 11.0s
Alternatives: 17
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 17 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.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. 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 \]
    2. 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 \]
    3. +-lowering-+.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 \]
    4. *-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 \]
    5. 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 \]
    6. accelerator-lowering-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 \]
    7. log-lowering-log.f64N/A

      \[\leadsto \left(x + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), y\right)\right) - z \]
    8. +-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 \]
    9. 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 \]
    10. 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 \]
    11. --lowering--.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 \]
    12. metadata-eval99.9

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

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

Alternative 2: 75.3% 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 -2 \cdot 10^{+197}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\ \mathbf{elif}\;t\_0 \leq -20000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;t\_0 \leq 350:\\ \;\;\;\;y - \mathsf{fma}\left(\log y, 0.5, z\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
   (if (<= t_0 -2e+197)
     (fma (log y) (- y) y)
     (if (<= t_0 -20000000.0)
       (- x z)
       (if (<= t_0 350.0) (- y (fma (log y) 0.5 z)) (- x z))))))
double code(double x, double y, double z) {
	double t_0 = y + (x - (log(y) * (y + 0.5)));
	double tmp;
	if (t_0 <= -2e+197) {
		tmp = fma(log(y), -y, y);
	} else if (t_0 <= -20000000.0) {
		tmp = x - z;
	} else if (t_0 <= 350.0) {
		tmp = y - fma(log(y), 0.5, z);
	} else {
		tmp = x - z;
	}
	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 <= -2e+197)
		tmp = fma(log(y), Float64(-y), y);
	elseif (t_0 <= -20000000.0)
		tmp = Float64(x - z);
	elseif (t_0 <= 350.0)
		tmp = Float64(y - fma(log(y), 0.5, z));
	else
		tmp = Float64(x - z);
	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, -2e+197], N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision], If[LessEqual[t$95$0, -20000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 350.0], N[(y - N[(N[Log[y], $MachinePrecision] * 0.5 + z), $MachinePrecision]), $MachinePrecision], N[(x - z), $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 -2 \cdot 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\

\mathbf{elif}\;t\_0 \leq -20000000:\\
\;\;\;\;x - z\\

\mathbf{elif}\;t\_0 \leq 350:\\
\;\;\;\;y - \mathsf{fma}\left(\log y, 0.5, z\right)\\

\mathbf{else}:\\
\;\;\;\;x - z\\


\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.9999999999999999e197

    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. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 \cdot y, y\right)} \]
      12. log-lowering-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. neg-lowering-neg.f6463.0

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

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

    if -1.9999999999999999e197 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -2e7 or 350 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y)

    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 x around inf

      \[\leadsto \color{blue}{x} - z \]
    4. Step-by-step derivation
      1. Simplified75.1%

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

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

      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 x around 0

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto y - \color{blue}{\mathsf{fma}\left(\log y, \frac{1}{2}, z\right)} \]
        4. log-lowering-log.f6496.0

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

        \[\leadsto y - \color{blue}{\mathsf{fma}\left(\log y, 0.5, z\right)} \]
    5. Recombined 3 regimes into one program.
    6. Final simplification77.1%

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

    Alternative 3: 75.3% 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 -2 \cdot 10^{+197}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\ \mathbf{elif}\;t\_0 \leq -20000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;t\_0 \leq 350:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
       (if (<= t_0 -2e+197)
         (fma (log y) (- y) y)
         (if (<= t_0 -20000000.0)
           (- x z)
           (if (<= t_0 350.0) (- (* (log y) -0.5) z) (- x z))))))
    double code(double x, double y, double z) {
    	double t_0 = y + (x - (log(y) * (y + 0.5)));
    	double tmp;
    	if (t_0 <= -2e+197) {
    		tmp = fma(log(y), -y, y);
    	} else if (t_0 <= -20000000.0) {
    		tmp = x - z;
    	} else if (t_0 <= 350.0) {
    		tmp = (log(y) * -0.5) - z;
    	} else {
    		tmp = x - z;
    	}
    	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 <= -2e+197)
    		tmp = fma(log(y), Float64(-y), y);
    	elseif (t_0 <= -20000000.0)
    		tmp = Float64(x - z);
    	elseif (t_0 <= 350.0)
    		tmp = Float64(Float64(log(y) * -0.5) - z);
    	else
    		tmp = Float64(x - z);
    	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, -2e+197], N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision], If[LessEqual[t$95$0, -20000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 350.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], N[(x - z), $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 -2 \cdot 10^{+197}:\\
    \;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\
    
    \mathbf{elif}\;t\_0 \leq -20000000:\\
    \;\;\;\;x - z\\
    
    \mathbf{elif}\;t\_0 \leq 350:\\
    \;\;\;\;\log y \cdot -0.5 - z\\
    
    \mathbf{else}:\\
    \;\;\;\;x - z\\
    
    
    \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.9999999999999999e197

      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. accelerator-lowering-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 \cdot y, y\right)} \]
        12. log-lowering-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. neg-lowering-neg.f6463.0

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

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

      if -1.9999999999999999e197 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -2e7 or 350 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y)

      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 x around inf

        \[\leadsto \color{blue}{x} - z \]
      4. Step-by-step derivation
        1. Simplified75.1%

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

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

        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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{-1}{2}} \cdot \log y - z \]
          8. *-commutativeN/A

            \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
          9. *-lowering-*.f64N/A

            \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
          10. log-lowering-log.f6496.0

            \[\leadsto \color{blue}{\log y} \cdot -0.5 - z \]
        8. Simplified96.0%

          \[\leadsto \color{blue}{\log y \cdot -0.5 - z} \]
      5. Recombined 3 regimes into one program.
      6. Final simplification77.1%

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

      Alternative 4: 75.3% 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 -2 \cdot 10^{+197}:\\ \;\;\;\;y - y \cdot \log y\\ \mathbf{elif}\;t\_0 \leq -20000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;t\_0 \leq 350:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
         (if (<= t_0 -2e+197)
           (- y (* y (log y)))
           (if (<= t_0 -20000000.0)
             (- x z)
             (if (<= t_0 350.0) (- (* (log y) -0.5) z) (- x z))))))
      double code(double x, double y, double z) {
      	double t_0 = y + (x - (log(y) * (y + 0.5)));
      	double tmp;
      	if (t_0 <= -2e+197) {
      		tmp = y - (y * log(y));
      	} else if (t_0 <= -20000000.0) {
      		tmp = x - z;
      	} else if (t_0 <= 350.0) {
      		tmp = (log(y) * -0.5) - z;
      	} else {
      		tmp = x - z;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: t_0
          real(8) :: tmp
          t_0 = y + (x - (log(y) * (y + 0.5d0)))
          if (t_0 <= (-2d+197)) then
              tmp = y - (y * log(y))
          else if (t_0 <= (-20000000.0d0)) then
              tmp = x - z
          else if (t_0 <= 350.0d0) then
              tmp = (log(y) * (-0.5d0)) - z
          else
              tmp = x - z
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = y + (x - (Math.log(y) * (y + 0.5)));
      	double tmp;
      	if (t_0 <= -2e+197) {
      		tmp = y - (y * Math.log(y));
      	} else if (t_0 <= -20000000.0) {
      		tmp = x - z;
      	} else if (t_0 <= 350.0) {
      		tmp = (Math.log(y) * -0.5) - z;
      	} else {
      		tmp = x - z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = y + (x - (math.log(y) * (y + 0.5)))
      	tmp = 0
      	if t_0 <= -2e+197:
      		tmp = y - (y * math.log(y))
      	elif t_0 <= -20000000.0:
      		tmp = x - z
      	elif t_0 <= 350.0:
      		tmp = (math.log(y) * -0.5) - z
      	else:
      		tmp = x - z
      	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 <= -2e+197)
      		tmp = Float64(y - Float64(y * log(y)));
      	elseif (t_0 <= -20000000.0)
      		tmp = Float64(x - z);
      	elseif (t_0 <= 350.0)
      		tmp = Float64(Float64(log(y) * -0.5) - z);
      	else
      		tmp = Float64(x - z);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = y + (x - (log(y) * (y + 0.5)));
      	tmp = 0.0;
      	if (t_0 <= -2e+197)
      		tmp = y - (y * log(y));
      	elseif (t_0 <= -20000000.0)
      		tmp = x - z;
      	elseif (t_0 <= 350.0)
      		tmp = (log(y) * -0.5) - z;
      	else
      		tmp = x - z;
      	end
      	tmp_2 = 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, -2e+197], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -20000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 350.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], N[(x - z), $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 -2 \cdot 10^{+197}:\\
      \;\;\;\;y - y \cdot \log y\\
      
      \mathbf{elif}\;t\_0 \leq -20000000:\\
      \;\;\;\;x - z\\
      
      \mathbf{elif}\;t\_0 \leq 350:\\
      \;\;\;\;\log y \cdot -0.5 - z\\
      
      \mathbf{else}:\\
      \;\;\;\;x - z\\
      
      
      \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.9999999999999999e197

        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. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 \cdot y, y\right)} \]
          12. log-lowering-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. neg-lowering-neg.f6463.0

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

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

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

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

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

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

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

            \[\leadsto y - \color{blue}{y \cdot \log y} \]
          7. log-lowering-log.f6462.9

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

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

        if -1.9999999999999999e197 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -2e7 or 350 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y)

        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 x around inf

          \[\leadsto \color{blue}{x} - z \]
        4. Step-by-step derivation
          1. Simplified75.1%

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

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

          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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{-1}{2}} \cdot \log y - z \]
            8. *-commutativeN/A

              \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
            9. *-lowering-*.f64N/A

              \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
            10. log-lowering-log.f6496.0

              \[\leadsto \color{blue}{\log y} \cdot -0.5 - z \]
          8. Simplified96.0%

            \[\leadsto \color{blue}{\log y \cdot -0.5 - z} \]
        5. Recombined 3 regimes into one program.
        6. Final simplification77.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y + \left(x - \log y \cdot \left(y + 0.5\right)\right) \leq -2 \cdot 10^{+197}:\\ \;\;\;\;y - y \cdot \log y\\ \mathbf{elif}\;y + \left(x - \log y \cdot \left(y + 0.5\right)\right) \leq -20000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;y + \left(x - \log y \cdot \left(y + 0.5\right)\right) \leq 350:\\ \;\;\;\;\log y \cdot -0.5 - z\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \]
        7. Add Preprocessing

        Alternative 5: 83.0% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z\\ \mathbf{if}\;t\_0 \leq -50000000000:\\ \;\;\;\;y - \mathsf{fma}\left(\log y, y, z\right)\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+16}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (- (+ y (- x (* (log y) (+ y 0.5)))) z)))
           (if (<= t_0 -50000000000.0)
             (- y (fma (log y) y z))
             (if (<= t_0 5e+16) (fma (log y) -0.5 x) (- x z)))))
        double code(double x, double y, double z) {
        	double t_0 = (y + (x - (log(y) * (y + 0.5)))) - z;
        	double tmp;
        	if (t_0 <= -50000000000.0) {
        		tmp = y - fma(log(y), y, z);
        	} else if (t_0 <= 5e+16) {
        		tmp = fma(log(y), -0.5, x);
        	} else {
        		tmp = x - z;
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	t_0 = Float64(Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) - z)
        	tmp = 0.0
        	if (t_0 <= -50000000000.0)
        		tmp = Float64(y - fma(log(y), y, z));
        	elseif (t_0 <= 5e+16)
        		tmp = fma(log(y), -0.5, x);
        	else
        		tmp = Float64(x - z);
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -50000000000.0], N[(y - N[(N[Log[y], $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+16], N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision], N[(x - z), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z\\
        \mathbf{if}\;t\_0 \leq -50000000000:\\
        \;\;\;\;y - \mathsf{fma}\left(\log y, y, z\right)\\
        
        \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+16}:\\
        \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x - z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -5e10

          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 x around 0

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

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

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

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

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

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

              \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y + 0.5}, z\right) \]
          5. Simplified74.1%

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

            \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y}, z\right) \]
          7. Step-by-step derivation
            1. Simplified73.9%

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

            if -5e10 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < 5e16

            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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto 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) \]
              8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

            if 5e16 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z)

            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 x around inf

              \[\leadsto \color{blue}{x} - z \]
            4. Step-by-step derivation
              1. Simplified98.6%

                \[\leadsto \color{blue}{x} - z \]
            5. Recombined 3 regimes into one program.
            6. Final simplification84.7%

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

            Alternative 6: 69.3% accurate, 0.3× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z\\ \mathbf{if}\;t\_0 \leq -50000000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;t\_0 \leq 500:\\ \;\;\;\;\log y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (- (+ y (- x (* (log y) (+ y 0.5)))) z)))
               (if (<= t_0 -50000000000.0)
                 (- x z)
                 (if (<= t_0 500.0) (* (log y) -0.5) (- x z)))))
            double code(double x, double y, double z) {
            	double t_0 = (y + (x - (log(y) * (y + 0.5)))) - z;
            	double tmp;
            	if (t_0 <= -50000000000.0) {
            		tmp = x - z;
            	} else if (t_0 <= 500.0) {
            		tmp = log(y) * -0.5;
            	} else {
            		tmp = x - z;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y, z)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: tmp
                t_0 = (y + (x - (log(y) * (y + 0.5d0)))) - z
                if (t_0 <= (-50000000000.0d0)) then
                    tmp = x - z
                else if (t_0 <= 500.0d0) then
                    tmp = log(y) * (-0.5d0)
                else
                    tmp = x - z
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = (y + (x - (Math.log(y) * (y + 0.5)))) - z;
            	double tmp;
            	if (t_0 <= -50000000000.0) {
            		tmp = x - z;
            	} else if (t_0 <= 500.0) {
            		tmp = Math.log(y) * -0.5;
            	} else {
            		tmp = x - z;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = (y + (x - (math.log(y) * (y + 0.5)))) - z
            	tmp = 0
            	if t_0 <= -50000000000.0:
            		tmp = x - z
            	elif t_0 <= 500.0:
            		tmp = math.log(y) * -0.5
            	else:
            		tmp = x - z
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) - z)
            	tmp = 0.0
            	if (t_0 <= -50000000000.0)
            		tmp = Float64(x - z);
            	elseif (t_0 <= 500.0)
            		tmp = Float64(log(y) * -0.5);
            	else
            		tmp = Float64(x - z);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = (y + (x - (log(y) * (y + 0.5)))) - z;
            	tmp = 0.0;
            	if (t_0 <= -50000000000.0)
            		tmp = x - z;
            	elseif (t_0 <= 500.0)
            		tmp = log(y) * -0.5;
            	else
            		tmp = x - z;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -50000000000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision], N[(x - z), $MachinePrecision]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z\\
            \mathbf{if}\;t\_0 \leq -50000000000:\\
            \;\;\;\;x - z\\
            
            \mathbf{elif}\;t\_0 \leq 500:\\
            \;\;\;\;\log y \cdot -0.5\\
            
            \mathbf{else}:\\
            \;\;\;\;x - z\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -5e10 or 500 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z)

              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 x around inf

                \[\leadsto \color{blue}{x} - z \]
              4. Step-by-step derivation
                1. Simplified66.7%

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

                if -5e10 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < 500

                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 x around 0

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

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

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

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

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

                    \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y + \frac{1}{2}}, z\right) \]
                  6. +-lowering-+.f6494.5

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{-1}{2}} \cdot \log y - z \]
                  8. *-commutativeN/A

                    \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
                  9. *-lowering-*.f64N/A

                    \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
                  10. log-lowering-log.f6492.3

                    \[\leadsto \color{blue}{\log y} \cdot -0.5 - z \]
                8. Simplified92.3%

                  \[\leadsto \color{blue}{\log y \cdot -0.5 - z} \]
                9. Taylor expanded in z around 0

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

                    \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y} \]
                  2. log-lowering-log.f6492.3

                    \[\leadsto -0.5 \cdot \color{blue}{\log y} \]
                11. Simplified92.3%

                  \[\leadsto \color{blue}{-0.5 \cdot \log y} \]
              5. Recombined 2 regimes into one program.
              6. Final simplification70.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z \leq -50000000000:\\ \;\;\;\;x - z\\ \mathbf{elif}\;\left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z \leq 500:\\ \;\;\;\;\log y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \]
              7. Add Preprocessing

              Alternative 7: 71.0% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 3.6 \cdot 10^{-131}:\\ \;\;\;\;\left(x + y\right) - z\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-90}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+154}:\\ \;\;\;\;x - z\\ \mathbf{else}:\\ \;\;\;\;y - y \cdot \log y\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= y 3.6e-131)
                 (- (+ x y) z)
                 (if (<= y 5.4e-90)
                   (fma (log y) -0.5 x)
                   (if (<= y 4.2e+154) (- x z) (- y (* y (log y)))))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (y <= 3.6e-131) {
              		tmp = (x + y) - z;
              	} else if (y <= 5.4e-90) {
              		tmp = fma(log(y), -0.5, x);
              	} else if (y <= 4.2e+154) {
              		tmp = x - z;
              	} else {
              		tmp = y - (y * log(y));
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if (y <= 3.6e-131)
              		tmp = Float64(Float64(x + y) - z);
              	elseif (y <= 5.4e-90)
              		tmp = fma(log(y), -0.5, x);
              	elseif (y <= 4.2e+154)
              		tmp = Float64(x - z);
              	else
              		tmp = Float64(y - Float64(y * log(y)));
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[LessEqual[y, 3.6e-131], N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 5.4e-90], N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision], If[LessEqual[y, 4.2e+154], N[(x - 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^{-131}:\\
              \;\;\;\;\left(x + y\right) - z\\
              
              \mathbf{elif}\;y \leq 5.4 \cdot 10^{-90}:\\
              \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\
              
              \mathbf{elif}\;y \leq 4.2 \cdot 10^{+154}:\\
              \;\;\;\;x - z\\
              
              \mathbf{else}:\\
              \;\;\;\;y - y \cdot \log y\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if y < 3.5999999999999999e-131

                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 x around inf

                  \[\leadsto \left(\color{blue}{x} + y\right) - z \]
                4. Step-by-step derivation
                  1. Simplified77.9%

                    \[\leadsto \left(\color{blue}{x} + y\right) - z \]

                  if 3.5999999999999999e-131 < y < 5.39999999999999993e-90

                  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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto 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) \]
                    8. metadata-evalN/A

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

                      \[\leadsto x + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, y\right) \]
                    10. --lowering--.f64100.0

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, \frac{-1}{2}, x\right)} \]
                    4. log-lowering-log.f64100.0

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

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

                  if 5.39999999999999993e-90 < y < 4.19999999999999989e154

                  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 x around inf

                    \[\leadsto \color{blue}{x} - z \]
                  4. Step-by-step derivation
                    1. Simplified71.6%

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

                    if 4.19999999999999989e154 < y

                    1. Initial program 99.6%

                      \[\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. accelerator-lowering-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 \cdot y, y\right)} \]
                      12. log-lowering-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. neg-lowering-neg.f6475.4

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

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

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

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

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

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

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

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

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

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

                  Alternative 8: 99.3% accurate, 1.0× speedup?

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

                    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. accelerator-lowering-fma.f64N/A

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

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

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

                    if 0.28000000000000003 < 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. 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 \]
                      2. 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 \]
                      3. +-lowering-+.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 \]
                      4. *-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 \]
                      5. 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 \]
                      6. accelerator-lowering-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 \]
                      7. log-lowering-log.f64N/A

                        \[\leadsto \left(x + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), y\right)\right) - z \]
                      8. +-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 \]
                      9. 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 \]
                      10. 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 \]
                      11. --lowering--.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 \]
                      12. metadata-eval99.7

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

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

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

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

                        \[\leadsto \left(x + y \cdot \color{blue}{\left(1 - \log y\right)}\right) - z \]
                      3. distribute-lft-out--N/A

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

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

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

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

                        \[\leadsto \left(x + \left(y - y \cdot \color{blue}{\log y}\right)\right) - z \]
                    7. Simplified99.7%

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

                  Alternative 9: 70.1% accurate, 1.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{+19}:\\ \;\;\;\;x - z\\ \mathbf{elif}\;z \leq 165:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;x - z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= z -2.3e+19) (- x z) (if (<= z 165.0) (fma (log y) -0.5 x) (- x z))))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (z <= -2.3e+19) {
                  		tmp = x - z;
                  	} else if (z <= 165.0) {
                  		tmp = fma(log(y), -0.5, x);
                  	} else {
                  		tmp = x - z;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (z <= -2.3e+19)
                  		tmp = Float64(x - z);
                  	elseif (z <= 165.0)
                  		tmp = fma(log(y), -0.5, x);
                  	else
                  		tmp = Float64(x - z);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[z, -2.3e+19], N[(x - z), $MachinePrecision], If[LessEqual[z, 165.0], N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision], N[(x - z), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;z \leq -2.3 \cdot 10^{+19}:\\
                  \;\;\;\;x - z\\
                  
                  \mathbf{elif}\;z \leq 165:\\
                  \;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x - z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if z < -2.3e19 or 165 < 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 x around inf

                      \[\leadsto \color{blue}{x} - z \]
                    4. Step-by-step derivation
                      1. Simplified80.1%

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

                      if -2.3e19 < z < 165

                      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto 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) \]
                        8. metadata-evalN/A

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

                          \[\leadsto x + \mathsf{fma}\left(\log y, \color{blue}{\frac{-1}{2} - y}, y\right) \]
                        10. --lowering--.f6499.8

                          \[\leadsto x + \mathsf{fma}\left(\log y, \color{blue}{-0.5 - y}, y\right) \]
                      7. Simplified99.8%

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

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

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

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, \frac{-1}{2}, x\right)} \]
                        4. log-lowering-log.f6462.3

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

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

                    Alternative 10: 99.3% accurate, 1.0× speedup?

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

                      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. accelerator-lowering-fma.f64N/A

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

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

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

                      if 0.28000000000000003 < 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. 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 \]
                        2. 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 \]
                        3. +-lowering-+.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 \]
                        4. *-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 \]
                        5. 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 \]
                        6. accelerator-lowering-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 \]
                        7. log-lowering-log.f64N/A

                          \[\leadsto \left(x + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), y\right)\right) - z \]
                        8. +-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 \]
                        9. 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 \]
                        10. 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 \]
                        11. --lowering--.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 \]
                        12. metadata-eval99.7

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

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

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

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

                          \[\leadsto \left(x + y \cdot \color{blue}{\left(1 - \log y\right)}\right) - z \]
                        3. distribute-lft-out--N/A

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

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

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

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

                          \[\leadsto \left(x + \left(y - y \cdot \color{blue}{\log y}\right)\right) - z \]
                      7. Simplified99.7%

                        \[\leadsto \left(x + \color{blue}{\left(y - y \cdot \log y\right)}\right) - z \]
                      8. Step-by-step derivation
                        1. associate-+r-N/A

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

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

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

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

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

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

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

                    Alternative 11: 89.4% accurate, 1.0× speedup?

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

                      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. accelerator-lowering-fma.f64N/A

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

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

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

                      if 6.1999999999999999e-6 < 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 x around 0

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

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

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

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

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

                          \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y + \frac{1}{2}}, z\right) \]
                        6. +-lowering-+.f6483.3

                          \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y + 0.5}, z\right) \]
                      5. Simplified83.3%

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

                    Alternative 12: 89.6% accurate, 1.0× speedup?

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

                      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. accelerator-lowering-fma.f64N/A

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

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

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

                      if 42000 < 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)} - z \]
                      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)} - z \]
                        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) - z \]
                        3. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{\mathsf{neg}\left(y\right)}, y\right) - z \]
                        14. neg-lowering-neg.f6483.0

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

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

                    Alternative 13: 89.5% accurate, 1.0× speedup?

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

                      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. accelerator-lowering-fma.f64N/A

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

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

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

                      if 52000 < 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. 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 \]
                        2. 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 \]
                        3. +-lowering-+.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 \]
                        4. *-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 \]
                        5. 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 \]
                        6. accelerator-lowering-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 \]
                        7. log-lowering-log.f64N/A

                          \[\leadsto \left(x + \mathsf{fma}\left(\color{blue}{\log y}, \mathsf{neg}\left(\left(y + \frac{1}{2}\right)\right), y\right)\right) - z \]
                        8. +-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 \]
                        9. 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 \]
                        10. 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 \]
                        11. --lowering--.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 \]
                        12. metadata-eval99.7

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

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

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

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

                          \[\leadsto y \cdot \color{blue}{\left(1 - \log y\right)} - z \]
                        3. distribute-lft-out--N/A

                          \[\leadsto \color{blue}{\left(y \cdot 1 - y \cdot \log y\right)} - z \]
                        4. *-rgt-identityN/A

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

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

                          \[\leadsto \left(y - \color{blue}{y \cdot \log y}\right) - z \]
                        7. log-lowering-log.f6482.9

                          \[\leadsto \left(y - y \cdot \color{blue}{\log y}\right) - z \]
                      7. Simplified82.9%

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

                    Alternative 14: 89.5% accurate, 1.0× speedup?

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

                      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. accelerator-lowering-fma.f64N/A

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

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

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

                      if 52000 < 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 x around 0

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

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

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

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

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

                          \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y + \frac{1}{2}}, z\right) \]
                        6. +-lowering-+.f6483.0

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

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

                        \[\leadsto y - \mathsf{fma}\left(\log y, \color{blue}{y}, z\right) \]
                      7. Step-by-step derivation
                        1. Simplified82.9%

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

                      Alternative 15: 47.6% accurate, 7.9× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+106}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{-5}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (<= x -1.7e+106) x (if (<= x 3.4e-5) (- z) x)))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (x <= -1.7e+106) {
                      		tmp = x;
                      	} else if (x <= 3.4e-5) {
                      		tmp = -z;
                      	} else {
                      		tmp = x;
                      	}
                      	return tmp;
                      }
                      
                      real(8) function code(x, y, z)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8) :: tmp
                          if (x <= (-1.7d+106)) then
                              tmp = x
                          else if (x <= 3.4d-5) then
                              tmp = -z
                          else
                              tmp = x
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if (x <= -1.7e+106) {
                      		tmp = x;
                      	} else if (x <= 3.4e-5) {
                      		tmp = -z;
                      	} else {
                      		tmp = x;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if x <= -1.7e+106:
                      		tmp = x
                      	elif x <= 3.4e-5:
                      		tmp = -z
                      	else:
                      		tmp = x
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (x <= -1.7e+106)
                      		tmp = x;
                      	elseif (x <= 3.4e-5)
                      		tmp = Float64(-z);
                      	else
                      		tmp = x;
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if (x <= -1.7e+106)
                      		tmp = x;
                      	elseif (x <= 3.4e-5)
                      		tmp = -z;
                      	else
                      		tmp = x;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[x, -1.7e+106], x, If[LessEqual[x, 3.4e-5], (-z), x]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -1.7 \cdot 10^{+106}:\\
                      \;\;\;\;x\\
                      
                      \mathbf{elif}\;x \leq 3.4 \cdot 10^{-5}:\\
                      \;\;\;\;-z\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;x\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1.69999999999999997e106 or 3.4e-5 < x

                        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 x around inf

                          \[\leadsto \color{blue}{x} \]
                        4. Step-by-step derivation
                          1. Simplified64.2%

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

                          if -1.69999999999999997e106 < x < 3.4e-5

                          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 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. neg-lowering-neg.f6440.3

                              \[\leadsto \color{blue}{-z} \]
                          5. Simplified40.3%

                            \[\leadsto \color{blue}{-z} \]
                        5. Recombined 2 regimes into one program.
                        6. Add Preprocessing

                        Alternative 16: 58.2% accurate, 29.5× speedup?

                        \[\begin{array}{l} \\ x - z \end{array} \]
                        (FPCore (x y z) :precision binary64 (- x z))
                        double code(double x, double y, double z) {
                        	return x - z;
                        }
                        
                        real(8) function code(x, y, z)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8), intent (in) :: z
                            code = x - z
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	return x - z;
                        }
                        
                        def code(x, y, z):
                        	return x - z
                        
                        function code(x, y, z)
                        	return Float64(x - z)
                        end
                        
                        function tmp = code(x, y, z)
                        	tmp = x - z;
                        end
                        
                        code[x_, y_, z_] := N[(x - z), $MachinePrecision]
                        
                        \begin{array}{l}
                        
                        \\
                        x - z
                        \end{array}
                        
                        Derivation
                        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 x around inf

                          \[\leadsto \color{blue}{x} - z \]
                        4. Step-by-step derivation
                          1. Simplified58.7%

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

                          Alternative 17: 30.2% accurate, 118.0× speedup?

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

                            \[\leadsto \color{blue}{x} \]
                          4. Step-by-step derivation
                            1. Simplified29.9%

                              \[\leadsto \color{blue}{x} \]
                            2. 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 2024198 
                            (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))