Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.8%
Time: 8.9s
Alternatives: 11
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 11 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.8% accurate, 1.0× speedup?

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

\\
\left(\left(x - \log y \cdot \left(0.5 + y\right)\right) + y\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. Final simplification99.8%

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

Alternative 2: 74.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 400:\\
\;\;\;\;-0.5 \cdot \log y - z\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\


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

    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. *-commutativeN/A

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

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

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

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

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

        \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y \]
      7. lower-log.f6460.7

        \[\leadsto \left(1 - \color{blue}{\log y}\right) \cdot y \]
    5. Applied rewrites60.7%

      \[\leadsto \color{blue}{\left(1 - \log y\right) \cdot y} \]

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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x - \frac{1}{2} \cdot \log y\right)} - z \]
    6. Step-by-step derivation
      1. 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. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
      5. Applied rewrites100.0%

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

        \[\leadsto \mathsf{fma}\left(\frac{-1 \cdot z}{x}, x, x\right) \]
      7. Step-by-step derivation
        1. Applied rewrites97.8%

          \[\leadsto \mathsf{fma}\left(\frac{-z}{x}, x, x\right) \]
      8. Recombined 3 regimes into one program.
      9. Final simplification74.4%

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

      Alternative 3: 90.0% accurate, 0.9× speedup?

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

        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 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. distribute-lft-neg-inN/A

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

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

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

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

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

        if 9.9999999999999993e44 < y < 1e129

        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1e129 < 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. lower--.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. *-commutativeN/A

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

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

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

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

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

      Alternative 4: 67.9% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\ \mathbf{if}\;x \leq -8 \cdot 10^{+19}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+60}:\\ \;\;\;\;\mathsf{fma}\left(\log y, -0.5 - y, y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (fma (/ (- z) x) x x)))
         (if (<= x -8e+19) t_0 (if (<= x 4.2e+60) (fma (log y) (- -0.5 y) y) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = fma((-z / x), x, x);
      	double tmp;
      	if (x <= -8e+19) {
      		tmp = t_0;
      	} else if (x <= 4.2e+60) {
      		tmp = fma(log(y), (-0.5 - y), y);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = fma(Float64(Float64(-z) / x), x, x)
      	tmp = 0.0
      	if (x <= -8e+19)
      		tmp = t_0;
      	elseif (x <= 4.2e+60)
      		tmp = fma(log(y), Float64(-0.5 - y), y);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[x, -8e+19], t$95$0, If[LessEqual[x, 4.2e+60], N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + y), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\
      \mathbf{if}\;x \leq -8 \cdot 10^{+19}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 4.2 \cdot 10^{+60}:\\
      \;\;\;\;\mathsf{fma}\left(\log y, -0.5 - y, y\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -8e19 or 4.2000000000000002e60 < 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 \cdot \left(\left(1 + \frac{y}{x}\right) - \left(\frac{z}{x} + \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right)\right)} \]
        4. Step-by-step derivation
          1. associate--l+N/A

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
        5. Applied rewrites99.9%

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

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

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

          if -8e19 < x < 4.2000000000000002e60

          1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)} \]
          6. Step-by-step derivation
            1. lower--.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. *-commutativeN/A

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

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

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

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

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

            \[\leadsto y - \color{blue}{\log y \cdot \left(\frac{1}{2} + y\right)} \]
          9. Step-by-step derivation
            1. Applied rewrites71.6%

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

          Alternative 5: 89.7% accurate, 1.0× speedup?

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

            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 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. distribute-lft-neg-inN/A

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

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

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

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

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

            if 1.2500000000000001e90 < 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. *-commutativeN/A

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

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

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

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

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

                \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y - z \]
              7. lower-log.f6488.4

                \[\leadsto \left(1 - \color{blue}{\log y}\right) \cdot y - z \]
            5. Applied rewrites88.4%

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

          Alternative 6: 84.7% accurate, 1.0× speedup?

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

            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 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. distribute-lft-neg-inN/A

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

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

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

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

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

            if 1.40000000000000007e119 < y

            1. Initial program 99.7%

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y \]
              7. lower-log.f6478.5

                \[\leadsto \left(1 - \color{blue}{\log y}\right) \cdot y \]
            5. Applied rewrites78.5%

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

          Alternative 7: 63.1% accurate, 1.0× speedup?

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

            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 \cdot \left(\left(1 + \frac{y}{x}\right) - \left(\frac{z}{x} + \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right)\right)} \]
            4. Step-by-step derivation
              1. associate--l+N/A

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
            5. Applied rewrites91.3%

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

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

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

              if 8.50000000000000033e118 < y

              1. Initial program 99.7%

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(1 - \log y\right)} \cdot y \]
                7. lower-log.f6478.5

                  \[\leadsto \left(1 - \color{blue}{\log y}\right) \cdot y \]
              5. Applied rewrites78.5%

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

            Alternative 8: 40.7% accurate, 3.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -9.6 \cdot 10^{-6}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, y, y\right)\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{+131}:\\ \;\;\;\;\frac{x}{z} \cdot z\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= z -9.6e-6)
               (- z)
               (if (<= z 1.35e-14)
                 (fma (/ x y) y y)
                 (if (<= z 6.6e+131) (* (/ x z) z) (- z)))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (z <= -9.6e-6) {
            		tmp = -z;
            	} else if (z <= 1.35e-14) {
            		tmp = fma((x / y), y, y);
            	} else if (z <= 6.6e+131) {
            		tmp = (x / z) * z;
            	} else {
            		tmp = -z;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (z <= -9.6e-6)
            		tmp = Float64(-z);
            	elseif (z <= 1.35e-14)
            		tmp = fma(Float64(x / y), y, y);
            	elseif (z <= 6.6e+131)
            		tmp = Float64(Float64(x / z) * z);
            	else
            		tmp = Float64(-z);
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[z, -9.6e-6], (-z), If[LessEqual[z, 1.35e-14], N[(N[(x / y), $MachinePrecision] * y + y), $MachinePrecision], If[LessEqual[z, 6.6e+131], N[(N[(x / z), $MachinePrecision] * z), $MachinePrecision], (-z)]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;z \leq -9.6 \cdot 10^{-6}:\\
            \;\;\;\;-z\\
            
            \mathbf{elif}\;z \leq 1.35 \cdot 10^{-14}:\\
            \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, y, y\right)\\
            
            \mathbf{elif}\;z \leq 6.6 \cdot 10^{+131}:\\
            \;\;\;\;\frac{x}{z} \cdot z\\
            
            \mathbf{else}:\\
            \;\;\;\;-z\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if z < -9.5999999999999996e-6 or 6.5999999999999997e131 < z

              1. Initial program 99.9%

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

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

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

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

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

              if -9.5999999999999996e-6 < z < 1.3499999999999999e-14

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\frac{x}{y}, y, y\right) \]
              7. Step-by-step derivation
                1. Applied rewrites26.9%

                  \[\leadsto \mathsf{fma}\left(\frac{x}{y}, y, y\right) \]

                if 1.3499999999999999e-14 < z < 6.5999999999999997e131

                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}{z \cdot \left(\left(\frac{x}{z} + \frac{y}{z}\right) - \left(1 + \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{z}\right)\right)} \]
                4. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

                  \[\leadsto \frac{x}{z} \cdot z \]
                7. Step-by-step derivation
                  1. Applied rewrites42.7%

                    \[\leadsto \frac{x}{z} \cdot z \]
                8. Recombined 3 regimes into one program.
                9. Add Preprocessing

                Alternative 9: 56.2% accurate, 3.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\ \mathbf{if}\;x \leq -0.9:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 6.9 \cdot 10^{-124}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (fma (/ (- z) x) x x)))
                   (if (<= x -0.9) t_0 (if (<= x 6.9e-124) (- z) t_0))))
                double code(double x, double y, double z) {
                	double t_0 = fma((-z / x), x, x);
                	double tmp;
                	if (x <= -0.9) {
                		tmp = t_0;
                	} else if (x <= 6.9e-124) {
                		tmp = -z;
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                function code(x, y, z)
                	t_0 = fma(Float64(Float64(-z) / x), x, x)
                	tmp = 0.0
                	if (x <= -0.9)
                		tmp = t_0;
                	elseif (x <= 6.9e-124)
                		tmp = Float64(-z);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[x, -0.9], t$95$0, If[LessEqual[x, 6.9e-124], (-z), t$95$0]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\
                \mathbf{if}\;x \leq -0.9:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;x \leq 6.9 \cdot 10^{-124}:\\
                \;\;\;\;-z\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if x < -0.900000000000000022 or 6.9e-124 < 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 \cdot \left(\left(1 + \frac{y}{x}\right) - \left(\frac{z}{x} + \frac{\log y \cdot \left(\frac{1}{2} + y\right)}{x}\right)\right)} \]
                  4. Step-by-step derivation
                    1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\frac{-1 \cdot z}{x}, x, x\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites63.6%

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

                    if -0.900000000000000022 < x < 6.9e-124

                    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. lower-neg.f6431.5

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

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

                  Alternative 10: 39.5% accurate, 4.1× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{z} \cdot z\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+149}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (let* ((t_0 (* (/ x z) z)))
                     (if (<= x -2.5e+25) t_0 (if (<= x 4.8e+149) (- z) t_0))))
                  double code(double x, double y, double z) {
                  	double t_0 = (x / z) * z;
                  	double tmp;
                  	if (x <= -2.5e+25) {
                  		tmp = t_0;
                  	} else if (x <= 4.8e+149) {
                  		tmp = -z;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(x, y, z)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8) :: t_0
                      real(8) :: tmp
                      t_0 = (x / z) * z
                      if (x <= (-2.5d+25)) then
                          tmp = t_0
                      else if (x <= 4.8d+149) then
                          tmp = -z
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double t_0 = (x / z) * z;
                  	double tmp;
                  	if (x <= -2.5e+25) {
                  		tmp = t_0;
                  	} else if (x <= 4.8e+149) {
                  		tmp = -z;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	t_0 = (x / z) * z
                  	tmp = 0
                  	if x <= -2.5e+25:
                  		tmp = t_0
                  	elif x <= 4.8e+149:
                  		tmp = -z
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  function code(x, y, z)
                  	t_0 = Float64(Float64(x / z) * z)
                  	tmp = 0.0
                  	if (x <= -2.5e+25)
                  		tmp = t_0;
                  	elseif (x <= 4.8e+149)
                  		tmp = Float64(-z);
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	t_0 = (x / z) * z;
                  	tmp = 0.0;
                  	if (x <= -2.5e+25)
                  		tmp = t_0;
                  	elseif (x <= 4.8e+149)
                  		tmp = -z;
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / z), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -2.5e+25], t$95$0, If[LessEqual[x, 4.8e+149], (-z), t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \frac{x}{z} \cdot z\\
                  \mathbf{if}\;x \leq -2.5 \cdot 10^{+25}:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;x \leq 4.8 \cdot 10^{+149}:\\
                  \;\;\;\;-z\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -2.50000000000000012e25 or 4.80000000000000024e149 < 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 z around inf

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

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

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

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

                      \[\leadsto \frac{x}{z} \cdot z \]
                    7. Step-by-step derivation
                      1. Applied rewrites45.6%

                        \[\leadsto \frac{x}{z} \cdot z \]

                      if -2.50000000000000012e25 < x < 4.80000000000000024e149

                      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. lower-neg.f6429.2

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

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

                    Alternative 11: 30.0% accurate, 39.3× speedup?

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

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

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

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

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

                    Reproduce

                    ?
                    herbie shell --seed 2024263 
                    (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))