Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2

Percentage Accurate: 99.6% → 99.3%
Time: 20.5s
Alternatives: 12
Speedup: N/A×

Specification

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

\\
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t
\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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (- (+ (log y) (+ (log z) (* (log t) (- a 0.5)))) t))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	return (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (log(y) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	return (Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	return (math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
x, y = sort([x, y])
function code(x, y, z, t, a)
	return Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
	tmp = (log(y) + (log(z) + (log(t) * (a - 0.5)))) - t;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t
\end{array}
Derivation
  1. Initial program 99.5%

    \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
  2. Step-by-step derivation
    1. associate--l+99.5%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
    2. sub-neg99.5%

      \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
    3. metadata-eval99.5%

      \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
  3. Simplified99.5%

    \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
  4. Taylor expanded in x around 0 69.3%

    \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
  5. Final simplification69.3%

    \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t \]

Alternative 2: 97.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log y + \log z\right) - \left(t + \log t \cdot 0.5\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= (- a 0.5) -1e+18) (not (<= (- a 0.5) -0.4)))
   (- (* (log t) a) t)
   (- (+ (log y) (log z)) (+ t (* (log t) 0.5)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
		tmp = (log(t) * a) - t;
	} else {
		tmp = (log(y) + log(z)) - (t + (log(t) * 0.5));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (((a - 0.5d0) <= (-1d+18)) .or. (.not. ((a - 0.5d0) <= (-0.4d0)))) then
        tmp = (log(t) * a) - t
    else
        tmp = (log(y) + log(z)) - (t + (log(t) * 0.5d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
		tmp = (Math.log(t) * a) - t;
	} else {
		tmp = (Math.log(y) + Math.log(z)) - (t + (Math.log(t) * 0.5));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if ((a - 0.5) <= -1e+18) or not ((a - 0.5) <= -0.4):
		tmp = (math.log(t) * a) - t
	else:
		tmp = (math.log(y) + math.log(z)) - (t + (math.log(t) * 0.5))
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((Float64(a - 0.5) <= -1e+18) || !(Float64(a - 0.5) <= -0.4))
		tmp = Float64(Float64(log(t) * a) - t);
	else
		tmp = Float64(Float64(log(y) + log(z)) - Float64(t + Float64(log(t) * 0.5)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (((a - 0.5) <= -1e+18) || ~(((a - 0.5) <= -0.4)))
		tmp = (log(t) * a) - t;
	else
		tmp = (log(y) + log(z)) - (t + (log(t) * 0.5));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -1e+18], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.4]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(t + N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;\log t \cdot a - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 a 1/2) < -1e18 or -0.40000000000000002 < (-.f64 a 1/2)

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.6%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.6%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.6%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 74.7%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 98.8%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative98.8%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified98.8%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]

    if -1e18 < (-.f64 a 1/2) < -0.40000000000000002

    1. Initial program 99.4%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.4%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.4%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.4%

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

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.4%

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

      \[\leadsto \color{blue}{\left(\log y + \log z\right) - \left(t + \log t \cdot \left(0.5 - a\right)\right)} \]
    5. Taylor expanded in a around 0 64.2%

      \[\leadsto \left(\log y + \log z\right) - \left(t + \color{blue}{0.5 \cdot \log t}\right) \]
    6. Step-by-step derivation
      1. *-commutative47.5%

        \[\leadsto \left(\log \left(z \cdot y\right) - \color{blue}{\log t \cdot 0.5}\right) - t \]
    7. Simplified64.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log y + \log z\right) - \left(t + \log t \cdot 0.5\right)\\ \end{array} \]

Alternative 3: 97.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= (- a 0.5) -1e+18) (not (<= (- a 0.5) -0.4)))
   (- (* (log t) a) t)
   (- (+ (log y) (+ (log z) (* (log t) -0.5))) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
		tmp = (log(t) * a) - t;
	} else {
		tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (((a - 0.5d0) <= (-1d+18)) .or. (.not. ((a - 0.5d0) <= (-0.4d0)))) then
        tmp = (log(t) * a) - t
    else
        tmp = (log(y) + (log(z) + (log(t) * (-0.5d0)))) - t
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (((a - 0.5) <= -1e+18) || !((a - 0.5) <= -0.4)) {
		tmp = (Math.log(t) * a) - t;
	} else {
		tmp = (Math.log(y) + (Math.log(z) + (Math.log(t) * -0.5))) - t;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if ((a - 0.5) <= -1e+18) or not ((a - 0.5) <= -0.4):
		tmp = (math.log(t) * a) - t
	else:
		tmp = (math.log(y) + (math.log(z) + (math.log(t) * -0.5))) - t
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((Float64(a - 0.5) <= -1e+18) || !(Float64(a - 0.5) <= -0.4))
		tmp = Float64(Float64(log(t) * a) - t);
	else
		tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * -0.5))) - t);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (((a - 0.5) <= -1e+18) || ~(((a - 0.5) <= -0.4)))
		tmp = (log(t) * a) - t;
	else
		tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -1e+18], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.4]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\
