Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2

Percentage Accurate: 99.8% → 99.8%
Time: 11.6s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 90.0% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := y + \left(x - \left(y + 0.5\right) \cdot \log y\right)\\
\mathbf{if}\;t\_0 \leq -3.6 \cdot 10^{+127}:\\
\;\;\;\;y + \mathsf{fma}\left(\log y, -y, x\right)\\

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

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


\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) < -3.59999999999999979e127

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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. lower-fma.f64N/A

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

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

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

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

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

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := y + \left(x - \left(y + 0.5\right) \cdot \log y\right)\\
\mathbf{if}\;t\_0 \leq -3.6 \cdot 10^{+127}:\\
\;\;\;\;y + \mathsf{fma}\left(\log y, -y, x\right)\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+61}:\\
\;\;\;\;y - \mathsf{fma}\left(y, \log y, z\right)\\

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


\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) < -3.59999999999999979e127

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.59999999999999979e127 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -9.99999999999999949e60

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999949e60 < (+.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. *-commutativeN/A

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

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

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

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

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

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

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

Alternative 4: 79.8% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := y + \left(x - \left(y + 0.5\right) \cdot \log y\right)\\
\mathbf{if}\;t\_0 \leq -1000:\\
\;\;\;\;y - \mathsf{fma}\left(y, \log y, z\right)\\

\mathbf{elif}\;t\_0 \leq 10^{+29}:\\
\;\;\;\;\log y \cdot -0.5 - z\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y - \color{blue}{\mathsf{fma}\left(y, \log y, z\right)} \]
      18. lower-log.f6476.2

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

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

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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y - z} \]
    7. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y - z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
      4. lower-log.f6496.5

        \[\leadsto \color{blue}{\log y} \cdot -0.5 - z \]
    8. Applied rewrites96.5%

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

    if 9.99999999999999914e28 < (+.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 66.4% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 10^{+29}:\\
\;\;\;\;\log y \cdot -0.5 - z\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999981e149 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 9.99999999999999914e28

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y - z} \]
    7. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y - z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
      4. lower-log.f6477.6

        \[\leadsto \color{blue}{\log y} \cdot -0.5 - z \]
    8. Applied rewrites77.6%

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

    if 9.99999999999999914e28 < (+.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 66.4% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 10^{+29}:\\
\;\;\;\;\log y \cdot -0.5 - z\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -y, y\right)} \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

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

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

        \[\leadsto \color{blue}{y + \log y \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
      4. lift-neg.f64N/A

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

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

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

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

        \[\leadsto y - \color{blue}{y \cdot \log y} \]
      9. lower-*.f6465.8

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

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

    if -9.99999999999999981e149 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 9.99999999999999914e28

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y - z} \]
    7. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y - z} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} - z \]
      4. lower-log.f6477.6

        \[\leadsto \color{blue}{\log y} \cdot -0.5 - z \]
    8. Applied rewrites77.6%

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

    if 9.99999999999999914e28 < (+.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 54.7% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 260:\\
\;\;\;\;-z\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -y, y\right)} \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

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

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

        \[\leadsto \color{blue}{y + \log y \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
      4. lift-neg.f64N/A

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

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

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

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

        \[\leadsto y - \color{blue}{y \cdot \log y} \]
      9. lower-*.f6465.8

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

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

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

    1. Initial program 99.9%

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

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

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

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

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

    if 260 < (+.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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 46.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\frac{1}{x}}\\ \mathbf{if}\;x \leq -4.5 \cdot 10^{+123}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-175}:\\ \;\;\;\;-z\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-298}:\\ \;\;\;\;\log y \cdot -0.5\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+50}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ 1.0 (/ 1.0 x))))
   (if (<= x -4.5e+123)
     t_0
     (if (<= x -7e-175)
       (- z)
       (if (<= x -6e-298) (* (log y) -0.5) (if (<= x 1.4e+50) (- z) t_0))))))
