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

Percentage Accurate: 100.0% → 100.0%
Time: 5.3s
Alternatives: 8
Speedup: 1.2×

Specification

?
\[\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 8 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. Final simplification100.0%

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

Alternative 2: 98.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -16000000000 \lor \neg \left(y \leq 3800\right):\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -16000000000.0) (not (<= y 3800.0)))
   (* y (- x 0.5))
   (+ 0.918938533204673 (- (* x y) x))))
double code(double x, double y) {
	double tmp;
	if ((y <= -16000000000.0) || !(y <= 3800.0)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 + ((x * y) - x);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-16000000000.0d0)) .or. (.not. (y <= 3800.0d0))) then
        tmp = y * (x - 0.5d0)
    else
        tmp = 0.918938533204673d0 + ((x * y) - x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -16000000000.0) || !(y <= 3800.0)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 + ((x * y) - x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -16000000000.0) or not (y <= 3800.0):
		tmp = y * (x - 0.5)
	else:
		tmp = 0.918938533204673 + ((x * y) - x)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -16000000000.0) || !(y <= 3800.0))
		tmp = Float64(y * Float64(x - 0.5));
	else
		tmp = Float64(0.918938533204673 + Float64(Float64(x * y) - x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -16000000000.0) || ~((y <= 3800.0)))
		tmp = y * (x - 0.5);
	else
		tmp = 0.918938533204673 + ((x * y) - x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -16000000000.0], N[Not[LessEqual[y, 3800.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 + N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -16000000000 \lor \neg \left(y \leq 3800\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.6e10 or 3800 < y

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 99.1%

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

    if -1.6e10 < y < 3800

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{\left(0.918938533204673 + x \cdot \left(y - 1\right)\right) - 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + x \cdot \left(y - 1\right)\right) + \left(-0.5 \cdot y\right)} \]
      2. distribute-lft-out--100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(x \cdot y - x \cdot 1\right)}\right) + \left(-0.5 \cdot y\right) \]
      3. cancel-sign-sub-inv100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(x \cdot y + \left(-x\right) \cdot 1\right)}\right) + \left(-0.5 \cdot y\right) \]
      4. *-rgt-identity100.0%

        \[\leadsto \left(0.918938533204673 + \left(x \cdot y + \color{blue}{\left(-x\right)}\right)\right) + \left(-0.5 \cdot y\right) \]
      5. +-commutative100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(\left(-x\right) + x \cdot y\right)}\right) + \left(-0.5 \cdot y\right) \]
      6. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(\left(0.918938533204673 + \left(-x\right)\right) + x \cdot y\right)} + \left(-0.5 \cdot y\right) \]
      7. neg-mul-1100.0%

        \[\leadsto \left(\left(0.918938533204673 + \color{blue}{-1 \cdot x}\right) + x \cdot y\right) + \left(-0.5 \cdot y\right) \]
      8. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + -1 \cdot x\right) + \left(x \cdot y + \left(-0.5 \cdot y\right)\right)} \]
      9. distribute-lft-neg-in100.0%

        \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \left(x \cdot y + \color{blue}{\left(-0.5\right) \cdot y}\right) \]
      10. cancel-sign-sub-inv100.0%

        \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \color{blue}{\left(x \cdot y - 0.5 \cdot y\right)} \]
      11. distribute-rgt-out--100.0%

        \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \color{blue}{y \cdot \left(x - 0.5\right)} \]
      12. neg-mul-1100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(-x\right)}\right) + y \cdot \left(x - 0.5\right) \]
      13. associate-+r+100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(\left(-x\right) + y \cdot \left(x - 0.5\right)\right)} \]
      14. +-commutative100.0%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(y \cdot \left(x - 0.5\right) + \left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(y \cdot \left(x - 0.5\right) - x\right)} \]
      16. sub-neg100.0%

        \[\leadsto 0.918938533204673 + \left(y \cdot \color{blue}{\left(x + \left(-0.5\right)\right)} - x\right) \]
      17. metadata-eval100.0%

        \[\leadsto 0.918938533204673 + \left(y \cdot \left(x + \color{blue}{-0.5}\right) - x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 + \left(y \cdot \left(x + -0.5\right) - x\right)} \]
    8. Taylor expanded in x around inf 99.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -16000000000 \lor \neg \left(y \leq 3800\right):\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2200000000:\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{elif}\;y \leq 4900:\\ \;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y - y \cdot 0.5\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -2200000000.0)
   (* y (- x 0.5))
   (if (<= y 4900.0)
     (+ 0.918938533204673 (- (* x y) x))
     (- (* x y) (* y 0.5)))))