\;\;\;\;\log t \cdot a - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 a 1/2) < -1e18 or -0.40000000000000002 < (-.f64 a 1/2)

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.6%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.6%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.6%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 74.7%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 98.8%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative98.8%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified98.8%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]

    if -1e18 < (-.f64 a 1/2) < -0.40000000000000002

    1. Initial program 99.4%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.4%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.4%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.4%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 64.3%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around 0 64.3%

      \[\leadsto \left(\log y + \left(\log z + \color{blue}{-0.5 \cdot \log t}\right)\right) - t \]
    6. Step-by-step derivation
      1. *-commutative64.3%

        \[\leadsto \left(\log y + \left(\log z + \color{blue}{\log t \cdot -0.5}\right)\right) - t \]
    7. Simplified64.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -1 \cdot 10^{+18} \lor \neg \left(a - 0.5 \leq -0.4\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\ \end{array} \]

Alternative 4: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 490:\\ \;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a - t\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= t 490.0)
   (+ (log y) (+ (log z) (* (log t) (- a 0.5))))
   (- (* (log t) a) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 490.0) {
		tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
	} else {
		tmp = (log(t) * a) - t;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= 490.0d0) then
        tmp = log(y) + (log(z) + (log(t) * (a - 0.5d0)))
    else
        tmp = (log(t) * a) - t
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 490.0) {
		tmp = Math.log(y) + (Math.log(z) + (Math.log(t) * (a - 0.5)));
	} else {
		tmp = (Math.log(t) * a) - t;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if t <= 490.0:
		tmp = math.log(y) + (math.log(z) + (math.log(t) * (a - 0.5)))
	else:
		tmp = (math.log(t) * a) - t
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 490.0)
		tmp = Float64(log(y) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5))));
	else
		tmp = Float64(Float64(log(t) * a) - t);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 490.0)
		tmp = log(y) + (log(z) + (log(t) * (a - 0.5)));
	else
		tmp = (log(t) * a) - t;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 490.0], N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 490:\\
\;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 490

    1. Initial program 99.2%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. +-commutative99.2%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot \log t + \left(\left(\log \left(x + y\right) + \log z\right) - t\right)} \]
      2. fma-def99.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, \log t, \left(\log \left(x + y\right) + \log z\right) - t\right)} \]
      3. sub-neg99.2%

        \[\leadsto \mathsf{fma}\left(\color{blue}{a + \left(-0.5\right)}, \log t, \left(\log \left(x + y\right) + \log z\right) - t\right) \]
      4. metadata-eval99.2%

        \[\leadsto \mathsf{fma}\left(a + \color{blue}{-0.5}, \log t, \left(\log \left(x + y\right) + \log z\right) - t\right) \]
      5. associate--l+99.2%

        \[\leadsto \mathsf{fma}\left(a + -0.5, \log t, \color{blue}{\log \left(x + y\right) + \left(\log z - t\right)}\right) \]
    3. Simplified99.2%

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

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

      \[\leadsto \color{blue}{\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)} \]

    if 490 < t

    1. Initial program 99.8%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.8%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.8%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.8%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 73.2%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 97.1%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative97.1%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified97.1%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 490:\\ \;\;\;\;\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a - t\\ \end{array} \]

