Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.9%
Time: 14.4s
Alternatives: 16
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 16 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} \\ \mathsf{fma}\left(-0.5 - y, \log y, x + \left(y - z\right)\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (- -0.5 y) (log y) (+ x (- y z))))
double code(double x, double y, double z) {
	return fma((-0.5 - y), log(y), (x + (y - z)));
}
function code(x, y, z)
	return fma(Float64(-0.5 - y), log(y), Float64(x + Float64(y - z)))
end
code[x_, y_, z_] := N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5 - y, \log y, x + \left(y - z\right)\right)
\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 \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
    3. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.43:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 0.429999999999999993

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.429999999999999993 < y

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.43:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x - z\right)\\

\mathbf{else}:\\
\;\;\;\;\left(y + \left(x - y \cdot \log y\right)\right) - z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 0.429999999999999993

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.429999999999999993 < y

    1. Initial program 99.7%

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

      \[\leadsto \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. lower-*.f64N/A

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

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

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

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

Alternative 4: 60.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+53}:\\
\;\;\;\;-z\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.79999999999999997e53 or 1.1e59 < z

    1. Initial program 99.9%

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

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

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

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

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

    if -3.79999999999999997e53 < z < 1.1e59

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 90.5% accurate, 1.0× speedup?

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

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 4.9999999999999999e119 < 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 \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
        3. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{2} - y, \log y, \color{blue}{y - z}\right) \]
      6. Step-by-step derivation
        1. lower--.f6491.5

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

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

    Alternative 6: 90.5% accurate, 1.0× speedup?

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

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 4.9999999999999999e119 < 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)} - z \]
      4. Step-by-step derivation
        1. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 89.7% accurate, 1.0× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

      if 1.9500000000000001e71 < 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 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. distribute-rgt-neg-inN/A

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

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

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

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

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

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

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

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

    Alternative 8: 42.0% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1900:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 260:\\ \;\;\;\;-0.5 \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z -1900.0) (- z) (if (<= z 260.0) (* -0.5 (log y)) (- z))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -1900.0) {
    		tmp = -z;
    	} else if (z <= 260.0) {
    		tmp = -0.5 * log(y);
    	} else {
    		tmp = -z;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8) :: tmp
        if (z <= (-1900.0d0)) then
            tmp = -z
        else if (z <= 260.0d0) then
            tmp = (-0.5d0) * log(y)
        else
            tmp = -z
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -1900.0) {
    		tmp = -z;
    	} else if (z <= 260.0) {
    		tmp = -0.5 * Math.log(y);
    	} else {
    		tmp = -z;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if z <= -1900.0:
    		tmp = -z
    	elif z <= 260.0:
    		tmp = -0.5 * math.log(y)
    	else:
    		tmp = -z
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= -1900.0)
    		tmp = Float64(-z);
    	elseif (z <= 260.0)
    		tmp = Float64(-0.5 * log(y));
    	else
    		tmp = Float64(-z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (z <= -1900.0)
    		tmp = -z;
    	elseif (z <= 260.0)
    		tmp = -0.5 * log(y);
    	else
    		tmp = -z;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[z, -1900.0], (-z), If[LessEqual[z, 260.0], N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision], (-z)]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -1900:\\
    \;\;\;\;-z\\
    
    \mathbf{elif}\;z \leq 260:\\
    \;\;\;\;-0.5 \cdot \log y\\
    
    \mathbf{else}:\\
    \;\;\;\;-z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -1900 or 260 < z

      1. Initial program 99.9%

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

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

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

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

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

      if -1900 < z < 260

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{-1}{2} \cdot \log y \]
        3. Step-by-step derivation
          1. Applied rewrites26.4%

            \[\leadsto -0.5 \cdot \log y \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 9: 89.7% accurate, 1.0× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

          if 1.9500000000000001e71 < y

          1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 10: 88.6% accurate, 1.0× speedup?

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

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

          if 1.2e131 < 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 z around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 11: 85.1% accurate, 1.0× speedup?

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

            1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

            if 6.9999999999999998e131 < y

            1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 12: 99.8% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \left(y + x\right) - \mathsf{fma}\left(y + 0.5, \log y, z\right) \end{array} \]
          (FPCore (x y z) :precision binary64 (- (+ y x) (fma (+ y 0.5) (log y) z)))
          double code(double x, double y, double z) {
          	return (y + x) - fma((y + 0.5), log(y), z);
          }
          
          function code(x, y, z)
          	return Float64(Float64(y + x) - fma(Float64(y + 0.5), log(y), z))
          end
          
          code[x_, y_, z_] := N[(N[(y + x), $MachinePrecision] - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \left(y + x\right) - \mathsf{fma}\left(y + 0.5, \log y, z\right)
          \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 \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
            3. +-commutativeN/A

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

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

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

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

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

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

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

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

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

          Alternative 13: 99.8% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \left(y - z\right) + \mathsf{fma}\left(\log y, -0.5 - y, x\right) \end{array} \]
          (FPCore (x y z) :precision binary64 (+ (- y z) (fma (log y) (- -0.5 y) x)))
          double code(double x, double y, double z) {
          	return (y - z) + fma(log(y), (-0.5 - y), x);
          }
          
          function code(x, y, z)
          	return Float64(Float64(y - z) + fma(log(y), Float64(-0.5 - y), x))
          end
          
          code[x_, y_, z_] := N[(N[(y - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \left(y - z\right) + \mathsf{fma}\left(\log y, -0.5 - y, x\right)
          \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 \color{blue}{\left(\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right) + y\right)} - z \]
            3. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 14: 61.3% accurate, 1.0× speedup?

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

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 1.9500000000000001e71 < y

              1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 15: 61.3% accurate, 1.0× speedup?

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

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 1.9500000000000001e71 < 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 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.f6421.5

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

                  \[\leadsto \color{blue}{-z} \]
                6. Taylor expanded in y around inf

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{y \cdot 1 - y \cdot \log y} \]
                  8. *-rgt-identityN/A

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

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

                    \[\leadsto y - \color{blue}{y \cdot \log y} \]
                  11. lower-log.f6466.3

                    \[\leadsto y - y \cdot \color{blue}{\log y} \]
                8. Applied rewrites66.3%

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

              Alternative 16: 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.f6427.0

                  \[\leadsto \color{blue}{-z} \]
              5. Applied rewrites27.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 2024220 
              (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))