Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2

Percentage Accurate: 99.6% → 99.6%
Time: 34.0s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
(FPCore (x y z t a)
  :precision binary64
  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 1/2) (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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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 - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t

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 11 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?

\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
(FPCore (x y z t a)
  :precision binary64
  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 1/2) (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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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 - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t

Alternative 1: 99.3% accurate, 0.8× speedup?

\[\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
(FPCore (x y z t a)
  :precision binary64
  (- (+ (log (fmax x y)) (+ (log z) (* (log t) (- a 1/2)))) t))
double code(double x, double y, double z, double t, double a) {
	return (log(fmax(x, y)) + (log(z) + (log(t) * (a - 0.5)))) - t;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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(fmax(x, y)) + (log(z) + (log(t) * (a - 0.5d0)))) - t
end function
public static double code(double x, double y, double z, double t, double a) {
	return (Math.log(fmax(x, y)) + (Math.log(z) + (Math.log(t) * (a - 0.5)))) - t;
}
def code(x, y, z, t, a):
	return (math.log(fmax(x, y)) + (math.log(z) + (math.log(t) * (a - 0.5)))) - t
function code(x, y, z, t, a)
	return Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(log(t) * Float64(a - 0.5)))) - t)
end
function tmp = code(x, y, z, t, a)
	tmp = (log(max(x, y)) + (log(z) + (log(t) * (a - 0.5)))) - t;
end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t
Derivation
  1. Initial program 99.6%

    \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
  2. Taylor expanded in t around inf

    \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
  3. Step-by-step derivation
    1. lower-*.f6477.5%

      \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
  4. Applied rewrites77.5%

    \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
  5. Taylor expanded in x around 0

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

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

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

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

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

      \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    6. lower-*.f64N/A

      \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. lower-log.f64N/A

      \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    8. lower--.f6469.3%

      \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
  7. Applied rewrites69.3%

    \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t} \]
  8. Add Preprocessing

Alternative 2: 98.6% accurate, 0.6× speedup?

\[\begin{array}{l} \mathbf{if}\;t \leq 190000:\\ \;\;\;\;\log z + \left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + a \cdot \log t\right)\right) - t\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (if (<= t 190000)
  (+
   (log z)
   (+ (log (+ (fmin x y) (fmax x y))) (* (log t) (- a 1/2))))
  (- (+ (log (fmax x y)) (+ (log z) (* a (log t)))) t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 190000.0) {
		tmp = log(z) + (log((fmin(x, y) + fmax(x, y))) + (log(t) * (a - 0.5)));
	} else {
		tmp = (log(fmax(x, y)) + (log(z) + (a * log(t)))) - t;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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 <= 190000.0d0) then
        tmp = log(z) + (log((fmin(x, y) + fmax(x, y))) + (log(t) * (a - 0.5d0)))
    else
        tmp = (log(fmax(x, y)) + (log(z) + (a * log(t)))) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 190000.0) {
		tmp = Math.log(z) + (Math.log((fmin(x, y) + fmax(x, y))) + (Math.log(t) * (a - 0.5)));
	} else {
		tmp = (Math.log(fmax(x, y)) + (Math.log(z) + (a * Math.log(t)))) - t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= 190000.0:
		tmp = math.log(z) + (math.log((fmin(x, y) + fmax(x, y))) + (math.log(t) * (a - 0.5)))
	else:
		tmp = (math.log(fmax(x, y)) + (math.log(z) + (a * math.log(t)))) - t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 190000.0)
		tmp = Float64(log(z) + Float64(log(Float64(fmin(x, y) + fmax(x, y))) + Float64(log(t) * Float64(a - 0.5))));
	else
		tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(a * log(t)))) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 190000.0)
		tmp = log(z) + (log((min(x, y) + max(x, y))) + (log(t) * (a - 0.5)));
	else
		tmp = (log(max(x, y)) + (log(z) + (a * log(t)))) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 190000], N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;t \leq 190000:\\
\;\;\;\;\log z + \left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + a \cdot \log t\right)\right) - t\\


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

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around 0

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

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

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

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

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

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

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

        \[\leadsto \log z + \left(\log \left(x + y\right) + \log t \cdot \left(\color{blue}{a} - \frac{1}{2}\right)\right) \]
      8. lower--.f6463.4%

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

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

    if 1.9e5 < t

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      6. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      7. lower-log.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      8. lower--.f6469.3%

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. Applied rewrites69.3%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t} \]
    8. Taylor expanded in a around inf

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
      2. lower-log.f6458.8%

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    10. Applied rewrites58.8%

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 97.9% accurate, 0.2× speedup?