Alternative 5: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \left(\log y + \log z\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right) \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (+ (+ (log y) (log z)) (- (* (log t) (- a 0.5)) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	return (log(y) + log(z)) + ((log(t) * (a - 0.5)) - t);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (log(y) + log(z)) + ((log(t) * (a - 0.5d0)) - t)
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	return (Math.log(y) + Math.log(z)) + ((Math.log(t) * (a - 0.5)) - t);
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	return (math.log(y) + math.log(z)) + ((math.log(t) * (a - 0.5)) - t)
x, y = sort([x, y])
function code(x, y, z, t, a)
	return Float64(Float64(log(y) + log(z)) + Float64(Float64(log(t) * Float64(a - 0.5)) - t))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
	tmp = (log(y) + log(z)) + ((log(t) * (a - 0.5)) - t);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[y], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\left(\log y + \log z\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right)
\end{array}
Derivation
  1. Initial program 99.5%

    \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
  2. Step-by-step derivation
    1. associate-+l-99.5%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
    2. +-commutative99.5%

      \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
    3. associate--l+99.5%

      \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
    4. sub-neg99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
    5. +-commutative99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
    6. *-commutative99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
    7. distribute-rgt-neg-in99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
    8. fma-def99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
    9. sub-neg99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
    10. +-commutative99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
    11. distribute-neg-in99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
    12. metadata-eval99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
    13. metadata-eval99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
    14. unsub-neg99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
  3. Simplified99.5%

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

    \[\leadsto \color{blue}{\left(\log y + \log z\right) - \left(t + \log t \cdot \left(0.5 - a\right)\right)} \]
  5. Final simplification69.3%

    \[\leadsto \left(\log y + \log z\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right) \]

Alternative 6: 87.1% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 2.15 \cdot 10^{+14}:\\ \;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a - t\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= t 2.15e+14)
   (- (+ (log (* y z)) (* (log t) (- a 0.5))) t)
   (- (* (log t) a) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 2.15e+14) {
		tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
	} else {
		tmp = (log(t) * a) - t;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= 2.15d+14) then
        tmp = (log((y * z)) + (log(t) * (a - 0.5d0))) - t
    else
        tmp = (log(t) * a) - t
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 2.15e+14) {
		tmp = (Math.log((y * z)) + (Math.log(t) * (a - 0.5))) - t;
	} else {
		tmp = (Math.log(t) * a) - t;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if t <= 2.15e+14:
		tmp = (math.log((y * z)) + (math.log(t) * (a - 0.5))) - t
	else:
		tmp = (math.log(t) * a) - t
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 2.15e+14)
		tmp = Float64(Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5))) - t);
	else
		tmp = Float64(Float64(log(t) * a) - t);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 2.15e+14)
		tmp = (log((y * z)) + (log(t) * (a - 0.5))) - t;
	else
		tmp = (log(t) * a) - t;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.15e+14], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.15 \cdot 10^{+14}:\\
\;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\