double code(double x, double y, double z) {
	double t_0 = 1.0 / (1.0 / x);
	double tmp;
	if (x <= -4.5e+123) {
		tmp = t_0;
	} else if (x <= -7e-175) {
		tmp = -z;
	} else if (x <= -6e-298) {
		tmp = log(y) * -0.5;
	} else if (x <= 1.4e+50) {
		tmp = -z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 / (1.0d0 / x)
    if (x <= (-4.5d+123)) then
        tmp = t_0
    else if (x <= (-7d-175)) then
        tmp = -z
    else if (x <= (-6d-298)) then
        tmp = log(y) * (-0.5d0)
    else if (x <= 1.4d+50) then
        tmp = -z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 / (1.0 / x);
	double tmp;
	if (x <= -4.5e+123) {
		tmp = t_0;
	} else if (x <= -7e-175) {
		tmp = -z;
	} else if (x <= -6e-298) {
		tmp = Math.log(y) * -0.5;
	} else if (x <= 1.4e+50) {
		tmp = -z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 / (1.0 / x)
	tmp = 0
	if x <= -4.5e+123:
		tmp = t_0
	elif x <= -7e-175:
		tmp = -z
	elif x <= -6e-298:
		tmp = math.log(y) * -0.5
	elif x <= 1.4e+50:
		tmp = -z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 / Float64(1.0 / x))
	tmp = 0.0
	if (x <= -4.5e+123)
		tmp = t_0;
	elseif (x <= -7e-175)
		tmp = Float64(-z);
	elseif (x <= -6e-298)
		tmp = Float64(log(y) * -0.5);
	elseif (x <= 1.4e+50)
		tmp = Float64(-z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 / (1.0 / x);
	tmp = 0.0;
	if (x <= -4.5e+123)
		tmp = t_0;
	elseif (x <= -7e-175)
		tmp = -z;
	elseif (x <= -6e-298)
		tmp = log(y) * -0.5;
	elseif (x <= 1.4e+50)
		tmp = -z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e+123], t$95$0, If[LessEqual[x, -7e-175], (-z), If[LessEqual[x, -6e-298], N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 1.4e+50], (-z), t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\frac{1}{x}}\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+123}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -7 \cdot 10^{-175}:\\
\;\;\;\;-z\\

\mathbf{elif}\;x \leq -6 \cdot 10^{-298}:\\
\;\;\;\;\log y \cdot -0.5\\

\mathbf{elif}\;x \leq 1.4 \cdot 10^{+50}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.49999999999999983e123 or 1.3999999999999999e50 < 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. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. lower-/.f6473.0

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    7. Applied rewrites73.0%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]

    if -4.49999999999999983e123 < x < -6.99999999999999997e-175 or -5.9999999999999999e-298 < x < 1.3999999999999999e50

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

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

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

    if -6.99999999999999997e-175 < x < -5.9999999999999999e-298

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \color{blue}{\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) + y} \]
      3. distribute-rgt-neg-inN/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log y} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \color{blue}{\log y \cdot \frac{-1}{2}} \]
      3. lower-log.f6455.8

        \[\leadsto \color{blue}{\log y} \cdot -0.5 \]
    11. Applied rewrites55.8%

      \[\leadsto \color{blue}{\log y \cdot -0.5} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 61.2% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1e18 or 1.26000000000000001e83 < z

    1. Initial program 99.9%

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

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

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

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

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

    if -1e18 < z < 1.26000000000000001e83

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 88.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if 2.6999999999999998e122 < y

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y - \color{blue}{\mathsf{fma}\left(y, \log y, z\right)} \]
      18. lower-log.f6489.7

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

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

Alternative 11: 47.8% accurate, 3.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\frac{1}{x}}\\ \mathbf{if}\;x \leq -4.5 \cdot 10^{+123}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+50}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ 1.0 (/ 1.0 x))))
   (if (<= x -4.5e+123) t_0 (if (<= x 1.4e+50) (- z) t_0))))
double code(double x, double y, double z) {
	double t_0 = 1.0 / (1.0 / x);
	double tmp;
	if (x <= -4.5e+123) {
		tmp = t_0;
	} else if (x <= 1.4e+50) {
		tmp = -z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 / (1.0d0 / x)
    if (x <= (-4.5d+123)) then
        tmp = t_0
    else if (x <= 1.4d+50) then
        tmp = -z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 1.0 / (1.0 / x);
	double tmp;
	if (x <= -4.5e+123) {
		tmp = t_0;
	} else if (x <= 1.4e+50) {
		tmp = -z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 1.0 / (1.0 / x)
	tmp = 0
	if x <= -4.5e+123:
		tmp = t_0
	elif x <= 1.4e+50:
		tmp = -z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(1.0 / Float64(1.0 / x))
	tmp = 0.0
	if (x <= -4.5e+123)
		tmp = t_0;
	elseif (x <= 1.4e+50)
		tmp = Float64(-z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 1.0 / (1.0 / x);
	tmp = 0.0;
	if (x <= -4.5e+123)
		tmp = t_0;
	elseif (x <= 1.4e+50)
		tmp = -z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.5e+123], t$95$0, If[LessEqual[x, 1.4e+50], (-z), t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\frac{1}{x}}\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+123}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.4 \cdot 10^{+50}:\\
\;\;\;\;-z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.49999999999999983e123 or 1.3999999999999999e50 < 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. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. lower-/.f6473.0

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    7. Applied rewrites73.0%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]

    if -4.49999999999999983e123 < x < 1.3999999999999999e50

    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.f6439.3

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

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

Alternative 12: 30.4% 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.f6430.0

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

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

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

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

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

Reproduce

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