\[\begin{array}{l} t_1 := \log \left(\mathsf{max}\left(x, y\right)\right)\\ t_2 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\ t_3 := a \cdot \log t\\ \mathbf{if}\;t\_2 \leq -20000000000000000000:\\ \;\;\;\;-1 \cdot t + t\_3\\ \mathbf{elif}\;t\_2 \leq 2000:\\ \;\;\;\;\left(t\_1 + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(t\_1 + \left(\log z + t\_3\right)\right) - t\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (let* ((t_1 (log (fmax x y)))
       (t_2
        (+
         (- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
         (* (- a 1/2) (log t))))
       (t_3 (* a (log t))))
  (if (<= t_2 -20000000000000000000)
    (+ (* -1 t) t_3)
    (if (<= t_2 2000)
      (- (+ t_1 (+ (log z) (* -1/2 (log t)))) t)
      (- (+ t_1 (+ (log z) t_3)) t)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log(fmax(x, y));
	double t_2 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
	double t_3 = a * log(t);
	double tmp;
	if (t_2 <= -2e+19) {
		tmp = (-1.0 * t) + t_3;
	} else if (t_2 <= 2000.0) {
		tmp = (t_1 + (log(z) + (-0.5 * log(t)))) - t;
	} else {
		tmp = (t_1 + (log(z) + t_3)) - t;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = log(fmax(x, y))
    t_2 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5d0) * log(t))
    t_3 = a * log(t)
    if (t_2 <= (-2d+19)) then
        tmp = ((-1.0d0) * t) + t_3
    else if (t_2 <= 2000.0d0) then
        tmp = (t_1 + (log(z) + ((-0.5d0) * log(t)))) - t
    else
        tmp = (t_1 + (log(z) + t_3)) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log(fmax(x, y));
	double t_2 = ((Math.log((fmin(x, y) + fmax(x, y))) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
	double t_3 = a * Math.log(t);
	double tmp;
	if (t_2 <= -2e+19) {
		tmp = (-1.0 * t) + t_3;
	} else if (t_2 <= 2000.0) {
		tmp = (t_1 + (Math.log(z) + (-0.5 * Math.log(t)))) - t;
	} else {
		tmp = (t_1 + (Math.log(z) + t_3)) - t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log(fmax(x, y))
	t_2 = ((math.log((fmin(x, y) + fmax(x, y))) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
	t_3 = a * math.log(t)
	tmp = 0
	if t_2 <= -2e+19:
		tmp = (-1.0 * t) + t_3
	elif t_2 <= 2000.0:
		tmp = (t_1 + (math.log(z) + (-0.5 * math.log(t)))) - t
	else:
		tmp = (t_1 + (math.log(z) + t_3)) - t
	return tmp
function code(x, y, z, t, a)
	t_1 = log(fmax(x, y))
	t_2 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t)))
	t_3 = Float64(a * log(t))
	tmp = 0.0
	if (t_2 <= -2e+19)
		tmp = Float64(Float64(-1.0 * t) + t_3);
	elseif (t_2 <= 2000.0)
		tmp = Float64(Float64(t_1 + Float64(log(z) + Float64(-0.5 * log(t)))) - t);
	else
		tmp = Float64(Float64(t_1 + Float64(log(z) + t_3)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log(max(x, y));
	t_2 = ((log((min(x, y) + max(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
	t_3 = a * log(t);
	tmp = 0.0;
	if (t_2 <= -2e+19)
		tmp = (-1.0 * t) + t_3;
	elseif (t_2 <= 2000.0)
		tmp = (t_1 + (log(z) + (-0.5 * log(t)))) - t;
	else
		tmp = (t_1 + (log(z) + t_3)) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -20000000000000000000], N[(N[(-1 * t), $MachinePrecision] + t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 2000], N[(N[(t$95$1 + N[(N[Log[z], $MachinePrecision] + N[(-1/2 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(t$95$1 + N[(N[Log[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{max}\left(x, y\right)\right)\\
t_2 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\
t_3 := a \cdot \log t\\
\mathbf{if}\;t\_2 \leq -20000000000000000000:\\
\;\;\;\;-1 \cdot t + t\_3\\

\mathbf{elif}\;t\_2 \leq 2000:\\
\;\;\;\;\left(t\_1 + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t\\

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


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

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in a around inf

      \[\leadsto -1 \cdot t + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot t + a \cdot \color{blue}{\log t} \]
      2. lower-log.f6475.0%

        \[\leadsto -1 \cdot t + a \cdot \log t \]
    7. Applied rewrites75.0%

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

    if -2e19 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 2e3

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      6. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      7. lower-log.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      8. lower--.f6469.3%

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. Applied rewrites69.3%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t} \]
    8. Taylor expanded in a around inf

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
      2. lower-log.f6458.8%

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    10. Applied rewrites58.8%

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    11. Taylor expanded in a around 0

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t \]
      4. lower-log.f6440.5%

        \[\leadsto \left(\log y + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t \]
    13. Applied rewrites40.5%

      \[\leadsto \left(\log y + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t \]

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

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      6. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      7. lower-log.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      8. lower--.f6469.3%

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. Applied rewrites69.3%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t} \]
    8. Taylor expanded in a around inf

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
      2. lower-log.f6458.8%

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    10. Applied rewrites58.8%

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 97.7% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := \left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\ \mathbf{if}\;a \leq -4600000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 420000000:\\ \;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (let* ((t_1 (- (- t) (* (- 1/2 a) (log t)))))
  (if (<= a -4600000000)
    t_1
    (if (<= a 420000000)
      (- (+ (log (fmax x y)) (+ (log z) (* -1/2 (log t)))) t)
      t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = -t - ((0.5 - a) * log(t));
	double tmp;
	if (a <= -4600000000.0) {
		tmp = t_1;
	} else if (a <= 420000000.0) {
		tmp = (log(fmax(x, y)) + (log(z) + (-0.5 * log(t)))) - t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) :: t_1
    real(8) :: tmp
    t_1 = -t - ((0.5d0 - a) * log(t))
    if (a <= (-4600000000.0d0)) then
        tmp = t_1
    else if (a <= 420000000.0d0) then
        tmp = (log(fmax(x, y)) + (log(z) + ((-0.5d0) * log(t)))) - t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = -t - ((0.5 - a) * Math.log(t));
	double tmp;
	if (a <= -4600000000.0) {
		tmp = t_1;
	} else if (a <= 420000000.0) {
		tmp = (Math.log(fmax(x, y)) + (Math.log(z) + (-0.5 * Math.log(t)))) - t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = -t - ((0.5 - a) * math.log(t))
	tmp = 0
	if a <= -4600000000.0:
		tmp = t_1
	elif a <= 420000000.0:
		tmp = (math.log(fmax(x, y)) + (math.log(z) + (-0.5 * math.log(t)))) - t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)))
	tmp = 0.0
	if (a <= -4600000000.0)
		tmp = t_1;
	elseif (a <= 420000000.0)
		tmp = Float64(Float64(log(fmax(x, y)) + Float64(log(z) + Float64(-0.5 * log(t)))) - t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = -t - ((0.5 - a) * log(t));
	tmp = 0.0;
	if (a <= -4600000000.0)
		tmp = t_1;
	elseif (a <= 420000000.0)
		tmp = (log(max(x, y)) + (log(z) + (-0.5 * log(t)))) - t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4600000000], t$95$1, If[LessEqual[a, 420000000], N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(-1/2 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\
\mathbf{if}\;a \leq -4600000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 420000000:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.6e9 or 4.2e8 < a

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t + \left(a - \frac{1}{2}\right) \cdot \log t} \]
      2. add-flipN/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      6. lower--.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)} \]
      7. lift-*.f64N/A

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

        \[\leadsto \left(\mathsf{neg}\left(t\right)\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      9. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      10. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift-*.f64, \left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)\right)\right) \]
      11. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(*-commutative, \left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)\right)\right) \]
      12. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(distribute-lft-neg-out, \left(\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t\right)\right) \]
      13. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift--.f64, \left(a - \frac{1}{2}\right)\right)\right)\right) \cdot \log t \]
      14. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(sub-negate-rev, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
      15. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
      16. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower--.f64, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
    6. Applied rewrites77.5%

      \[\leadsto \color{blue}{\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t} \]

    if -4.6e9 < a < 4.2e8

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      6. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      7. lower-log.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      8. lower--.f6469.3%

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. Applied rewrites69.3%

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t} \]
    8. Taylor expanded in a around inf

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
      2. lower-log.f6458.8%

        \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    10. Applied rewrites58.8%

      \[\leadsto \left(\log y + \left(\log z + a \cdot \log t\right)\right) - t \]
    11. Taylor expanded in a around 0

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t \]
      4. lower-log.f6440.5%

        \[\leadsto \left(\log y + \left(\log z + \frac{-1}{2} \cdot \log t\right)\right) - t \]
    13. Applied rewrites40.5%

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

Alternative 5: 94.1% accurate, 0.3× speedup?

\[\begin{array}{l} t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\ \mathbf{if}\;t\_1 \leq -750:\\ \;\;\;\;-1 \cdot t + a \cdot \log t\\ \mathbf{elif}\;t\_1 \leq 705:\\ \;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right) \cdot z\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (let* ((t_1 (+ (log (+ (fmin x y) (fmax x y))) (log z))))
  (if (<= t_1 -750)
    (+ (* -1 t) (* a (log t)))
    (if (<= t_1 705)
      (- (+ (log (* (fmax x y) z)) (* (log t) (- a 1/2))) t)
      (- (- t) (* (- 1/2 a) (log t)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log((fmin(x, y) + fmax(x, y))) + log(z);
	double tmp;
	if (t_1 <= -750.0) {
		tmp = (-1.0 * t) + (a * log(t));
	} else if (t_1 <= 705.0) {
		tmp = (log((fmax(x, y) * z)) + (log(t) * (a - 0.5))) - t;
	} else {
		tmp = -t - ((0.5 - a) * log(t));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) :: t_1
    real(8) :: tmp
    t_1 = log((fmin(x, y) + fmax(x, y))) + log(z)
    if (t_1 <= (-750.0d0)) then
        tmp = ((-1.0d0) * t) + (a * log(t))
    else if (t_1 <= 705.0d0) then
        tmp = (log((fmax(x, y) * z)) + (log(t) * (a - 0.5d0))) - t
    else
        tmp = -t - ((0.5d0 - a) * log(t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log((fmin(x, y) + fmax(x, y))) + Math.log(z);
	double tmp;
	if (t_1 <= -750.0) {
		tmp = (-1.0 * t) + (a * Math.log(t));
	} else if (t_1 <= 705.0) {
		tmp = (Math.log((fmax(x, y) * z)) + (Math.log(t) * (a - 0.5))) - t;
	} else {
		tmp = -t - ((0.5 - a) * Math.log(t));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log((fmin(x, y) + fmax(x, y))) + math.log(z)
	tmp = 0
	if t_1 <= -750.0:
		tmp = (-1.0 * t) + (a * math.log(t))
	elif t_1 <= 705.0:
		tmp = (math.log((fmax(x, y) * z)) + (math.log(t) * (a - 0.5))) - t
	else:
		tmp = -t - ((0.5 - a) * math.log(t))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z))
	tmp = 0.0
	if (t_1 <= -750.0)
		tmp = Float64(Float64(-1.0 * t) + Float64(a * log(t)));
	elseif (t_1 <= 705.0)
		tmp = Float64(Float64(log(Float64(fmax(x, y) * z)) + Float64(log(t) * Float64(a - 0.5))) - t);
	else
		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log((min(x, y) + max(x, y))) + log(z);
	tmp = 0.0;
	if (t_1 <= -750.0)
		tmp = (-1.0 * t) + (a * log(t));
	elseif (t_1 <= 705.0)
		tmp = (log((max(x, y) * z)) + (log(t) * (a - 0.5))) - t;
	else
		tmp = -t - ((0.5 - a) * log(t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -750], N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 705], N[(N[(N[Log[N[(N[Max[x, y], $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 1/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\\
\mathbf{if}\;t\_1 \leq -750:\\
\;\;\;\;-1 \cdot t + a \cdot \log t\\

\mathbf{elif}\;t\_1 \leq 705:\\
\;\;\;\;\left(\log \left(\mathsf{max}\left(x, y\right) \cdot z\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right) - t\\

\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < -750

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in a around inf

      \[\leadsto -1 \cdot t + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot t + a \cdot \color{blue}{\log t} \]
      2. lower-log.f6475.0%

        \[\leadsto -1 \cdot t + a \cdot \log t \]
    7. Applied rewrites75.0%

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

    if -750 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 705

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \left(-t\right) - \color{blue}{\left(\left(\mathsf{neg}\left(\left(\log \left(x + y\right) + \log z\right)\right)\right) - \left(a - \frac{1}{2}\right) \cdot \log t\right)} \]
    3. Applied rewrites76.9%

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

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

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

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

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

        \[\leadsto \left(\log \left(y \cdot z\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right) - t \]
      5. lower-*.f64N/A

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

        \[\leadsto \left(\log \left(y \cdot z\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right) - t \]
      7. lower--.f6453.6%

        \[\leadsto \left(\log \left(y \cdot z\right) + \log t \cdot \left(a - \frac{1}{2}\right)\right) - t \]
    6. Applied rewrites53.6%

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

    if 705 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z))

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t + \left(a - \frac{1}{2}\right) \cdot \log t} \]
      2. add-flipN/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      6. lower--.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)} \]
      7. lift-*.f64N/A

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

        \[\leadsto \left(\mathsf{neg}\left(t\right)\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      9. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      10. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift-*.f64, \left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)\right)\right) \]
      11. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(*-commutative, \left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)\right)\right) \]
      12. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(distribute-lft-neg-out, \left(\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t\right)\right) \]
      13. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift--.f64, \left(a - \frac{1}{2}\right)\right)\right)\right) \cdot \log t \]
      14. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(sub-negate-rev, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
      15. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
      16. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower--.f64, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
    6. Applied rewrites77.5%

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

Alternative 6: 91.0% accurate, 0.2× speedup?

\[\begin{array}{l} t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\ \mathbf{if}\;t\_1 \leq -20000000000000000000:\\ \;\;\;\;-1 \cdot t + a \cdot \log t\\ \mathbf{elif}\;t\_1 \leq 700:\\ \;\;\;\;\log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot \mathsf{max}\left(x, y\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (let* ((t_1
        (+
         (- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
         (* (- a 1/2) (log t)))))
  (if (<= t_1 -20000000000000000000)
    (+ (* -1 t) (* a (log t)))
    (if (<= t_1 700)
      (- (log (* (* (pow t (- a 1/2)) z) (fmax x y))) t)
      (- (- t) (* (- 1/2 a) (log t)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
	double tmp;
	if (t_1 <= -2e+19) {
		tmp = (-1.0 * t) + (a * log(t));
	} else if (t_1 <= 700.0) {
		tmp = log(((pow(t, (a - 0.5)) * z) * fmax(x, y))) - t;
	} else {
		tmp = -t - ((0.5 - a) * log(t));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) :: t_1
    real(8) :: tmp
    t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5d0) * log(t))
    if (t_1 <= (-2d+19)) then
        tmp = ((-1.0d0) * t) + (a * log(t))
    else if (t_1 <= 700.0d0) then
        tmp = log((((t ** (a - 0.5d0)) * z) * fmax(x, y))) - t
    else
        tmp = -t - ((0.5d0 - a) * log(t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = ((Math.log((fmin(x, y) + fmax(x, y))) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
	double tmp;
	if (t_1 <= -2e+19) {
		tmp = (-1.0 * t) + (a * Math.log(t));
	} else if (t_1 <= 700.0) {
		tmp = Math.log(((Math.pow(t, (a - 0.5)) * z) * fmax(x, y))) - t;
	} else {
		tmp = -t - ((0.5 - a) * Math.log(t));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = ((math.log((fmin(x, y) + fmax(x, y))) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
	tmp = 0
	if t_1 <= -2e+19:
		tmp = (-1.0 * t) + (a * math.log(t))
	elif t_1 <= 700.0:
		tmp = math.log(((math.pow(t, (a - 0.5)) * z) * fmax(x, y))) - t
	else:
		tmp = -t - ((0.5 - a) * math.log(t))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t)))
	tmp = 0.0
	if (t_1 <= -2e+19)
		tmp = Float64(Float64(-1.0 * t) + Float64(a * log(t)));
	elseif (t_1 <= 700.0)
		tmp = Float64(log(Float64(Float64((t ^ Float64(a - 0.5)) * z) * fmax(x, y))) - t);
	else
		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((log((min(x, y) + max(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
	tmp = 0.0;
	if (t_1 <= -2e+19)
		tmp = (-1.0 * t) + (a * log(t));
	elseif (t_1 <= 700.0)
		tmp = log((((t ^ (a - 0.5)) * z) * max(x, y))) - t;
	else
		tmp = -t - ((0.5 - a) * log(t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -20000000000000000000], N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700], N[(N[Log[N[(N[(N[Power[t, N[(a - 1/2), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -20000000000000000000:\\
\;\;\;\;-1 \cdot t + a \cdot \log t\\

\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot \mathsf{max}\left(x, y\right)\right) - t\\

\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\


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

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in a around inf

      \[\leadsto -1 \cdot t + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot t + a \cdot \color{blue}{\log t} \]
      2. lower-log.f6475.0%

        \[\leadsto -1 \cdot t + a \cdot \log t \]
    7. Applied rewrites75.0%

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

    if -2e19 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 700

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      6. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      7. lower-log.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      8. lower--.f6469.3%

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. Applied rewrites69.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(a - \frac{1}{2}\right) \cdot \log t + \log z\right) + \log y\right) - t \]
      10. log-pow-revN/A

        \[\leadsto \left(\left(\log \left({t}^{\left(a - \frac{1}{2}\right)}\right) + \log z\right) + \log y\right) - t \]
      11. lift-pow.f64N/A

        \[\leadsto \left(\left(\log \left({t}^{\left(a - \frac{1}{2}\right)}\right) + \log z\right) + \log y\right) - t \]
      12. lift-log.f64N/A

        \[\leadsto \left(\left(\log \left({t}^{\left(a - \frac{1}{2}\right)}\right) + \log z\right) + \log y\right) - t \]
      13. sum-logN/A

        \[\leadsto \left(\log \left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) + \log y\right) - t \]
      14. lift-log.f64N/A

        \[\leadsto \left(\log \left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) + \log y\right) - t \]
      15. sum-logN/A

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
      16. lower-log.f64N/A

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
      17. lower-*.f64N/A

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
      18. lower-*.f6424.8%

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
    9. Applied rewrites24.8%

      \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]

    if 700 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t)))

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t + \left(a - \frac{1}{2}\right) \cdot \log t} \]
      2. add-flipN/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      6. lower--.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)} \]
      7. lift-*.f64N/A

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

        \[\leadsto \left(\mathsf{neg}\left(t\right)\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      9. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      10. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift-*.f64, \left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)\right)\right) \]
      11. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(*-commutative, \left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)\right)\right) \]
      12. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(distribute-lft-neg-out, \left(\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t\right)\right) \]
      13. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift--.f64, \left(a - \frac{1}{2}\right)\right)\right)\right) \cdot \log t \]
      14. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(sub-negate-rev, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
      15. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
      16. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower--.f64, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
    6. Applied rewrites77.5%

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

Alternative 7: 90.7% accurate, 0.2× speedup?

\[\begin{array}{l} t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\ \mathbf{if}\;t\_1 \leq -20000000000000000000:\\ \;\;\;\;-1 \cdot t + a \cdot \log t\\ \mathbf{elif}\;t\_1 \leq 700:\\ \;\;\;\;\log \left(\left({t}^{\frac{-1}{2}} \cdot z\right) \cdot \mathsf{max}\left(x, y\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (let* ((t_1
        (+
         (- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
         (* (- a 1/2) (log t)))))
  (if (<= t_1 -20000000000000000000)
    (+ (* -1 t) (* a (log t)))
    (if (<= t_1 700)
      (- (log (* (* (pow t -1/2) z) (fmax x y))) t)
      (- (- t) (* (- 1/2 a) (log t)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
	double tmp;
	if (t_1 <= -2e+19) {
		tmp = (-1.0 * t) + (a * log(t));
	} else if (t_1 <= 700.0) {
		tmp = log(((pow(t, -0.5) * z) * fmax(x, y))) - t;
	} else {
		tmp = -t - ((0.5 - a) * log(t));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    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) :: t_1
    real(8) :: tmp
    t_1 = ((log((fmin(x, y) + fmax(x, y))) + log(z)) - t) + ((a - 0.5d0) * log(t))
    if (t_1 <= (-2d+19)) then
        tmp = ((-1.0d0) * t) + (a * log(t))
    else if (t_1 <= 700.0d0) then
        tmp = log((((t ** (-0.5d0)) * z) * fmax(x, y))) - t
    else
        tmp = -t - ((0.5d0 - a) * log(t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = ((Math.log((fmin(x, y) + fmax(x, y))) + Math.log(z)) - t) + ((a - 0.5) * Math.log(t));
	double tmp;
	if (t_1 <= -2e+19) {
		tmp = (-1.0 * t) + (a * Math.log(t));
	} else if (t_1 <= 700.0) {
		tmp = Math.log(((Math.pow(t, -0.5) * z) * fmax(x, y))) - t;
	} else {
		tmp = -t - ((0.5 - a) * Math.log(t));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = ((math.log((fmin(x, y) + fmax(x, y))) + math.log(z)) - t) + ((a - 0.5) * math.log(t))
	tmp = 0
	if t_1 <= -2e+19:
		tmp = (-1.0 * t) + (a * math.log(t))
	elif t_1 <= 700.0:
		tmp = math.log(((math.pow(t, -0.5) * z) * fmax(x, y))) - t
	else:
		tmp = -t - ((0.5 - a) * math.log(t))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(log(Float64(fmin(x, y) + fmax(x, y))) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t)))
	tmp = 0.0
	if (t_1 <= -2e+19)
		tmp = Float64(Float64(-1.0 * t) + Float64(a * log(t)));
	elseif (t_1 <= 700.0)
		tmp = Float64(log(Float64(Float64((t ^ -0.5) * z) * fmax(x, y))) - t);
	else
		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((log((min(x, y) + max(x, y))) + log(z)) - t) + ((a - 0.5) * log(t));
	tmp = 0.0;
	if (t_1 <= -2e+19)
		tmp = (-1.0 * t) + (a * log(t));
	elseif (t_1 <= 700.0)
		tmp = log((((t ^ -0.5) * z) * max(x, y))) - t;
	else
		tmp = -t - ((0.5 - a) * log(t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 1/2), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -20000000000000000000], N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700], N[(N[Log[N[(N[(N[Power[t, -1/2], $MachinePrecision] * z), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left(\left(\log \left(\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t\\
\mathbf{if}\;t\_1 \leq -20000000000000000000:\\
\;\;\;\;-1 \cdot t + a \cdot \log t\\

\mathbf{elif}\;t\_1 \leq 700:\\
\;\;\;\;\log \left(\left({t}^{\frac{-1}{2}} \cdot z\right) \cdot \mathsf{max}\left(x, y\right)\right) - t\\

\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t\\


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

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in a around inf

      \[\leadsto -1 \cdot t + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot t + a \cdot \color{blue}{\log t} \]
      2. lower-log.f6475.0%

        \[\leadsto -1 \cdot t + a \cdot \log t \]
    7. Applied rewrites75.0%

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

    if -2e19 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t))) < 700

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in x around 0

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

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

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

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

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

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      6. lower-*.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      7. lower-log.f64N/A

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
      8. lower--.f6469.3%

        \[\leadsto \left(\log y + \left(\log z + \log t \cdot \left(a - \frac{1}{2}\right)\right)\right) - t \]
    7. Applied rewrites69.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\left(a - \frac{1}{2}\right) \cdot \log t + \log z\right) + \log y\right) - t \]
      10. log-pow-revN/A

        \[\leadsto \left(\left(\log \left({t}^{\left(a - \frac{1}{2}\right)}\right) + \log z\right) + \log y\right) - t \]
      11. lift-pow.f64N/A

        \[\leadsto \left(\left(\log \left({t}^{\left(a - \frac{1}{2}\right)}\right) + \log z\right) + \log y\right) - t \]
      12. lift-log.f64N/A

        \[\leadsto \left(\left(\log \left({t}^{\left(a - \frac{1}{2}\right)}\right) + \log z\right) + \log y\right) - t \]
      13. sum-logN/A

        \[\leadsto \left(\log \left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) + \log y\right) - t \]
      14. lift-log.f64N/A

        \[\leadsto \left(\log \left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) + \log y\right) - t \]
      15. sum-logN/A

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
      16. lower-log.f64N/A

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
      17. lower-*.f64N/A

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
      18. lower-*.f6424.8%

        \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
    9. Applied rewrites24.8%

      \[\leadsto \log \left(\left({t}^{\left(a - \frac{1}{2}\right)} \cdot z\right) \cdot y\right) - t \]
    10. Taylor expanded in a around 0

      \[\leadsto \log \left(\left({t}^{\frac{-1}{2}} \cdot z\right) \cdot y\right) - t \]
    11. Step-by-step derivation
      1. Applied rewrites29.3%

        \[\leadsto \log \left(\left({t}^{\frac{-1}{2}} \cdot z\right) \cdot y\right) - t \]

      if 700 < (+.f64 (-.f64 (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) t) (*.f64 (-.f64 a #s(literal 1/2 binary64)) (log.f64 t)))

      1. Initial program 99.6%

        \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
      2. Taylor expanded in t around inf

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
      3. Step-by-step derivation
        1. lower-*.f6477.5%

          \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
      4. Applied rewrites77.5%

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
      5. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{-1 \cdot t + \left(a - \frac{1}{2}\right) \cdot \log t} \]
        2. add-flipN/A

          \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)} \]
        3. lift-*.f64N/A

          \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t}\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
        5. lift-*.f64N/A

          \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
        6. lower--.f64N/A

          \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)} \]
        7. lift-*.f64N/A

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

          \[\leadsto \left(\mathsf{neg}\left(t\right)\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
        9. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
        10. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift-*.f64, \left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)\right)\right) \]
        11. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(*-commutative, \left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)\right)\right) \]
        12. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(distribute-lft-neg-out, \left(\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t\right)\right) \]
        13. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift--.f64, \left(a - \frac{1}{2}\right)\right)\right)\right) \cdot \log t \]
        14. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(sub-negate-rev, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
        15. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
        16. lift-neg.f64N/A

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower--.f64, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
      6. Applied rewrites77.5%

        \[\leadsto \color{blue}{\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t} \]
    12. Recombined 3 regimes into one program.
    13. Add Preprocessing

    Alternative 8: 77.5% accurate, 2.8× speedup?

    \[\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t \]
    (FPCore (x y z t a)
      :precision binary64
      (- (- t) (* (- 1/2 a) (log t))))
    double code(double x, double y, double z, double t, double a) {
    	return -t - ((0.5 - a) * log(t));
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z, t, a)
    use fmin_fmax_functions
        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 - ((0.5d0 - a) * log(t))
    end function
    
    public static double code(double x, double y, double z, double t, double a) {
    	return -t - ((0.5 - a) * Math.log(t));
    }
    
    def code(x, y, z, t, a):
    	return -t - ((0.5 - a) * math.log(t))
    
    function code(x, y, z, t, a)
    	return Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)))
    end
    
    function tmp = code(x, y, z, t, a)
    	tmp = -t - ((0.5 - a) * log(t));
    end
    
    code[x_, y_, z_, t_, a_] := N[((-t) - N[(N[(1/2 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t
    
    Derivation
    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t + \left(a - \frac{1}{2}\right) \cdot \log t} \]
      2. add-flipN/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      5. lift-*.f64N/A

        \[\leadsto -1 \cdot t - \left(\mathsf{neg}\left(\color{blue}{\log t \cdot \left(a - \frac{1}{2}\right)}\right)\right) \]
      6. lower--.f64N/A

        \[\leadsto \color{blue}{-1 \cdot t - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)} \]
      7. lift-*.f64N/A

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

        \[\leadsto \left(\mathsf{neg}\left(t\right)\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      9. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right) \]
      10. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift-*.f64, \left(\log t \cdot \left(a - \frac{1}{2}\right)\right)\right)\right)\right) \]
      11. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(*-commutative, \left(\left(a - \frac{1}{2}\right) \cdot \log t\right)\right)\right)\right) \]
      12. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(distribute-lft-neg-out, \left(\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t\right)\right) \]
      13. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\mathsf{Rewrite=>}\left(lift--.f64, \left(a - \frac{1}{2}\right)\right)\right)\right) \cdot \log t \]
      14. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite<=}\left(sub-negate-rev, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
      15. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
      16. lift-neg.f64N/A

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower--.f64, \left(\frac{1}{2} - a\right)\right) \cdot \log t \]
    6. Applied rewrites77.5%

      \[\leadsto \color{blue}{\left(-t\right) - \left(\frac{1}{2} - a\right) \cdot \log t} \]
    7. Add Preprocessing

    Alternative 9: 75.0% accurate, 2.8× speedup?

    \[-1 \cdot t + a \cdot \log t \]
    (FPCore (x y z t a)
      :precision binary64
      (+ (* -1 t) (* a (log t))))
    double code(double x, double y, double z, double t, double a) {
    	return (-1.0 * t) + (a * log(t));
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z, t, a)
    use fmin_fmax_functions
        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 = ((-1.0d0) * t) + (a * log(t))
    end function
    
    public static double code(double x, double y, double z, double t, double a) {
    	return (-1.0 * t) + (a * Math.log(t));
    }
    
    def code(x, y, z, t, a):
    	return (-1.0 * t) + (a * math.log(t))
    
    function code(x, y, z, t, a)
    	return Float64(Float64(-1.0 * t) + Float64(a * log(t)))
    end
    
    function tmp = code(x, y, z, t, a)
    	tmp = (-1.0 * t) + (a * log(t));
    end
    
    code[x_, y_, z_, t_, a_] := N[(N[(-1 * t), $MachinePrecision] + N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    -1 \cdot t + a \cdot \log t
    
    Derivation
    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in a around inf

      \[\leadsto -1 \cdot t + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot t + a \cdot \color{blue}{\log t} \]
      2. lower-log.f6475.0%

        \[\leadsto -1 \cdot t + a \cdot \log t \]
    7. Applied rewrites75.0%

      \[\leadsto -1 \cdot t + \color{blue}{a \cdot \log t} \]
    8. Add Preprocessing

    Alternative 10: 40.0% accurate, 2.9× speedup?

    \[\left(-t\right) + \frac{-1}{2} \cdot \log t \]
    (FPCore (x y z t a)
      :precision binary64
      (+ (- t) (* -1/2 (log t))))
    double code(double x, double y, double z, double t, double a) {
    	return -t + (-0.5 * log(t));
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z, t, a)
    use fmin_fmax_functions
        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 + ((-0.5d0) * log(t))
    end function
    
    public static double code(double x, double y, double z, double t, double a) {
    	return -t + (-0.5 * Math.log(t));
    }
    
    def code(x, y, z, t, a):
    	return -t + (-0.5 * math.log(t))
    
    function code(x, y, z, t, a)
    	return Float64(Float64(-t) + Float64(-0.5 * log(t)))
    end
    
    function tmp = code(x, y, z, t, a)
    	tmp = -t + (-0.5 * log(t));
    end
    
    code[x_, y_, z_, t_, a_] := N[((-t) + N[(-1/2 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \left(-t\right) + \frac{-1}{2} \cdot \log t
    
    Derivation
    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - \frac{1}{2}\right) \cdot \log t \]
    2. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    3. Step-by-step derivation
      1. lower-*.f6477.5%

        \[\leadsto -1 \cdot \color{blue}{t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    4. Applied rewrites77.5%

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - \frac{1}{2}\right) \cdot \log t \]
    5. Taylor expanded in a around 0

      \[\leadsto -1 \cdot t + \color{blue}{\frac{-1}{2} \cdot \log t} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot t + \frac{-1}{2} \cdot \color{blue}{\log t} \]
      2. lower-log.f6440.0%

        \[\leadsto -1 \cdot t + \frac{-1}{2} \cdot \log t \]
    7. Applied rewrites40.0%

      \[\leadsto -1 \cdot t + \color{blue}{\frac{-1}{2} \cdot \log t} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{t} + \frac{-1}{2} \cdot \log t \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(t\right)\right) + \frac{-1}{2} \cdot \log t \]
      3. lower-neg.f6440.0%

        \[\leadsto \left(-t\right) + \frac{-1}{2} \cdot \log t \]
    9. Applied rewrites40.0%

      \[\leadsto \left(-t\right) + \frac{-1}{2} \cdot \log t \]
    10. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025271 -o generate:evaluate
    (FPCore (x y z t a)
      :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
      :precision binary64
      (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 1/2) (log t))))