\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 2.15e14

    1. Initial program 99.3%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.3%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.3%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.3%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
      9. sub-neg99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.3%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)} \]
    4. Step-by-step derivation
      1. associate-+r-99.3%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right) - \mathsf{fma}\left(\log t, 0.5 - a, t\right)} \]
      2. +-commutative99.3%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right)} - \mathsf{fma}\left(\log t, 0.5 - a, t\right) \]
      3. fma-udef99.3%

        \[\leadsto \left(\log \left(x + y\right) + \log z\right) - \color{blue}{\left(\log t \cdot \left(0.5 - a\right) + t\right)} \]
      4. associate--r+99.3%

        \[\leadsto \color{blue}{\left(\left(\log \left(x + y\right) + \log z\right) - \log t \cdot \left(0.5 - a\right)\right) - t} \]
      5. +-commutative99.3%

        \[\leadsto \left(\color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
      6. sum-log77.6%

        \[\leadsto \left(\color{blue}{\log \left(z \cdot \left(x + y\right)\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    5. Applied egg-rr77.6%

      \[\leadsto \color{blue}{\left(\log \left(z \cdot \left(x + y\right)\right) - \log t \cdot \left(0.5 - a\right)\right) - t} \]
    6. Taylor expanded in x around 0 51.4%

      \[\leadsto \left(\color{blue}{\log \left(y \cdot z\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    7. Step-by-step derivation
      1. *-commutative51.4%

        \[\leadsto \left(\log \color{blue}{\left(z \cdot y\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    8. Simplified51.4%

      \[\leadsto \left(\color{blue}{\log \left(z \cdot y\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]

    if 2.15e14 < t

    1. Initial program 99.8%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.8%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.8%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.8%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 72.2%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 99.7%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified99.7%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 2.15 \cdot 10^{+14}:\\ \;\;\;\;\left(\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a - t\\ \end{array} \]

Alternative 7: 79.1% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -0.0076 \lor \neg \left(a \leq 4.2\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\log z + \left(\log \left(y + x\right) - t\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -0.0076) (not (<= a 4.2)))
   (- (* (log t) a) t)
   (+ (log z) (- (log (+ y x)) t))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -0.0076) || !(a <= 4.2)) {
		tmp = (log(t) * a) - t;
	} else {
		tmp = log(z) + (log((y + x)) - t);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-0.0076d0)) .or. (.not. (a <= 4.2d0))) then
        tmp = (log(t) * a) - t
    else
        tmp = log(z) + (log((y + x)) - t)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -0.0076) || !(a <= 4.2)) {
		tmp = (Math.log(t) * a) - t;
	} else {
		tmp = Math.log(z) + (Math.log((y + x)) - t);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -0.0076) or not (a <= 4.2):
		tmp = (math.log(t) * a) - t
	else:
		tmp = math.log(z) + (math.log((y + x)) - t)
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -0.0076) || !(a <= 4.2))
		tmp = Float64(Float64(log(t) * a) - t);
	else
		tmp = Float64(log(z) + Float64(log(Float64(y + x)) - t));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -0.0076) || ~((a <= 4.2)))
		tmp = (log(t) * a) - t;
	else
		tmp = log(z) + (log((y + x)) - t);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.0076], N[Not[LessEqual[a, 4.2]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0076 \lor \neg \left(a \leq 4.2\right):\\
\;\;\;\;\log t \cdot a - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -0.00759999999999999998 or 4.20000000000000018 < a

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.6%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.6%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.6%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 74.0%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 98.2%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative98.2%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified98.2%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]

    if -0.00759999999999999998 < a < 4.20000000000000018

    1. Initial program 99.4%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.4%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.4%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.4%

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

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.0076 \lor \neg \left(a \leq 4.2\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\log z + \left(\log \left(y + x\right) - t\right)\\ \end{array} \]

Alternative 8: 83.8% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -0.098 \lor \neg \left(a \leq 8.5 \cdot 10^{-40}\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\log \left(y \cdot \frac{z}{\sqrt{t}}\right) - t\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -0.098) (not (<= a 8.5e-40)))
   (- (* (log t) a) t)
   (- (log (* y (/ z (sqrt t)))) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -0.098) || !(a <= 8.5e-40)) {
		tmp = (log(t) * a) - t;
	} else {
		tmp = log((y * (z / sqrt(t)))) - t;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-0.098d0)) .or. (.not. (a <= 8.5d-40))) then
        tmp = (log(t) * a) - t
    else
        tmp = log((y * (z / sqrt(t)))) - t
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -0.098) || !(a <= 8.5e-40)) {
		tmp = (Math.log(t) * a) - t;
	} else {
		tmp = Math.log((y * (z / Math.sqrt(t)))) - t;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -0.098) or not (a <= 8.5e-40):
		tmp = (math.log(t) * a) - t
	else:
		tmp = math.log((y * (z / math.sqrt(t)))) - t
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -0.098) || !(a <= 8.5e-40))
		tmp = Float64(Float64(log(t) * a) - t);
	else
		tmp = Float64(log(Float64(y * Float64(z / sqrt(t)))) - t);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -0.098) || ~((a <= 8.5e-40)))
		tmp = (log(t) * a) - t;
	else
		tmp = log((y * (z / sqrt(t)))) - t;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.098], N[Not[LessEqual[a, 8.5e-40]], $MachinePrecision]], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[N[(y * N[(z / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.098 \lor \neg \left(a \leq 8.5 \cdot 10^{-40}\right):\\
\;\;\;\;\log t \cdot a - t\\

\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot \frac{z}{\sqrt{t}}\right) - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -0.098000000000000004 or 8.4999999999999998e-40 < a

    1. Initial program 99.7%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.7%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.7%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.7%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 74.2%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 98.1%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative98.1%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified98.1%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]

    if -0.098000000000000004 < a < 8.4999999999999998e-40

    1. Initial program 99.4%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.4%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.4%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.4%

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

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.4%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)} \]
    4. Step-by-step derivation
      1. associate-+r-99.4%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right) - \mathsf{fma}\left(\log t, 0.5 - a, t\right)} \]
      2. +-commutative99.4%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right)} - \mathsf{fma}\left(\log t, 0.5 - a, t\right) \]
      3. fma-udef99.4%

        \[\leadsto \left(\log \left(x + y\right) + \log z\right) - \color{blue}{\left(\log t \cdot \left(0.5 - a\right) + t\right)} \]
      4. associate--r+99.4%

        \[\leadsto \color{blue}{\left(\left(\log \left(x + y\right) + \log z\right) - \log t \cdot \left(0.5 - a\right)\right) - t} \]
      5. +-commutative99.4%

        \[\leadsto \left(\color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
      6. sum-log72.5%

        \[\leadsto \left(\color{blue}{\log \left(z \cdot \left(x + y\right)\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    5. Applied egg-rr72.5%

      \[\leadsto \color{blue}{\left(\log \left(z \cdot \left(x + y\right)\right) - \log t \cdot \left(0.5 - a\right)\right) - t} \]
    6. Taylor expanded in x around 0 47.7%

      \[\leadsto \left(\color{blue}{\log \left(y \cdot z\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    7. Step-by-step derivation
      1. *-commutative47.7%

        \[\leadsto \left(\log \color{blue}{\left(z \cdot y\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    8. Simplified47.7%

      \[\leadsto \left(\color{blue}{\log \left(z \cdot y\right)} - \log t \cdot \left(0.5 - a\right)\right) - t \]
    9. Taylor expanded in a around 0 47.7%

      \[\leadsto \left(\log \left(z \cdot y\right) - \color{blue}{0.5 \cdot \log t}\right) - t \]
    10. Step-by-step derivation
      1. *-commutative47.7%

        \[\leadsto \left(\log \left(z \cdot y\right) - \color{blue}{\log t \cdot 0.5}\right) - t \]
    11. Simplified47.7%

      \[\leadsto \left(\log \left(z \cdot y\right) - \color{blue}{\log t \cdot 0.5}\right) - t \]
    12. Step-by-step derivation
      1. log-prod64.1%

        \[\leadsto \left(\color{blue}{\left(\log z + \log y\right)} - \log t \cdot 0.5\right) - t \]
      2. +-commutative64.1%

        \[\leadsto \left(\color{blue}{\left(\log y + \log z\right)} - \log t \cdot 0.5\right) - t \]
      3. associate--l+64.1%

        \[\leadsto \color{blue}{\left(\log y + \left(\log z - \log t \cdot 0.5\right)\right)} - t \]
      4. add-log-exp64.1%

        \[\leadsto \left(\log y + \left(\log z - \color{blue}{\log \left(e^{\log t \cdot 0.5}\right)}\right)\right) - t \]
      5. exp-to-pow64.1%

        \[\leadsto \left(\log y + \left(\log z - \log \color{blue}{\left({t}^{0.5}\right)}\right)\right) - t \]
      6. pow1/264.1%

        \[\leadsto \left(\log y + \left(\log z - \log \color{blue}{\left(\sqrt{t}\right)}\right)\right) - t \]
    13. Applied egg-rr64.1%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z - \log \left(\sqrt{t}\right)\right)\right)} - t \]
    14. Step-by-step derivation
      1. associate-+r-64.1%

        \[\leadsto \color{blue}{\left(\left(\log y + \log z\right) - \log \left(\sqrt{t}\right)\right)} - t \]
      2. +-commutative64.1%

        \[\leadsto \left(\color{blue}{\left(\log z + \log y\right)} - \log \left(\sqrt{t}\right)\right) - t \]
      3. log-prod47.7%

        \[\leadsto \left(\color{blue}{\log \left(z \cdot y\right)} - \log \left(\sqrt{t}\right)\right) - t \]
      4. log-div44.0%

        \[\leadsto \color{blue}{\log \left(\frac{z \cdot y}{\sqrt{t}}\right)} - t \]
      5. associate-/l*46.7%

        \[\leadsto \log \color{blue}{\left(\frac{z}{\frac{\sqrt{t}}{y}}\right)} - t \]
      6. associate-/r/47.2%

        \[\leadsto \log \color{blue}{\left(\frac{z}{\sqrt{t}} \cdot y\right)} - t \]
    15. Simplified47.2%

      \[\leadsto \color{blue}{\log \left(\frac{z}{\sqrt{t}} \cdot y\right)} - t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.098 \lor \neg \left(a \leq 8.5 \cdot 10^{-40}\right):\\ \;\;\;\;\log t \cdot a - t\\ \mathbf{else}:\\ \;\;\;\;\log \left(y \cdot \frac{z}{\sqrt{t}}\right) - t\\ \end{array} \]

Alternative 9: 86.7% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 330:\\ \;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a - t\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (<= t 330.0) (+ (log (* y z)) (* (log t) (- a 0.5))) (- (* (log t) a) t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 330.0) {
		tmp = log((y * z)) + (log(t) * (a - 0.5));
	} else {
		tmp = (log(t) * a) - t;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= 330.0d0) then
        tmp = log((y * z)) + (log(t) * (a - 0.5d0))
    else
        tmp = (log(t) * a) - t
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 330.0) {
		tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
	} else {
		tmp = (Math.log(t) * a) - t;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if t <= 330.0:
		tmp = math.log((y * z)) + (math.log(t) * (a - 0.5))
	else:
		tmp = (math.log(t) * a) - t
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 330.0)
		tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5)));
	else
		tmp = Float64(Float64(log(t) * a) - t);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 330.0)
		tmp = log((y * z)) + (log(t) * (a - 0.5));
	else
		tmp = (log(t) * a) - t;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 330.0], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 330:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\log t \cdot a - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 330

    1. Initial program 99.2%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.2%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.2%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.2%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
      9. sub-neg99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.2%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.2%

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

      \[\leadsto \color{blue}{\left(\log y + \log z\right) - \left(t + \log t \cdot \left(0.5 - a\right)\right)} \]
    5. Taylor expanded in t around 0 63.6%

      \[\leadsto \color{blue}{\left(\log y + \log z\right) - \log t \cdot \left(0.5 - a\right)} \]
    6. Step-by-step derivation
      1. log-prod49.6%

        \[\leadsto \color{blue}{\log \left(y \cdot z\right)} - \log t \cdot \left(0.5 - a\right) \]
      2. *-commutative49.6%

        \[\leadsto \log \color{blue}{\left(z \cdot y\right)} - \log t \cdot \left(0.5 - a\right) \]
    7. Simplified49.6%

      \[\leadsto \color{blue}{\log \left(z \cdot y\right) - \log t \cdot \left(0.5 - a\right)} \]

    if 330 < t

    1. Initial program 99.8%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate--l+99.8%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
      2. sub-neg99.8%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
      3. metadata-eval99.8%

        \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
    4. Taylor expanded in x around 0 73.2%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
    5. Taylor expanded in a around inf 97.1%

      \[\leadsto \color{blue}{a \cdot \log t} - t \]
    6. Step-by-step derivation
      1. *-commutative97.1%

        \[\leadsto \color{blue}{\log t \cdot a} - t \]
    7. Simplified97.1%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 330:\\ \;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a - t\\ \end{array} \]

Alternative 10: 62.8% accurate, 2.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -38000000000000 \lor \neg \left(a \leq 6.3 \cdot 10^{+16}\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -38000000000000.0) (not (<= a 6.3e+16))) (* (log t) a) (- t)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -38000000000000.0) || !(a <= 6.3e+16)) {
		tmp = log(t) * a;
	} else {
		tmp = -t;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-38000000000000.0d0)) .or. (.not. (a <= 6.3d+16))) then
        tmp = log(t) * a
    else
        tmp = -t
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -38000000000000.0) || !(a <= 6.3e+16)) {
		tmp = Math.log(t) * a;
	} else {
		tmp = -t;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -38000000000000.0) or not (a <= 6.3e+16):
		tmp = math.log(t) * a
	else:
		tmp = -t
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -38000000000000.0) || !(a <= 6.3e+16))
		tmp = Float64(log(t) * a);
	else
		tmp = Float64(-t);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -38000000000000.0) || ~((a <= 6.3e+16)))
		tmp = log(t) * a;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -38000000000000.0], N[Not[LessEqual[a, 6.3e+16]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -38000000000000 \lor \neg \left(a \leq 6.3 \cdot 10^{+16}\right):\\
\;\;\;\;\log t \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.8e13 or 6.3e16 < a

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.6%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.6%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.6%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
      9. sub-neg99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.6%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.6%

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

      \[\leadsto \color{blue}{a \cdot \log t} \]
    5. Step-by-step derivation
      1. *-commutative79.2%

        \[\leadsto \color{blue}{\log t \cdot a} \]
    6. Simplified79.2%

      \[\leadsto \color{blue}{\log t \cdot a} \]

    if -3.8e13 < a < 6.3e16

    1. Initial program 99.5%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.5%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. +-commutative99.5%

        \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
      3. associate--l+99.5%

        \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      4. sub-neg99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      5. +-commutative99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      6. *-commutative99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      7. distribute-rgt-neg-in99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      8. fma-def99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
      9. sub-neg99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      10. +-commutative99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      11. distribute-neg-in99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      12. metadata-eval99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      13. metadata-eval99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      14. unsub-neg99.5%

        \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.5%

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

      \[\leadsto \color{blue}{-1 \cdot t} \]
    5. Step-by-step derivation
      1. neg-mul-152.1%

        \[\leadsto \color{blue}{-t} \]
    6. Simplified52.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -38000000000000 \lor \neg \left(a \leq 6.3 \cdot 10^{+16}\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 11: 75.4% accurate, 3.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \log t \cdot a - t \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a) :precision binary64 (- (* (log t) a) t))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	return (log(t) * a) - t;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (log(t) * a) - t
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	return (Math.log(t) * a) - t;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	return (math.log(t) * a) - t
x, y = sort([x, y])
function code(x, y, z, t, a)
	return Float64(Float64(log(t) * a) - t)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
	tmp = (log(t) * a) - t;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\log t \cdot a - t
\end{array}
Derivation
  1. Initial program 99.5%

    \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
  2. Step-by-step derivation
    1. associate--l+99.5%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right)} + \left(a - 0.5\right) \cdot \log t \]
    2. sub-neg99.5%

      \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \log t \]
    3. metadata-eval99.5%

      \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \log t \]
  3. Simplified99.5%

    \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \left(a + -0.5\right) \cdot \log t} \]
  4. Taylor expanded in x around 0 69.3%

    \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - 0.5\right)\right)\right) - t} \]
  5. Taylor expanded in a around inf 75.1%

    \[\leadsto \color{blue}{a \cdot \log t} - t \]
  6. Step-by-step derivation
    1. *-commutative75.1%

      \[\leadsto \color{blue}{\log t \cdot a} - t \]
  7. Simplified75.1%

    \[\leadsto \color{blue}{\log t \cdot a} - t \]
  8. Final simplification75.1%

    \[\leadsto \log t \cdot a - t \]

