Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.8%
Time: 7.5s
Alternatives: 10
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 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x - \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}
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. Add Preprocessing

Alternative 2: 72.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\ t_1 := \frac{-z}{x}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+142}:\\ \;\;\;\;\left(1 - \log y\right) \cdot y\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+19}:\\ \;\;\;\;t\_1 \cdot x + x\\ \mathbf{elif}\;t\_0 \leq 351.5:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (- x (* (+ y 0.5) (log y))) y)) (t_1 (/ (- z) x)))
   (if (<= t_0 -1e+142)
     (* (- 1.0 (log y)) y)
     (if (<= t_0 -1e+19)
       (+ (* t_1 x) x)
       (if (<= t_0 351.5) (fma -0.5 (log y) (- z)) (fma t_1 x x))))))
double code(double x, double y, double z) {
	double t_0 = (x - ((y + 0.5) * log(y))) + y;
	double t_1 = -z / x;
	double tmp;
	if (t_0 <= -1e+142) {
		tmp = (1.0 - log(y)) * y;
	} else if (t_0 <= -1e+19) {
		tmp = (t_1 * x) + x;
	} else if (t_0 <= 351.5) {
		tmp = fma(-0.5, log(y), -z);
	} else {
		tmp = fma(t_1, x, x);
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y)
	t_1 = Float64(Float64(-z) / x)
	tmp = 0.0
	if (t_0 <= -1e+142)
		tmp = Float64(Float64(1.0 - log(y)) * y);
	elseif (t_0 <= -1e+19)
		tmp = Float64(Float64(t_1 * x) + x);
	elseif (t_0 <= 351.5)
		tmp = fma(-0.5, log(y), Float64(-z));
	else
		tmp = fma(t_1, 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]}, Block[{t$95$1 = N[((-z) / x), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+142], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, -1e+19], N[(N[(t$95$1 * x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$0, 351.5], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision], N[(t$95$1 * x + x), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+19}:\\
\;\;\;\;t\_1 \cdot x + x\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, x, x\right)\\


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

    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.f6464.8

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

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

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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{-z}{x} \cdot x + \color{blue}{x} \]

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

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

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

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

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

            \[\leadsto y - \mathsf{fma}\left(0.5 + y, \color{blue}{\log y}, z\right) \]
        5. Applied rewrites98.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 rewrites94.5%

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

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 3: 69.3% accurate, 1.0× speedup?

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

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{-z}{x} \cdot x + \color{blue}{x} \]

                if -215 < x < 2.65e20

                1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

                  if 2.65e20 < x

                  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
                  5. Applied rewrites99.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 rewrites73.2%

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

                  Alternative 4: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                    if 9.50000000000000036e-8 < y

                    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

                  Alternative 5: 87.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 6: 87.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 7: 84.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                    if 6.79999999999999973e137 < 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(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.f6482.5

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

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

                  Alternative 8: 57.4% accurate, 3.7× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -250 \lor \neg \left(x \leq 2.65 \cdot 10^{+20}\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 -250.0) (not (<= x 2.65e+20))) (fma (/ (- z) x) x x) (- z)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((x <= -250.0) || !(x <= 2.65e+20)) {
                  		tmp = fma((-z / x), x, x);
                  	} else {
                  		tmp = -z;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((x <= -250.0) || !(x <= 2.65e+20))
                  		tmp = fma(Float64(Float64(-z) / x), x, x);
                  	else
                  		tmp = Float64(-z);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[x, -250.0], N[Not[LessEqual[x, 2.65e+20]], $MachinePrecision]], N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision], (-z)]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -250 \lor \neg \left(x \leq 2.65 \cdot 10^{+20}\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 < -250 or 2.65e20 < x

                    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
                    5. Applied rewrites99.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 rewrites76.5%

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

                      if -250 < x < 2.65e20

                      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.f6440.7

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

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

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

                    Alternative 9: 57.4% accurate, 3.7× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
                      5. Applied 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 rewrites78.9%

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

                            \[\leadsto \frac{-z}{x} \cdot x + \color{blue}{x} \]

                          if -250 < x < 2.65e20

                          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.f6440.7

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

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

                          if 2.65e20 < x

                          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - \left(z + \log y \cdot \left(\frac{1}{2} + y\right)\right)}{x}, x, x\right)} \]
                          5. Applied rewrites99.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 rewrites73.2%

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

                          Alternative 10: 30.1% 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.f6431.0

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

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