Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A

Percentage Accurate: 100.0% → 100.0%
Time: 1.5s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\mathsf{TRUE}\left(\right)\]
\[\begin{array}{l} \\ \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \end{array} \]
(FPCore (x y)
 :precision binary64
 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y):
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y)
	return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673)
end
function tmp = code(x, y)
	tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\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 7 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: 100.0% accurate, 1.0× speedup?

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

\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 55.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(y - 1\right)\\ t_1 := t\_0 - y \cdot 0.5\\ \mathbf{if}\;t\_1 \leq -1000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 0.0004:\\ \;\;\;\;\left(\left(y - 1\right) + 0.918938533204673\right) + 0.918938533204673\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (- y 1.0))) (t_1 (- t_0 (* y 0.5))))
   (if (<= t_1 -1000.0)
     t_0
     (if (<= t_1 0.0004)
       (+ (+ (- y 1.0) 0.918938533204673) 0.918938533204673)
       t_0))))
double code(double x, double y) {
	double t_0 = x * (y - 1.0);
	double t_1 = t_0 - (y * 0.5);
	double tmp;
	if (t_1 <= -1000.0) {
		tmp = t_0;
	} else if (t_1 <= 0.0004) {
		tmp = ((y - 1.0) + 0.918938533204673) + 0.918938533204673;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * (y - 1.0d0)
    t_1 = t_0 - (y * 0.5d0)
    if (t_1 <= (-1000.0d0)) then
        tmp = t_0
    else if (t_1 <= 0.0004d0) then
        tmp = ((y - 1.0d0) + 0.918938533204673d0) + 0.918938533204673d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x * (y - 1.0);
	double t_1 = t_0 - (y * 0.5);
	double tmp;
	if (t_1 <= -1000.0) {
		tmp = t_0;
	} else if (t_1 <= 0.0004) {
		tmp = ((y - 1.0) + 0.918938533204673) + 0.918938533204673;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x * (y - 1.0)
	t_1 = t_0 - (y * 0.5)
	tmp = 0
	if t_1 <= -1000.0:
		tmp = t_0
	elif t_1 <= 0.0004:
		tmp = ((y - 1.0) + 0.918938533204673) + 0.918938533204673
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x * Float64(y - 1.0))
	t_1 = Float64(t_0 - Float64(y * 0.5))
	tmp = 0.0
	if (t_1 <= -1000.0)
		tmp = t_0;
	elseif (t_1 <= 0.0004)
		tmp = Float64(Float64(Float64(y - 1.0) + 0.918938533204673) + 0.918938533204673);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x * (y - 1.0);
	t_1 = t_0 - (y * 0.5);
	tmp = 0.0;
	if (t_1 <= -1000.0)
		tmp = t_0;
	elseif (t_1 <= 0.0004)
		tmp = ((y - 1.0) + 0.918938533204673) + 0.918938533204673;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1000.0], t$95$0, If[LessEqual[t$95$1, 0.0004], N[(N[(N[(y - 1.0), $MachinePrecision] + 0.918938533204673), $MachinePrecision] + 0.918938533204673), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(y - 1\right)\\
t_1 := t\_0 - y \cdot 0.5\\
\mathbf{if}\;t\_1 \leq -1000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 0.0004:\\
\;\;\;\;\left(\left(y - 1\right) + 0.918938533204673\right) + 0.918938533204673\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(\frac{918938533204673}{1000000000000000} + x \cdot \left(y - 1\right)\right) - \frac{1}{2} \cdot y} \]
    4. Applied rewrites98.9%

      \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - y \cdot 0.5} \]
    5. Taylor expanded in x around 0

      \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
    6. Applied rewrites65.1%

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

    if -1e3 < (-.f64 (*.f64 x (-.f64 y #s(literal 1 binary64))) (*.f64 y #s(literal 1/2 binary64))) < 4.00000000000000019e-4

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} + \frac{918938533204673}{1000000000000000} \]
    4. Applied rewrites98.8%

      \[\leadsto \color{blue}{x \cdot \left(y - 1\right)} + 0.918938533204673 \]
    5. Taylor expanded in x around 0

      \[\leadsto x \cdot \color{blue}{\left(y - 1\right)} + \frac{918938533204673}{1000000000000000} \]
    6. Applied rewrites18.8%

      \[\leadsto \left(x \cdot \left(y - 1\right) + \color{blue}{0.918938533204673}\right) + 0.918938533204673 \]
    7. Taylor expanded in x around 0

      \[\leadsto \left(\left(x \cdot \left(y - 1\right) - \frac{1}{2} \cdot y\right) + \frac{918938533204673}{1000000000000000}\right) + \frac{918938533204673}{1000000000000000} \]
    8. Applied rewrites22.9%

      \[\leadsto \left(\left(y - 1\right) + 0.918938533204673\right) + 0.918938533204673 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 98.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(y - 1\right)\\
t_1 := t\_0 - y \cdot 0.5\\
\mathbf{if}\;y \leq -1.82:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 4.5 \cdot 10^{-6}:\\
\;\;\;\;t\_0 + 0.918938533204673\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.82000000000000006 or 4.50000000000000011e-6 < y

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(\frac{918938533204673}{1000000000000000} + x \cdot \left(y - 1\right)\right) - \frac{1}{2} \cdot y} \]
    4. Applied rewrites98.8%

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

    if -1.82000000000000006 < y < 4.50000000000000011e-6

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} + \frac{918938533204673}{1000000000000000} \]
    4. Applied rewrites99.4%

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