double code(double x, double y) {
	double tmp;
	if (y <= -2200000000.0) {
		tmp = y * (x - 0.5);
	} else if (y <= 4900.0) {
		tmp = 0.918938533204673 + ((x * y) - x);
	} else {
		tmp = (x * y) - (y * 0.5);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-2200000000.0d0)) then
        tmp = y * (x - 0.5d0)
    else if (y <= 4900.0d0) then
        tmp = 0.918938533204673d0 + ((x * y) - x)
    else
        tmp = (x * y) - (y * 0.5d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -2200000000.0) {
		tmp = y * (x - 0.5);
	} else if (y <= 4900.0) {
		tmp = 0.918938533204673 + ((x * y) - x);
	} else {
		tmp = (x * y) - (y * 0.5);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -2200000000.0:
		tmp = y * (x - 0.5)
	elif y <= 4900.0:
		tmp = 0.918938533204673 + ((x * y) - x)
	else:
		tmp = (x * y) - (y * 0.5)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -2200000000.0)
		tmp = Float64(y * Float64(x - 0.5));
	elseif (y <= 4900.0)
		tmp = Float64(0.918938533204673 + Float64(Float64(x * y) - x));
	else
		tmp = Float64(Float64(x * y) - Float64(y * 0.5));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -2200000000.0)
		tmp = y * (x - 0.5);
	elseif (y <= 4900.0)
		tmp = 0.918938533204673 + ((x * y) - x);
	else
		tmp = (x * y) - (y * 0.5);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -2200000000.0], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4900.0], N[(0.918938533204673 + N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2200000000:\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\

\mathbf{elif}\;y \leq 4900:\\
\;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot y - y \cdot 0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.2e9

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 99.7%

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

    if -2.2e9 < y < 4900

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{\left(0.918938533204673 + x \cdot \left(y - 1\right)\right) - 0.5 \cdot y} \]
    6. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + x \cdot \left(y - 1\right)\right) + \left(-0.5 \cdot y\right)} \]
      2. distribute-lft-out--100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(x \cdot y - x \cdot 1\right)}\right) + \left(-0.5 \cdot y\right) \]
      3. cancel-sign-sub-inv100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(x \cdot y + \left(-x\right) \cdot 1\right)}\right) + \left(-0.5 \cdot y\right) \]
      4. *-rgt-identity100.0%

        \[\leadsto \left(0.918938533204673 + \left(x \cdot y + \color{blue}{\left(-x\right)}\right)\right) + \left(-0.5 \cdot y\right) \]
      5. +-commutative100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(\left(-x\right) + x \cdot y\right)}\right) + \left(-0.5 \cdot y\right) \]
      6. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(\left(0.918938533204673 + \left(-x\right)\right) + x \cdot y\right)} + \left(-0.5 \cdot y\right) \]
      7. neg-mul-1100.0%

        \[\leadsto \left(\left(0.918938533204673 + \color{blue}{-1 \cdot x}\right) + x \cdot y\right) + \left(-0.5 \cdot y\right) \]
      8. associate-+r+100.0%

        \[\leadsto \color{blue}{\left(0.918938533204673 + -1 \cdot x\right) + \left(x \cdot y + \left(-0.5 \cdot y\right)\right)} \]
      9. distribute-lft-neg-in100.0%

        \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \left(x \cdot y + \color{blue}{\left(-0.5\right) \cdot y}\right) \]
      10. cancel-sign-sub-inv100.0%

        \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \color{blue}{\left(x \cdot y - 0.5 \cdot y\right)} \]
      11. distribute-rgt-out--100.0%

        \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \color{blue}{y \cdot \left(x - 0.5\right)} \]
      12. neg-mul-1100.0%

        \[\leadsto \left(0.918938533204673 + \color{blue}{\left(-x\right)}\right) + y \cdot \left(x - 0.5\right) \]
      13. associate-+r+100.0%

        \[\leadsto \color{blue}{0.918938533204673 + \left(\left(-x\right) + y \cdot \left(x - 0.5\right)\right)} \]
      14. +-commutative100.0%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(y \cdot \left(x - 0.5\right) + \left(-x\right)\right)} \]
      15. unsub-neg100.0%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(y \cdot \left(x - 0.5\right) - x\right)} \]
      16. sub-neg100.0%

        \[\leadsto 0.918938533204673 + \left(y \cdot \color{blue}{\left(x + \left(-0.5\right)\right)} - x\right) \]
      17. metadata-eval100.0%

        \[\leadsto 0.918938533204673 + \left(y \cdot \left(x + \color{blue}{-0.5}\right) - x\right) \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{0.918938533204673 + \left(y \cdot \left(x + -0.5\right) - x\right)} \]
    8. Taylor expanded in x around inf 99.4%

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

    if 4900 < y

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x \cdot y} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    6. Taylor expanded in y around inf 98.5%

      \[\leadsto x \cdot y - \color{blue}{0.5 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative98.5%

        \[\leadsto x \cdot y - \color{blue}{y \cdot 0.5} \]
    8. Simplified98.5%

      \[\leadsto x \cdot y - \color{blue}{y \cdot 0.5} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2200000000:\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{elif}\;y \leq 4900:\\ \;\;\;\;0.918938533204673 + \left(x \cdot y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y - y \cdot 0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.45 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -1.45) (not (<= y 1.0)))
   (* y (- x 0.5))
   (- 0.918938533204673 x)))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.45) || !(y <= 1.0)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-1.45d0)) .or. (.not. (y <= 1.0d0))) then
        tmp = y * (x - 0.5d0)
    else
        tmp = 0.918938533204673d0 - x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -1.45) || !(y <= 1.0)) {
		tmp = y * (x - 0.5);
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.45) or not (y <= 1.0):
		tmp = y * (x - 0.5)
	else:
		tmp = 0.918938533204673 - x
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.45) || !(y <= 1.0))
		tmp = Float64(y * Float64(x - 0.5));
	else
		tmp = Float64(0.918938533204673 - x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -1.45) || ~((y <= 1.0)))
		tmp = y * (x - 0.5);
	else
		tmp = 0.918938533204673 - x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -1.45], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\


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

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 96.8%

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

    if -1.44999999999999996 < y < 1

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{0.918938533204673 + -1 \cdot x} \]
    6. Step-by-step derivation
      1. neg-mul-198.5%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(-x\right)} \]
      2. unsub-neg98.5%

        \[\leadsto \color{blue}{0.918938533204673 - x} \]
    7. Simplified98.5%

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.45 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;y \cdot \left(x - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -850000000 \lor \neg \left(y \leq 1.4\right):\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -850000000.0) (not (<= y 1.4)))
   (* y -0.5)
   (- 0.918938533204673 x)))
