Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

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

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
\left(\left(x - \log y \cdot \left(0.5 + y\right)\right) + y\right) - z
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z \]
  2. Add Preprocessing
  3. Final simplification99.8%

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

Alternative 2: 72.7% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+45}:\\
\;\;\;\;y - \log y \cdot y\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
    6. Step-by-step derivation
      1. lower-/.f6484.5

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

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

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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 72.8% accurate, 0.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\frac{1}{\frac{1}{x}} + y\right) - z\\ t_1 := \left(x - \log y \cdot \left(0.5 + y\right)\right) + y\\ t_2 := \left(1 - \log y\right) \cdot y\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+186}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+120}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+45}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 350:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (- (+ (/ 1.0 (/ 1.0 x)) y) z))
              (t_1 (+ (- x (* (log y) (+ 0.5 y))) y))
              (t_2 (* (- 1.0 (log y)) y)))
         (if (<= t_1 -2e+186)
           t_2
           (if (<= t_1 -2e+120)
             t_0
             (if (<= t_1 -2e+45)
               t_2
               (if (<= t_1 350.0) (fma -0.5 (log y) (- z)) t_0))))))
      double code(double x, double y, double z) {
      	double t_0 = ((1.0 / (1.0 / x)) + y) - z;
      	double t_1 = (x - (log(y) * (0.5 + y))) + y;
      	double t_2 = (1.0 - log(y)) * y;
      	double tmp;
      	if (t_1 <= -2e+186) {
      		tmp = t_2;
      	} else if (t_1 <= -2e+120) {
      		tmp = t_0;
      	} else if (t_1 <= -2e+45) {
      		tmp = t_2;
      	} else if (t_1 <= 350.0) {
      		tmp = fma(-0.5, log(y), -z);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(Float64(Float64(1.0 / Float64(1.0 / x)) + y) - z)
      	t_1 = Float64(Float64(x - Float64(log(y) * Float64(0.5 + y))) + y)
      	t_2 = Float64(Float64(1.0 - log(y)) * y)
      	tmp = 0.0
      	if (t_1 <= -2e+186)
      		tmp = t_2;
      	elseif (t_1 <= -2e+120)
      		tmp = t_0;
      	elseif (t_1 <= -2e+45)
      		tmp = t_2;
      	elseif (t_1 <= 350.0)
      		tmp = fma(-0.5, log(y), Float64(-z));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(0.5 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+186], t$95$2, If[LessEqual[t$95$1, -2e+120], t$95$0, If[LessEqual[t$95$1, -2e+45], t$95$2, If[LessEqual[t$95$1, 350.0], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision], t$95$0]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \left(\frac{1}{\frac{1}{x}} + y\right) - z\\
      t_1 := \left(x - \log y \cdot \left(0.5 + y\right)\right) + y\\
      t_2 := \left(1 - \log y\right) \cdot y\\
      \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+186}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+120}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+45}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq 350:\\
      \;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1.99999999999999996e186 or -2e120 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1.9999999999999999e45

        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
        6. Step-by-step derivation
          1. lower-/.f6484.5

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

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

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

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 4: 68.7% accurate, 0.3× speedup?

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

          1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
          6. Step-by-step derivation
            1. lower-/.f6464.0

              \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
          7. Applied rewrites64.0%

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

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto -0.5 \cdot \log y \]
            4. Recombined 2 regimes into one program.
            5. Final simplification68.1%

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

            Alternative 5: 99.0% accurate, 0.5× speedup?

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

              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 \left(\color{blue}{\left(x - \left(y + \frac{1}{2}\right) \cdot \log y\right)} + y\right) - z \]
                3. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

            Alternative 6: 88.9% accurate, 0.9× speedup?

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

              1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

              if -2.60000000000000003e65 < x < 5.00000000000000029e83

              1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

              if 5.00000000000000029e83 < x

              1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 7: 69.7% accurate, 1.0× speedup?

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

                1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -4.2999999999999999e23 < x < 1950

                1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

                Alternative 8: 70.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
                  6. Step-by-step derivation
                    1. lower-/.f6477.4

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

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

                  if -8e4 < z < 4e6

                  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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5 - y, \log y, 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 rewrites61.0%

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

                  Alternative 9: 89.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 10: 89.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 11: 84.1% accurate, 1.0× speedup?

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

                      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

                      if 1.06e124 < y

                      1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

                    Alternative 12: 99.9% accurate, 1.0× speedup?

                    \[\begin{array}{l} \\ \left(\mathsf{fma}\left(-0.5 - y, \log y, y\right) + x\right) - z \end{array} \]
                    (FPCore (x y z) :precision binary64 (- (+ (fma (- -0.5 y) (log y) y) x) z))
                    double code(double x, double y, double z) {
                    	return (fma((-0.5 - y), log(y), y) + x) - z;
                    }
                    
                    function code(x, y, z)
                    	return Float64(Float64(fma(Float64(-0.5 - y), log(y), y) + x) - z)
                    end
                    
                    code[x_, y_, z_] := N[(N[(N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \left(\mathsf{fma}\left(-0.5 - y, \log y, y\right) + x\right) - z
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 13: 57.0% accurate, 4.1× speedup?

                    \[\begin{array}{l} \\ \left(\frac{1}{\frac{1}{x}} + y\right) - z \end{array} \]
                    (FPCore (x y z) :precision binary64 (- (+ (/ 1.0 (/ 1.0 x)) y) z))
                    double code(double x, double y, double z) {
                    	return ((1.0 / (1.0 / x)) + 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 = ((1.0d0 / (1.0d0 / x)) + y) - z
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	return ((1.0 / (1.0 / x)) + y) - z;
                    }
                    
                    def code(x, y, z):
                    	return ((1.0 / (1.0 / x)) + y) - z
                    
                    function code(x, y, z)
                    	return Float64(Float64(Float64(1.0 / Float64(1.0 / x)) + y) - z)
                    end
                    
                    function tmp = code(x, y, z)
                    	tmp = ((1.0 / (1.0 / x)) + y) - z;
                    end
                    
                    code[x_, y_, z_] := N[(N[(N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    \left(\frac{1}{\frac{1}{x}} + y\right) - z
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
                    6. Step-by-step derivation
                      1. lower-/.f6456.2

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

                      \[\leadsto \left(\frac{1}{\color{blue}{\frac{1}{x}}} + y\right) - z \]
                    8. Add Preprocessing

                    Alternative 14: 29.9% accurate, 39.3× speedup?

                    \[\begin{array}{l} \\ -z \end{array} \]
                    (FPCore (x y z) :precision binary64 (- z))
                    double code(double x, double y, double z) {
                    	return -z;
                    }
                    
                    real(8) function code(x, y, z)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        code = -z
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	return -z;
                    }
                    
                    def code(x, y, z):
                    	return -z
                    
                    function code(x, y, z)
                    	return Float64(-z)
                    end
                    
                    function tmp = code(x, y, z)
                    	tmp = -z;
                    end
                    
                    code[x_, y_, z_] := (-z)
                    
                    \begin{array}{l}
                    
                    \\
                    -z
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.8%

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

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

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

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

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