Alternative 4: 75.2% accurate, 1.7× speedup?

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

\\
x \cdot \left(y - 1\right) + 0.918938533204673
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \color{blue}{\frac{-1}{2} \cdot y} + \frac{918938533204673}{1000000000000000} \]
  4. Applied rewrites73.6%

    \[\leadsto \color{blue}{x \cdot \left(y - 1\right)} + 0.918938533204673 \]
  5. Add Preprocessing

Alternative 5: 51.0% accurate, 2.2× speedup?

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

\\
x \cdot \left(y - 1\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \color{blue}{\left(\frac{918938533204673}{1000000000000000} + x \cdot \left(y - 1\right)\right) - \frac{1}{2} \cdot y} \]
  4. Applied rewrites75.9%

    \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - y \cdot 0.5} \]
  5. Taylor expanded in x around 0

    \[\leadsto \frac{-1}{2} \cdot \color{blue}{y} \]
  6. Applied rewrites50.2%

    \[\leadsto x \cdot \color{blue}{\left(y - 1\right)} \]
  7. Add Preprocessing

Alternative 6: 2.6% accurate, 3.3× speedup?

\[\begin{array}{l} \\ y \cdot 0.5 \end{array} \]
(FPCore (x y) :precision binary64 (* y 0.5))
double code(double x, double y) {
	return y * 0.5;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = y * 0.5d0
end function
public static double code(double x, double y) {
	return y * 0.5;
}
def code(x, y):
	return y * 0.5
function code(x, y)
	return Float64(y * 0.5)
end
function tmp = code(x, y)
	tmp = y * 0.5;
end
code[x_, y_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}

\\
y \cdot 0.5
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \color{blue}{\left(\frac{918938533204673}{1000000000000000} + x \cdot \left(y - 1\right)\right) - \frac{1}{2} \cdot y} \]
  4. Applied rewrites75.9%

    \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - y \cdot 0.5} \]
  5. Taylor expanded in x around -inf

    \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \left(-1 \cdot \left(y - 1\right) + \frac{1}{2} \cdot \frac{y}{x}\right)\right)} \]
  6. Applied rewrites2.5%

    \[\leadsto y \cdot \color{blue}{0.5} \]
  7. Add Preprocessing

Alternative 7: 2.2% accurate, 5.0× speedup?

\[\begin{array}{l} \\ y - 1 \end{array} \]
(FPCore (x y) :precision binary64 (- y 1.0))
double code(double x, double y) {
	return y - 1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = y - 1.0d0
end function
public static double code(double x, double y) {
	return y - 1.0;
}
def code(x, y):
	return y - 1.0
function code(x, y)
	return Float64(y - 1.0)
end
function tmp = code(x, y)
	tmp = y - 1.0;
end
code[x_, y_] := N[(y - 1.0), $MachinePrecision]
\begin{array}{l}

\\
y - 1
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \color{blue}{\left(\frac{918938533204673}{1000000000000000} + x \cdot \left(y - 1\right)\right) - \frac{1}{2} \cdot y} \]
  4. Applied rewrites75.9%

    \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - y \cdot 0.5} \]
  5. Taylor expanded in x around 0

    \[\leadsto x \cdot \left(y - 1\right) - \color{blue}{\frac{1}{2} \cdot y} \]
  6. Applied rewrites2.1%

    \[\leadsto y - \color{blue}{1} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024321 
(FPCore (x y)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
  :precision binary64
  :pre (TRUE)
  (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))