Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 8.4s
Alternatives: 12
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 12 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(Float64(-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. lift-+.f64N/A

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

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

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

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

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

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

      \[\leadsto \left(x + \left(\color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right) \cdot \log y\right)\right)} + y\right)\right) - z \]
    8. *-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 \]
    9. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

Alternative 2: 72.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+61}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \mathbf{elif}\;t\_0 \leq 340:\\ \;\;\;\;-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 (* (+ y 0.5) (log y))) y)))
   (if (<= t_0 -5e+61)
     (* (- 1.0 (log y)) y)
     (if (<= t_0 340.0) (- (* -0.5 (log y)) z) (fma (/ (- z) x) x x)))))
double code(double x, double y, double z) {
	double t_0 = (x - ((y + 0.5) * log(y))) + y;
	double tmp;
	if (t_0 <= -5e+61) {
		tmp = (1.0 - log(y)) * y;
	} else if (t_0 <= 340.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(Float64(y + 0.5) * log(y))) + y)
	tmp = 0.0
	if (t_0 <= -5e+61)
		tmp = Float64(Float64(1.0 - log(y)) * y);
	elseif (t_0 <= 340.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[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+61], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 340.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 - \left(y + 0.5\right) \cdot \log y\right) + y\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+61}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\

\mathbf{elif}\;t\_0 \leq 340:\\
\;\;\;\;-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) < -5.00000000000000018e61

    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. *-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.f6455.1

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 340 < (+.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. div-add-revN/A

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

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

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

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

          \[\leadsto \frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x} \cdot x + \color{blue}{x} \]
        7. 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.8%

        \[\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(-1 \cdot \frac{z}{x}, x, x\right) \]
      7. Step-by-step derivation
        1. Applied rewrites99.4%

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

      Alternative 3: 70.4% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\ \mathbf{if}\;x \leq -240000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-144}:\\ \;\;\;\;-0.5 \cdot \log y - z\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-24}:\\ \;\;\;\;\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 -240000.0)
           t_0
           (if (<= x -2.6e-144)
             (- (* -0.5 (log y)) z)
             (if (<= x 2.6e-24) (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 <= -240000.0) {
      		tmp = t_0;
      	} else if (x <= -2.6e-144) {
      		tmp = (-0.5 * log(y)) - z;
      	} else if (x <= 2.6e-24) {
      		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 <= -240000.0)
      		tmp = t_0;
      	elseif (x <= -2.6e-144)
      		tmp = Float64(Float64(-0.5 * log(y)) - z);
      	elseif (x <= 2.6e-24)
      		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, -240000.0], t$95$0, If[LessEqual[x, -2.6e-144], N[(N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[x, 2.6e-24], 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 -240000:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq -2.6 \cdot 10^{-144}:\\
      \;\;\;\;-0.5 \cdot \log y - z\\
      
      \mathbf{elif}\;x \leq 2.6 \cdot 10^{-24}:\\
      \;\;\;\;\mathsf{fma}\left(\log y, -0.5 - y, y\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if x < -2.4e5 or 2.6e-24 < x

        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 \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. div-add-revN/A

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

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

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

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

            \[\leadsto \frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x} \cdot x + \color{blue}{x} \]
          7. 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.8%

          \[\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(-1 \cdot \frac{z}{x}, x, x\right) \]
        7. Step-by-step derivation
          1. Applied rewrites79.0%

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

          if -2.4e5 < x < -2.6000000000000001e-144

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

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

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

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

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

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

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

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

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

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

            if -2.6000000000000001e-144 < x < 2.6e-24

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 89.1% accurate, 0.9× speedup?

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

                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 rewrites65.9%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(-0.5, \log y, x\right) - z}{y} - \log y, 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 rewrites42.9%

                    \[\leadsto \mathsf{fma}\left(\frac{x}{y}, y, y\right) \]
                  2. Taylor expanded in z around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if -3.8000000000000001e90 < x < 5.49999999999999966e27

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

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

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

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

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

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

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

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

                    if 5.49999999999999966e27 < 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 y around 0

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

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

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

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

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

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

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

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

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

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

                  Alternative 5: 70.4% accurate, 1.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -240000 \lor \neg \left(x \leq 4.4 \cdot 10^{+16}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \log y - z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (or (<= x -240000.0) (not (<= x 4.4e+16)))
                     (fma (/ (- z) x) x x)
                     (- (* -0.5 (log y)) z)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((x <= -240000.0) || !(x <= 4.4e+16)) {
                  		tmp = fma((-z / x), x, x);
                  	} else {
                  		tmp = (-0.5 * log(y)) - z;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((x <= -240000.0) || !(x <= 4.4e+16))
                  		tmp = fma(Float64(Float64(-z) / x), x, x);
                  	else
                  		tmp = Float64(Float64(-0.5 * log(y)) - z);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[x, -240000.0], N[Not[LessEqual[x, 4.4e+16]], $MachinePrecision]], N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision], N[(N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -240000 \lor \neg \left(x \leq 4.4 \cdot 10^{+16}\right):\\
                  \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;-0.5 \cdot \log y - z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -2.4e5 or 4.4e16 < x

                    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 \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. div-add-revN/A

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

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

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

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

                        \[\leadsto \frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x} \cdot x + \color{blue}{x} \]
                      7. 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.8%

                      \[\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(-1 \cdot \frac{z}{x}, x, x\right) \]
                    7. Step-by-step derivation
                      1. Applied rewrites79.6%

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

                      if -2.4e5 < x < 4.4e16

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

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

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

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

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

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

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

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

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

                          \[\leadsto -0.5 \cdot \log y - \color{blue}{z} \]
                      8. Recombined 2 regimes into one program.
                      9. Final simplification68.5%

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

                      Alternative 6: 99.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

                        if 0.0379999999999999991 < y

                        1. Initial program 99.5%

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

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

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

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

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

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

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

                            \[\leadsto \left(x + \left(\color{blue}{\left(\mathsf{neg}\left(\left(y + \frac{1}{2}\right) \cdot \log y\right)\right)} + y\right)\right) - z \]
                          8. *-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 \]
                          9. distribute-lft-neg-inN/A

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

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

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

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

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

                            \[\leadsto \left(x + \mathsf{fma}\left(-\log y, \color{blue}{0.5 + y}, y\right)\right) - z \]
                        4. Applied rewrites99.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. *-commutativeN/A

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

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

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

                            \[\leadsto \left(x + \left(1 + \color{blue}{-1 \cdot \log y}\right) \cdot y\right) - z \]
                          5. fp-cancel-sign-sub-invN/A

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

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

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

                            \[\leadsto \left(x + \color{blue}{\left(1 - \log y\right)} \cdot y\right) - z \]
                          9. lower-log.f6498.7

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

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

                      Alternative 7: 89.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

                        if 6.79999999999999948e-7 < y

                        1. Initial program 99.5%

                          \[\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 rewrites99.7%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(-0.5, \log y, x\right) - z}{y} - \log y, 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 rewrites21.3%

                            \[\leadsto \mathsf{fma}\left(\frac{x}{y}, y, y\right) \]
                          2. Taylor expanded in z around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -0.5 - y, y + x\right)} \]
                          5. Step-by-step derivation
                            1. Applied rewrites81.2%

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

                          Alternative 8: 90.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

                            if 2.3000000000000001e38 < y

                            1. Initial program 99.5%

                              \[\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 rewrites99.6%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(-0.5, \log y, x\right) - z}{y} - \log y, 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 rewrites15.3%

                                \[\leadsto \mathsf{fma}\left(\frac{x}{y}, y, y\right) \]
                              2. Taylor expanded in z around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              Alternative 9: 84.5% accurate, 1.0× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 9.5 \cdot 10^{+127}:\\ \;\;\;\;\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 9.5e+127) (- (fma -0.5 (log y) x) z) (* (- 1.0 (log y)) y)))
                              double code(double x, double y, double z) {
                              	double tmp;
                              	if (y <= 9.5e+127) {
                              		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 <= 9.5e+127)
                              		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, 9.5e+127], 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 9.5 \cdot 10^{+127}:\\
                              \;\;\;\;\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 < 9.49999999999999975e127

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

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

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

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

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

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

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

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

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

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

                                if 9.49999999999999975e127 < y

                                1. Initial program 99.4%

                                  \[\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.f6479.5

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

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

                              Alternative 10: 57.4% accurate, 3.7× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{-8} \lor \neg \left(x \leq 4.4 \cdot 10^{+16}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
                              (FPCore (x y z)
                               :precision binary64
                               (if (or (<= x -8.5e-8) (not (<= x 4.4e+16))) (fma (/ (- z) x) x x) (- z)))
                              double code(double x, double y, double z) {
                              	double tmp;
                              	if ((x <= -8.5e-8) || !(x <= 4.4e+16)) {
                              		tmp = fma((-z / x), x, x);
                              	} else {
                              		tmp = -z;
                              	}
                              	return tmp;
                              }
                              
                              function code(x, y, z)
                              	tmp = 0.0
                              	if ((x <= -8.5e-8) || !(x <= 4.4e+16))
                              		tmp = fma(Float64(Float64(-z) / x), x, x);
                              	else
                              		tmp = Float64(-z);
                              	end
                              	return tmp
                              end
                              
                              code[x_, y_, z_] := If[Or[LessEqual[x, -8.5e-8], N[Not[LessEqual[x, 4.4e+16]], $MachinePrecision]], N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision], (-z)]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;x \leq -8.5 \cdot 10^{-8} \lor \neg \left(x \leq 4.4 \cdot 10^{+16}\right):\\
                              \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;-z\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if x < -8.49999999999999935e-8 or 4.4e16 < x

                                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 \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. div-add-revN/A

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

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

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

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

                                    \[\leadsto \frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x} \cdot x + \color{blue}{x} \]
                                  7. 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.8%

                                  \[\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(-1 \cdot \frac{z}{x}, x, x\right) \]
                                7. Step-by-step derivation
                                  1. Applied rewrites79.0%

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

                                  if -8.49999999999999935e-8 < x < 4.4e16

                                  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 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.f6436.0

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

                                    \[\leadsto \color{blue}{-z} \]
                                8. Recombined 2 regimes into one program.
                                9. Final simplification56.7%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{-8} \lor \neg \left(x \leq 4.4 \cdot 10^{+16}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
                                10. Add Preprocessing

                                Alternative 11: 41.5% accurate, 3.9× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{+58} \lor \neg \left(z \leq 2.25 \cdot 10^{+23}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, y, y\right)\\ \end{array} \end{array} \]
                                (FPCore (x y z)
                                 :precision binary64
                                 (if (or (<= z -8.8e+58) (not (<= z 2.25e+23))) (- z) (fma (/ x y) y y)))
                                double code(double x, double y, double z) {
                                	double tmp;
                                	if ((z <= -8.8e+58) || !(z <= 2.25e+23)) {
                                		tmp = -z;
                                	} else {
                                		tmp = fma((x / y), y, y);
                                	}
                                	return tmp;
                                }
                                
                                function code(x, y, z)
                                	tmp = 0.0
                                	if ((z <= -8.8e+58) || !(z <= 2.25e+23))
                                		tmp = Float64(-z);
                                	else
                                		tmp = fma(Float64(x / y), y, y);
                                	end
                                	return tmp
                                end
                                
                                code[x_, y_, z_] := If[Or[LessEqual[z, -8.8e+58], N[Not[LessEqual[z, 2.25e+23]], $MachinePrecision]], (-z), N[(N[(x / y), $MachinePrecision] * y + y), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;z \leq -8.8 \cdot 10^{+58} \lor \neg \left(z \leq 2.25 \cdot 10^{+23}\right):\\
                                \;\;\;\;-z\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, y, y\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if z < -8.8000000000000003e58 or 2.2499999999999999e23 < 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 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.f6463.7

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

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

                                  if -8.8000000000000003e58 < z < 2.2499999999999999e23

                                  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(\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 rewrites88.0%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(-0.5, \log y, x\right) - z}{y} - \log y, 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 rewrites28.1%

                                      \[\leadsto \mathsf{fma}\left(\frac{x}{y}, y, y\right) \]
                                  8. Recombined 2 regimes into one program.
                                  9. Final simplification43.6%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{+58} \lor \neg \left(z \leq 2.25 \cdot 10^{+23}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, y, y\right)\\ \end{array} \]
                                  10. Add Preprocessing

                                  Alternative 12: 29.7% 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.f6429.5

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

                                    \[\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 2024343 
                                  (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))