double code(double x, double y) {
	double tmp;
	if ((y <= -850000000.0) || !(y <= 1.4)) {
		tmp = y * -0.5;
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-850000000.0d0)) .or. (.not. (y <= 1.4d0))) then
        tmp = y * (-0.5d0)
    else
        tmp = 0.918938533204673d0 - x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -850000000.0) || !(y <= 1.4)) {
		tmp = y * -0.5;
	} else {
		tmp = 0.918938533204673 - x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -850000000.0) or not (y <= 1.4):
		tmp = y * -0.5
	else:
		tmp = 0.918938533204673 - x
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -850000000.0) || !(y <= 1.4))
		tmp = Float64(y * -0.5);
	else
		tmp = Float64(0.918938533204673 - x);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -850000000.0) || ~((y <= 1.4)))
		tmp = y * -0.5;
	else
		tmp = 0.918938533204673 - x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -850000000.0], N[Not[LessEqual[y, 1.4]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -850000000 \lor \neg \left(y \leq 1.4\right):\\
\;\;\;\;y \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.5e8 or 1.3999999999999999 < y

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x \cdot y} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    6. Taylor expanded in y around inf 99.1%

      \[\leadsto x \cdot y - \color{blue}{0.5 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative99.1%

        \[\leadsto x \cdot y - \color{blue}{y \cdot 0.5} \]
    8. Simplified99.1%

      \[\leadsto x \cdot y - \color{blue}{y \cdot 0.5} \]
    9. Taylor expanded in x around 0 43.3%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    10. Step-by-step derivation
      1. *-commutative43.3%

        \[\leadsto \color{blue}{y \cdot -0.5} \]
    11. Simplified43.3%

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

    if -8.5e8 < y < 1.3999999999999999

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{0.918938533204673 + -1 \cdot x} \]
    6. Step-by-step derivation
      1. neg-mul-195.4%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(-x\right)} \]
      2. unsub-neg95.4%

        \[\leadsto \color{blue}{0.918938533204673 - x} \]
    7. Simplified95.4%

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -850000000 \lor \neg \left(y \leq 1.4\right):\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 49.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.85 \lor \neg \left(y \leq 1.85\right):\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -1.85) (not (<= y 1.85))) (* y -0.5) 0.918938533204673))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.85) || !(y <= 1.85)) {
		tmp = y * -0.5;
	} else {
		tmp = 0.918938533204673;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-1.85d0)) .or. (.not. (y <= 1.85d0))) then
        tmp = y * (-0.5d0)
    else
        tmp = 0.918938533204673d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -1.85) || !(y <= 1.85)) {
		tmp = y * -0.5;
	} else {
		tmp = 0.918938533204673;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.85) or not (y <= 1.85):
		tmp = y * -0.5
	else:
		tmp = 0.918938533204673
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.85) || !(y <= 1.85))
		tmp = Float64(y * -0.5);
	else
		tmp = 0.918938533204673;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -1.85) || ~((y <= 1.85)))
		tmp = y * -0.5;
	else
		tmp = 0.918938533204673;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -1.85], N[Not[LessEqual[y, 1.85]], $MachinePrecision]], N[(y * -0.5), $MachinePrecision], 0.918938533204673]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \lor \neg \left(y \leq 1.85\right):\\