Alternative 12: 38.2% accurate, 156.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ -t \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a) :precision binary64 (- t))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
	return -t;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = -t
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
	return -t;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a):
	return -t
x, y = sort([x, y])
function code(x, y, z, t, a)
	return Float64(-t)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
	tmp = -t;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
-t
\end{array}
Derivation
  1. Initial program 99.5%

    \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
  2. Step-by-step derivation
    1. associate-+l-99.5%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
    2. +-commutative99.5%

      \[\leadsto \color{blue}{\left(\log z + \log \left(x + y\right)\right)} - \left(t - \left(a - 0.5\right) \cdot \log t\right) \]
    3. associate--l+99.5%

      \[\leadsto \color{blue}{\log z + \left(\log \left(x + y\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
    4. sub-neg99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
    5. +-commutative99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
    6. *-commutative99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
    7. distribute-rgt-neg-in99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
    8. fma-def99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
    9. sub-neg99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
    10. +-commutative99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
    11. distribute-neg-in99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
    12. metadata-eval99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
    13. metadata-eval99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
    14. unsub-neg99.5%

      \[\leadsto \log z + \left(\log \left(x + y\right) - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
  3. Simplified99.5%

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

    \[\leadsto \color{blue}{-1 \cdot t} \]
  5. Step-by-step derivation
    1. neg-mul-136.7%

      \[\leadsto \color{blue}{-t} \]
  6. Simplified36.7%

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification36.7%

    \[\leadsto -t \]

Developer target: 99.6% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023308 
(FPCore (x y z t a)
  :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))

  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))