\;\;\;\;y \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;0.918938533204673\\


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

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot \left(y + -1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 97.7%

      \[\leadsto \color{blue}{x \cdot y} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    6. Taylor expanded in y around inf 96.8%

      \[\leadsto x \cdot y - \color{blue}{0.5 \cdot y} \]
    7. Step-by-step derivation
      1. *-commutative96.8%

        \[\leadsto x \cdot y - \color{blue}{y \cdot 0.5} \]
    8. Simplified96.8%

      \[\leadsto x \cdot y - \color{blue}{y \cdot 0.5} \]
    9. Taylor expanded in x around 0 41.8%

      \[\leadsto \color{blue}{-0.5 \cdot y} \]
    10. Step-by-step derivation
      1. *-commutative41.8%

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

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

    if -1.8500000000000001 < y < 1.8500000000000001

    1. Initial program 100.0%

      \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
    2. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
      2. sub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
      3. metadata-eval100.0%

        \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. Simplified100.0%

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

      \[\leadsto \color{blue}{0.918938533204673 + -1 \cdot x} \]
    6. Step-by-step derivation
      1. neg-mul-198.5%

        \[\leadsto 0.918938533204673 + \color{blue}{\left(-x\right)} \]
      2. unsub-neg98.5%

        \[\leadsto \color{blue}{0.918938533204673 - x} \]
    7. Simplified98.5%

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
    8. Taylor expanded in x around 0 50.0%

      \[\leadsto \color{blue}{0.918938533204673} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.85 \lor \neg \left(y \leq 1.85\right):\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 100.0% accurate, 1.2× speedup?

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

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

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Step-by-step derivation
    1. associate-+l-100.0%

      \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    2. sub-neg100.0%

      \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. metadata-eval100.0%

      \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
  3. Simplified100.0%

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

    \[\leadsto \color{blue}{\left(0.918938533204673 + x \cdot \left(y - 1\right)\right) - 0.5 \cdot y} \]
  6. Step-by-step derivation
    1. sub-neg100.0%

      \[\leadsto \color{blue}{\left(0.918938533204673 + x \cdot \left(y - 1\right)\right) + \left(-0.5 \cdot y\right)} \]
    2. distribute-lft-out--100.0%

      \[\leadsto \left(0.918938533204673 + \color{blue}{\left(x \cdot y - x \cdot 1\right)}\right) + \left(-0.5 \cdot y\right) \]
    3. cancel-sign-sub-inv100.0%

      \[\leadsto \left(0.918938533204673 + \color{blue}{\left(x \cdot y + \left(-x\right) \cdot 1\right)}\right) + \left(-0.5 \cdot y\right) \]
    4. *-rgt-identity100.0%

      \[\leadsto \left(0.918938533204673 + \left(x \cdot y + \color{blue}{\left(-x\right)}\right)\right) + \left(-0.5 \cdot y\right) \]
    5. +-commutative100.0%

      \[\leadsto \left(0.918938533204673 + \color{blue}{\left(\left(-x\right) + x \cdot y\right)}\right) + \left(-0.5 \cdot y\right) \]
    6. associate-+r+100.0%

      \[\leadsto \color{blue}{\left(\left(0.918938533204673 + \left(-x\right)\right) + x \cdot y\right)} + \left(-0.5 \cdot y\right) \]
    7. neg-mul-1100.0%

      \[\leadsto \left(\left(0.918938533204673 + \color{blue}{-1 \cdot x}\right) + x \cdot y\right) + \left(-0.5 \cdot y\right) \]
    8. associate-+r+100.0%

      \[\leadsto \color{blue}{\left(0.918938533204673 + -1 \cdot x\right) + \left(x \cdot y + \left(-0.5 \cdot y\right)\right)} \]
    9. distribute-lft-neg-in100.0%

      \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \left(x \cdot y + \color{blue}{\left(-0.5\right) \cdot y}\right) \]
    10. cancel-sign-sub-inv100.0%

      \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \color{blue}{\left(x \cdot y - 0.5 \cdot y\right)} \]
    11. distribute-rgt-out--100.0%

      \[\leadsto \left(0.918938533204673 + -1 \cdot x\right) + \color{blue}{y \cdot \left(x - 0.5\right)} \]
    12. neg-mul-1100.0%

      \[\leadsto \left(0.918938533204673 + \color{blue}{\left(-x\right)}\right) + y \cdot \left(x - 0.5\right) \]
    13. associate-+r+100.0%

      \[\leadsto \color{blue}{0.918938533204673 + \left(\left(-x\right) + y \cdot \left(x - 0.5\right)\right)} \]
    14. +-commutative100.0%

      \[\leadsto 0.918938533204673 + \color{blue}{\left(y \cdot \left(x - 0.5\right) + \left(-x\right)\right)} \]
    15. unsub-neg100.0%

      \[\leadsto 0.918938533204673 + \color{blue}{\left(y \cdot \left(x - 0.5\right) - x\right)} \]
    16. sub-neg100.0%

      \[\leadsto 0.918938533204673 + \left(y \cdot \color{blue}{\left(x + \left(-0.5\right)\right)} - x\right) \]
    17. metadata-eval100.0%

      \[\leadsto 0.918938533204673 + \left(y \cdot \left(x + \color{blue}{-0.5}\right) - x\right) \]
  7. Simplified100.0%

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

Alternative 8: 26.1% accurate, 11.0× speedup?

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

\\
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. Step-by-step derivation
    1. associate-+l-100.0%

      \[\leadsto \color{blue}{x \cdot \left(y - 1\right) - \left(y \cdot 0.5 - 0.918938533204673\right)} \]
    2. sub-neg100.0%

      \[\leadsto x \cdot \color{blue}{\left(y + \left(-1\right)\right)} - \left(y \cdot 0.5 - 0.918938533204673\right) \]
    3. metadata-eval100.0%

      \[\leadsto x \cdot \left(y + \color{blue}{-1}\right) - \left(y \cdot 0.5 - 0.918938533204673\right) \]
  3. Simplified100.0%

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

    \[\leadsto \color{blue}{0.918938533204673 + -1 \cdot x} \]
  6. Step-by-step derivation
    1. neg-mul-152.6%

      \[\leadsto 0.918938533204673 + \color{blue}{\left(-x\right)} \]
    2. unsub-neg52.6%

      \[\leadsto \color{blue}{0.918938533204673 - x} \]
  7. Simplified52.6%

    \[\leadsto \color{blue}{0.918938533204673 - x} \]
  8. Taylor expanded in x around 0 27.2%

    \[\leadsto \color{blue}{0.918938533204673} \]
  9. Add Preprocessing

Reproduce

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