Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2

Percentage Accurate: 99.6% → 99.6%
Time: 8.2s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
(FPCore (x y z t a)
  :precision binary64
  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
	return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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 - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\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 13 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 - 0.5\right) \cdot \log t \]
(FPCore (x y z t a)
  :precision binary64
  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))
double code(double x, double y, double z, double t, double a) {
	return ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
}
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 - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\mathsf{fma}\left(\log t, a - 0.5, \log z\right) - \left(t - \log \left(y + x\right)\right) \]
(FPCore (x y z t a)
  :precision binary64
  (- (fma (log t) (- a 0.5) (log z)) (- t (log (+ y x)))))
double code(double x, double y, double z, double t, double a) {
	return fma(log(t), (a - 0.5), log(z)) - (t - log((y + x)));
}
function code(x, y, z, t, a)
	return Float64(fma(log(t), Float64(a - 0.5), log(z)) - Float64(t - log(Float64(y + x))))
end
code[x_, y_, z_, t_, a_] := N[(N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(t - N[Log[N[(y + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(\log t, a - 0.5, \log z\right) - \left(t - \log \left(y + x\right)\right)
Derivation
  1. Initial program 99.6%

    \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
  2. Step-by-step derivation
    1. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log t, a - \frac{1}{2}, \log z\right)} - \left(t - \log \left(x + y\right)\right) \]
    13. lower--.f6499.6%

      \[\leadsto \mathsf{fma}\left(\log t, a - 0.5, \log z\right) - \color{blue}{\left(t - \log \left(x + y\right)\right)} \]
    14. lift-+.f64N/A

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

      \[\leadsto \mathsf{fma}\left(\log t, a - \frac{1}{2}, \log z\right) - \left(t - \log \color{blue}{\left(y + x\right)}\right) \]
    16. lower-+.f6499.6%

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

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

Alternative 2: 98.3% accurate, 1.0× speedup?

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

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


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

    1. Initial program 99.6%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. 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--.f6461.4%

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

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

    if 0.00115 < t

    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
      7. lower-neg.f6477.4%

        \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
    6. Applied rewrites77.4%

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

Alternative 3: 98.2% accurate, 0.9× speedup?

\[\begin{array}{l} \mathbf{if}\;a \leq -2.2:\\ \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\ \mathbf{elif}\;a \leq 85:\\ \;\;\;\;\left(\left(\log \left(\mathsf{max}\left(x, y\right)\right) + \log z\right) - t\right) + -0.5 \cdot \log t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \end{array} \]
(FPCore (x y z t a)
  :precision binary64
  (if (<= a -2.2)
  (- (- t) (* (- 0.5 a) (log t)))
  (if (<= a 85.0)
    (+ (- (+ (log (fmax x y)) (log z)) t) (* -0.5 (log t)))
    (fma (- a 0.5) (log t) (- t)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -2.2) {
		tmp = -t - ((0.5 - a) * log(t));
	} else if (a <= 85.0) {
		tmp = ((log(fmax(x, y)) + log(z)) - t) + (-0.5 * log(t));
	} else {
		tmp = fma((a - 0.5), log(t), -t);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -2.2)
		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
	elseif (a <= 85.0)
		tmp = Float64(Float64(Float64(log(fmax(x, y)) + log(z)) - t) + Float64(-0.5 * log(t)));
	else
		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.2], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 85.0], N[(N[(N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(-0.5 * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -2.2:\\
\;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\

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

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -2.2000000000000002

    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

        \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
      3. fp-cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t \]
      8. lower-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 \]
      9. lower-neg.f64N/A

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

        \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
      11. lower-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.4%

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

    if -2.2000000000000002 < a < 85

    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. Applied rewrites41.8%

        \[\leadsto -1 \cdot t + \color{blue}{-0.5} \cdot \log t \]
      2. Taylor expanded in x around 0

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

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

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

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

          \[\leadsto \left(\left(\log y + \log z\right) - t\right) + -0.5 \cdot \log t \]
      4. Applied rewrites42.4%

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

      if 85 < a

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, \log t, -t\right)} \]
    7. Recombined 3 regimes into one program.
    8. Add Preprocessing

    Alternative 4: 98.2% accurate, 0.9× speedup?

    \[\begin{array}{l} \mathbf{if}\;a \leq -2.2:\\ \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\ \mathbf{elif}\;a \leq 85:\\ \;\;\;\;\left(\log z + \left(\log \left(\mathsf{max}\left(x, y\right)\right) - \log \left(\sqrt{t}\right)\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \end{array} \]
    (FPCore (x y z t a)
      :precision binary64
      (if (<= a -2.2)
      (- (- t) (* (- 0.5 a) (log t)))
      (if (<= a 85.0)
        (- (+ (log z) (- (log (fmax x y)) (log (sqrt t)))) t)
        (fma (- a 0.5) (log t) (- t)))))
    double code(double x, double y, double z, double t, double a) {
    	double tmp;
    	if (a <= -2.2) {
    		tmp = -t - ((0.5 - a) * log(t));
    	} else if (a <= 85.0) {
    		tmp = (log(z) + (log(fmax(x, y)) - log(sqrt(t)))) - t;
    	} else {
    		tmp = fma((a - 0.5), log(t), -t);
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a)
    	tmp = 0.0
    	if (a <= -2.2)
    		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
    	elseif (a <= 85.0)
    		tmp = Float64(Float64(log(z) + Float64(log(fmax(x, y)) - log(sqrt(t)))) - t);
    	else
    		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.2], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 85.0], N[(N[(N[Log[z], $MachinePrecision] + N[(N[Log[N[Max[x, y], $MachinePrecision]], $MachinePrecision] - N[Log[N[Sqrt[t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]
    
    \begin{array}{l}
    \mathbf{if}\;a \leq -2.2:\\
    \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
    
    \mathbf{elif}\;a \leq 85:\\
    \;\;\;\;\left(\log z + \left(\log \left(\mathsf{max}\left(x, y\right)\right) - \log \left(\sqrt{t}\right)\right)\right) - t\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if a < -2.2000000000000002

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

          \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
        3. fp-cancel-sign-sub-invN/A

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

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

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

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

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t \]
        8. lower-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 \]
        9. lower-neg.f64N/A

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

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
        11. lower-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.4%

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

      if -2.2000000000000002 < a < 85

      1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log \left(x + y\right) + -0.5 \cdot \log t\right)\right) - t \]
      4. Applied rewrites62.9%

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      7. Applied rewrites42.4%

        \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      8. Step-by-step derivation
        1. lift-+.f64N/A

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

          \[\leadsto \left(\log z + \left(\log y + \frac{-1}{2} \cdot \log t\right)\right) - t \]
        3. fp-cancel-sign-sub-invN/A

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

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

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

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

          \[\leadsto \left(\log z + \left(\log y - \log \left({t}^{\frac{1}{2}}\right)\right)\right) - t \]
        8. pow1/2N/A

          \[\leadsto \left(\log z + \left(\log y - \log \left(\sqrt{t}\right)\right)\right) - t \]
        9. lift-sqrt.f64N/A

          \[\leadsto \left(\log z + \left(\log y - \log \left(\sqrt{t}\right)\right)\right) - t \]
        10. lower-log.f6442.4%

          \[\leadsto \left(\log z + \left(\log y - \log \left(\sqrt{t}\right)\right)\right) - t \]
      9. Applied rewrites42.4%

        \[\leadsto \left(\log z + \left(\log y - \log \left(\sqrt{t}\right)\right)\right) - t \]

      if 85 < a

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

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

    Alternative 5: 95.9% accurate, 0.3× speedup?

    \[\begin{array}{l} t_1 := \log \left(x + y\right)\\ t_2 := \left(\left(t\_1 + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\ \mathbf{if}\;t\_2 \leq -200000:\\ \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\ \mathbf{elif}\;t\_2 \leq 1400:\\ \;\;\;\;\left(t\_1 - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \end{array} \]
    (FPCore (x y z t a)
      :precision binary64
      (let* ((t_1 (log (+ x y)))
           (t_2 (+ (- (+ t_1 (log z)) t) (* (- a 0.5) (log t)))))
      (if (<= t_2 -200000.0)
        (- (- t) (* (- 0.5 a) (log t)))
        (if (<= t_2 1400.0)
          (- (- t_1 (log (/ (sqrt t) z))) t)
          (fma (- a 0.5) (log t) (- t))))))
    double code(double x, double y, double z, double t, double a) {
    	double t_1 = log((x + y));
    	double t_2 = ((t_1 + log(z)) - t) + ((a - 0.5) * log(t));
    	double tmp;
    	if (t_2 <= -200000.0) {
    		tmp = -t - ((0.5 - a) * log(t));
    	} else if (t_2 <= 1400.0) {
    		tmp = (t_1 - log((sqrt(t) / z))) - t;
    	} else {
    		tmp = fma((a - 0.5), log(t), -t);
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a)
    	t_1 = log(Float64(x + y))
    	t_2 = Float64(Float64(Float64(t_1 + log(z)) - t) + Float64(Float64(a - 0.5) * log(t)))
    	tmp = 0.0
    	if (t_2 <= -200000.0)
    		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
    	elseif (t_2 <= 1400.0)
    		tmp = Float64(Float64(t_1 - log(Float64(sqrt(t) / z))) - t);
    	else
    		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1400.0], N[(N[(t$95$1 - N[Log[N[(N[Sqrt[t], $MachinePrecision] / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]]
    
    \begin{array}{l}
    t_1 := \log \left(x + y\right)\\
    t_2 := \left(\left(t\_1 + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
    \mathbf{if}\;t\_2 \leq -200000:\\
    \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
    
    \mathbf{elif}\;t\_2 \leq 1400:\\
    \;\;\;\;\left(t\_1 - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
    
    
    \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))) < -2e5

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

          \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
        3. fp-cancel-sign-sub-invN/A

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

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

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

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

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t \]
        8. lower-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 \]
        9. lower-neg.f64N/A

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

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
        11. lower-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.4%

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

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

      1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log \left(x + y\right) + -0.5 \cdot \log t\right)\right) - t \]
      4. Applied rewrites62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log \left(x + y\right) - \left(\left(\mathsf{neg}\left(\log \left({t}^{\frac{-1}{2}}\right)\right)\right) - \log z\right)\right) - t \]
        16. neg-logN/A

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

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

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

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

          \[\leadsto \left(\log \left(x + y\right) - \log \left(\frac{\frac{1}{{t}^{\frac{-1}{2}}}}{z}\right)\right) - t \]
      6. Applied rewrites55.9%

        \[\leadsto \left(\log \left(x + y\right) - \log \left(\frac{\sqrt{t}}{z}\right)\right) - t \]

      if 1400 < (+.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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in t around inf

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

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

    Alternative 6: 93.1% accurate, 0.4× 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:\\ \;\;\;\;\left(\log \left(\frac{\mathsf{max}\left(x, y\right)}{\sqrt{t}}\right) - t\right) + \log z\\ \mathbf{elif}\;t\_1 \leq 710:\\ \;\;\;\;\log \left(z \cdot \mathsf{max}\left(x, y\right)\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \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.0)
        (+ (- (log (/ (fmax x y) (sqrt t))) t) (log z))
        (if (<= t_1 710.0)
          (- (log (* z (fmax x y))) (fma (- 0.5 a) (log t) t))
          (fma (- a 0.5) (log t) (- 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 = (log((fmax(x, y) / sqrt(t))) - t) + log(z);
    	} else if (t_1 <= 710.0) {
    		tmp = log((z * fmax(x, y))) - fma((0.5 - a), log(t), t);
    	} else {
    		tmp = fma((a - 0.5), log(t), -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(log(Float64(fmax(x, y) / sqrt(t))) - t) + log(z));
    	elseif (t_1 <= 710.0)
    		tmp = Float64(log(Float64(z * fmax(x, y))) - fma(Float64(0.5 - a), log(t), t));
    	else
    		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
    	end
    	return 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.0], N[(N[(N[Log[N[(N[Max[x, y], $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 710.0], N[(N[Log[N[(z * N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $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:\\
    \;\;\;\;\left(\log \left(\frac{\mathsf{max}\left(x, y\right)}{\sqrt{t}}\right) - t\right) + \log z\\
    
    \mathbf{elif}\;t\_1 \leq 710:\\
    \;\;\;\;\log \left(z \cdot \mathsf{max}\left(x, y\right)\right) - \mathsf{fma}\left(0.5 - a, \log t, t\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
    
    
    \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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log \left(x + y\right) + -0.5 \cdot \log t\right)\right) - t \]
      4. Applied rewrites62.9%

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      7. Applied rewrites42.4%

        \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      8. Step-by-step derivation
        1. lift--.f64N/A

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

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

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

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

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

        \[\leadsto \left(\log \left(\frac{y}{\sqrt{t}}\right) - t\right) + \color{blue}{\log z} \]

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

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

          \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
        3. fp-cancel-sign-sub-invN/A

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

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

          \[\leadsto \color{blue}{\left(1 - \frac{\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t}{-1 \cdot t}\right) \cdot \left(-1 \cdot t\right)} \]
      6. Applied rewrites66.1%

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

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

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

        \[\leadsto \color{blue}{\left(1 - \frac{\log t \cdot \left(0.5 - a\right)}{\left(\log y + \log z\right) - t}\right) \cdot \left(\left(\log y + \log z\right) - t\right)} \]
      10. Step-by-step derivation
        1. sub-to-mult-rev69.3%

          \[\leadsto \color{blue}{\left(1 - \frac{\log t \cdot \left(0.5 - a\right)}{\left(\log y + \log z\right) - t}\right)} \cdot \left(\left(\log y + \log z\right) - t\right) \]
        2. sub-negate-rev69.3%

          \[\leadsto \left(1 - \frac{\color{blue}{\log t \cdot \left(0.5 - a\right)}}{\left(\log y + \log z\right) - t}\right) \cdot \left(\left(\log y + \log z\right) - t\right) \]
        3. fp-cancel-sign-sub-inv69.3%

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

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

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

          \[\leadsto \left(1 - \frac{\log t \cdot \left(\frac{1}{2} - a\right)}{\left(\log y + \log z\right) - t}\right) \cdot \left(\left(\log y + \color{blue}{\log z}\right) - t\right) \]
        7. sub-to-mult-revN/A

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

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

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

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

      if 710 < (+.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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in t around inf

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

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

    Alternative 7: 93.0% accurate, 0.3× 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 - 0.5\right) \cdot \log t\\ \mathbf{if}\;t\_1 \leq -200000:\\ \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\ \mathbf{elif}\;t\_1 \leq 1300:\\ \;\;\;\;\left(\log z + \left(-\log \left(\frac{\sqrt{t}}{\mathsf{max}\left(x, y\right)}\right)\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \end{array} \]
    (FPCore (x y z t a)
      :precision binary64
      (let* ((t_1
            (+
             (- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
             (* (- a 0.5) (log t)))))
      (if (<= t_1 -200000.0)
        (- (- t) (* (- 0.5 a) (log t)))
        (if (<= t_1 1300.0)
          (- (+ (log z) (- (log (/ (sqrt t) (fmax x y))))) t)
          (fma (- a 0.5) (log t) (- 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 <= -200000.0) {
    		tmp = -t - ((0.5 - a) * log(t));
    	} else if (t_1 <= 1300.0) {
    		tmp = (log(z) + -log((sqrt(t) / fmax(x, y)))) - t;
    	} else {
    		tmp = fma((a - 0.5), log(t), -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 <= -200000.0)
    		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
    	elseif (t_1 <= 1300.0)
    		tmp = Float64(Float64(log(z) + Float64(-log(Float64(sqrt(t) / fmax(x, y))))) - t);
    	else
    		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
    	end
    	return 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 - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1300.0], N[(N[(N[Log[z], $MachinePrecision] + (-N[Log[N[(N[Sqrt[t], $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $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 - 0.5\right) \cdot \log t\\
    \mathbf{if}\;t\_1 \leq -200000:\\
    \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
    
    \mathbf{elif}\;t\_1 \leq 1300:\\
    \;\;\;\;\left(\log z + \left(-\log \left(\frac{\sqrt{t}}{\mathsf{max}\left(x, y\right)}\right)\right)\right) - t\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
    
    
    \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))) < -2e5

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

          \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
        3. fp-cancel-sign-sub-invN/A

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

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

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

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

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t \]
        8. lower-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 \]
        9. lower-neg.f64N/A

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

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
        11. lower-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.4%

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

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

      1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log \left(x + y\right) + -0.5 \cdot \log t\right)\right) - t \]
      4. Applied rewrites62.9%

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      7. Applied rewrites42.4%

        \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      8. Step-by-step derivation
        1. lift-+.f64N/A

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

          \[\leadsto \left(\log z + \left(\log y + \frac{-1}{2} \cdot \log t\right)\right) - t \]
        3. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(\log z + \left(\log y - \left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot \log t\right)\right) - t \]
        4. sub-negate-revN/A

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

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

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

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

          \[\leadsto \left(\log z + \left(-\left(\log \left({t}^{\frac{1}{2}}\right) - \log y\right)\right)\right) - t \]
        9. pow1/2N/A

          \[\leadsto \left(\log z + \left(-\left(\log \left(\sqrt{t}\right) - \log y\right)\right)\right) - t \]
        10. lift-sqrt.f64N/A

          \[\leadsto \left(\log z + \left(-\left(\log \left(\sqrt{t}\right) - \log y\right)\right)\right) - t \]
        11. lift-log.f64N/A

          \[\leadsto \left(\log z + \left(-\left(\log \left(\sqrt{t}\right) - \log y\right)\right)\right) - t \]
        12. diff-logN/A

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

          \[\leadsto \left(\log z + \left(-\log \left(\frac{\sqrt{t}}{y}\right)\right)\right) - t \]
        14. lower-/.f6437.6%

          \[\leadsto \left(\log z + \left(-\log \left(\frac{\sqrt{t}}{y}\right)\right)\right) - t \]
      9. Applied rewrites37.6%

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

      if 1300 < (+.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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in t around inf

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

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

    Alternative 8: 92.3% accurate, 0.3× 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 - 0.5\right) \cdot \log t\\ \mathbf{if}\;t\_1 \leq -200000:\\ \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\ \mathbf{elif}\;t\_1 \leq 1200:\\ \;\;\;\;\left(\log \left(\frac{\mathsf{max}\left(x, y\right)}{\sqrt{t}}\right) - t\right) + \log z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \end{array} \]
    (FPCore (x y z t a)
      :precision binary64
      (let* ((t_1
            (+
             (- (+ (log (+ (fmin x y) (fmax x y))) (log z)) t)
             (* (- a 0.5) (log t)))))
      (if (<= t_1 -200000.0)
        (- (- t) (* (- 0.5 a) (log t)))
        (if (<= t_1 1200.0)
          (+ (- (log (/ (fmax x y) (sqrt t))) t) (log z))
          (fma (- a 0.5) (log t) (- 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 <= -200000.0) {
    		tmp = -t - ((0.5 - a) * log(t));
    	} else if (t_1 <= 1200.0) {
    		tmp = (log((fmax(x, y) / sqrt(t))) - t) + log(z);
    	} else {
    		tmp = fma((a - 0.5), log(t), -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 <= -200000.0)
    		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
    	elseif (t_1 <= 1200.0)
    		tmp = Float64(Float64(log(Float64(fmax(x, y) / sqrt(t))) - t) + log(z));
    	else
    		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
    	end
    	return 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 - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1200.0], N[(N[(N[Log[N[(N[Max[x, y], $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $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 - 0.5\right) \cdot \log t\\
    \mathbf{if}\;t\_1 \leq -200000:\\
    \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
    
    \mathbf{elif}\;t\_1 \leq 1200:\\
    \;\;\;\;\left(\log \left(\frac{\mathsf{max}\left(x, y\right)}{\sqrt{t}}\right) - t\right) + \log z\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
    
    
    \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))) < -2e5

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

          \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
        3. fp-cancel-sign-sub-invN/A

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

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

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

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

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t \]
        8. lower-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 \]
        9. lower-neg.f64N/A

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

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
        11. lower-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.4%

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

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

      1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log \left(x + y\right) + -0.5 \cdot \log t\right)\right) - t \]
      4. Applied rewrites62.9%

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      7. Applied rewrites42.4%

        \[\leadsto \left(\log z + \left(\log y + -0.5 \cdot \log t\right)\right) - t \]
      8. Step-by-step derivation
        1. lift--.f64N/A

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

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

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

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

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

        \[\leadsto \left(\log \left(\frac{y}{\sqrt{t}}\right) - t\right) + \color{blue}{\log z} \]

      if 1200 < (+.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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in t around inf

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

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

    Alternative 9: 91.2% accurate, 0.4× speedup?

    \[\begin{array}{l} t_1 := \left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\ \mathbf{if}\;t\_1 \leq -200000:\\ \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\ \mathbf{elif}\;t\_1 \leq 700:\\ \;\;\;\;\log \left(\frac{\left(x + y\right) \cdot z}{\sqrt{t}}\right) - t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\ \end{array} \]
    (FPCore (x y z t a)
      :precision binary64
      (let* ((t_1
            (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t)))))
      (if (<= t_1 -200000.0)
        (- (- t) (* (- 0.5 a) (log t)))
        (if (<= t_1 700.0)
          (- (log (/ (* (+ x y) z) (sqrt t))) t)
          (fma (- a 0.5) (log t) (- t))))))
    double code(double x, double y, double z, double t, double a) {
    	double t_1 = ((log((x + y)) + log(z)) - t) + ((a - 0.5) * log(t));
    	double tmp;
    	if (t_1 <= -200000.0) {
    		tmp = -t - ((0.5 - a) * log(t));
    	} else if (t_1 <= 700.0) {
    		tmp = log((((x + y) * z) / sqrt(t))) - t;
    	} else {
    		tmp = fma((a - 0.5), log(t), -t);
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a)
    	t_1 = Float64(Float64(Float64(log(Float64(x + y)) + log(z)) - t) + Float64(Float64(a - 0.5) * log(t)))
    	tmp = 0.0
    	if (t_1 <= -200000.0)
    		tmp = Float64(Float64(-t) - Float64(Float64(0.5 - a) * log(t)));
    	elseif (t_1 <= 700.0)
    		tmp = Float64(log(Float64(Float64(Float64(x + y) * z) / sqrt(t))) - t);
    	else
    		tmp = fma(Float64(a - 0.5), log(t), Float64(-t));
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -200000.0], N[((-t) - N[(N[(0.5 - a), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700.0], N[(N[Log[N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]]]]
    
    \begin{array}{l}
    t_1 := \left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t\\
    \mathbf{if}\;t\_1 \leq -200000:\\
    \;\;\;\;\left(-t\right) - \left(0.5 - a\right) \cdot \log t\\
    
    \mathbf{elif}\;t\_1 \leq 700:\\
    \;\;\;\;\log \left(\frac{\left(x + y\right) \cdot z}{\sqrt{t}}\right) - t\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(a - 0.5, \log t, -t\right)\\
    
    
    \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))) < -2e5

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

          \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
        3. fp-cancel-sign-sub-invN/A

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

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

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

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

          \[\leadsto \left(-t\right) - \left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t \]
        8. lower-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 \]
        9. lower-neg.f64N/A

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

          \[\leadsto \left(-t\right) - \mathsf{Rewrite=>}\left(lower-*.f64, \left(\left(\frac{1}{2} - a\right) \cdot \log t\right)\right) \]
        11. lower-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.4%

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

      if -2e5 < (+.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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log z + \left(\log \left(x + y\right) + -0.5 \cdot \log t\right)\right) - t \]
      4. Applied rewrites62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\log \left(\left(x + y\right) \cdot z\right) - \left(\mathsf{neg}\left(\log \left({t}^{\frac{-1}{2}}\right)\right)\right)\right) - t \]
        18. neg-logN/A

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

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

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

        \[\leadsto \log \left(\frac{\left(x + y\right) \cdot z}{\sqrt{t}}\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 - 0.5\right) \cdot \log t \]
      2. Taylor expanded in t around inf

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
        7. lower-neg.f6477.4%

          \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
      6. Applied rewrites77.4%

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

    Alternative 10: 77.4% accurate, 2.2× speedup?

    \[\mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
    (FPCore (x y z t a)
      :precision binary64
      (fma (- a 0.5) (log t) (- t)))
    double code(double x, double y, double z, double t, double a) {
    	return fma((a - 0.5), log(t), -t);
    }
    
    function code(x, y, z, t, a)
    	return fma(Float64(a - 0.5), log(t), Float64(-t))
    end
    
    code[x_, y_, z_, t_, a_] := N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision] + (-t)), $MachinePrecision]
    
    \mathsf{fma}\left(a - 0.5, \log t, -t\right)
    
    Derivation
    1. Initial program 99.6%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. +-commutativeN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, \log t, \mathsf{neg}\left(t\right)\right) \]
      7. lower-neg.f6477.4%

        \[\leadsto \mathsf{fma}\left(a - 0.5, \log t, -t\right) \]
    6. Applied rewrites77.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, \log t, -t\right)} \]
    7. Add Preprocessing

    Alternative 11: 65.0% accurate, 1.7× speedup?

    \[\begin{array}{l} t_1 := a \cdot \log t\\ \mathbf{if}\;a \leq -2 \cdot 10^{+59}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 2 \cdot 10^{+14}:\\ \;\;\;\;\mathsf{fma}\left(\log t, -0.5, -t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t a)
      :precision binary64
      (let* ((t_1 (* a (log t))))
      (if (<= a -2e+59)
        t_1
        (if (<= a 2e+14) (fma (log t) -0.5 (- t)) t_1))))
    double code(double x, double y, double z, double t, double a) {
    	double t_1 = a * log(t);
    	double tmp;
    	if (a <= -2e+59) {
    		tmp = t_1;
    	} else if (a <= 2e+14) {
    		tmp = fma(log(t), -0.5, -t);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a)
    	t_1 = Float64(a * log(t))
    	tmp = 0.0
    	if (a <= -2e+59)
    		tmp = t_1;
    	elseif (a <= 2e+14)
    		tmp = fma(log(t), -0.5, Float64(-t));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2e+59], t$95$1, If[LessEqual[a, 2e+14], N[(N[Log[t], $MachinePrecision] * -0.5 + (-t)), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := a \cdot \log t\\
    \mathbf{if}\;a \leq -2 \cdot 10^{+59}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;a \leq 2 \cdot 10^{+14}:\\
    \;\;\;\;\mathsf{fma}\left(\log t, -0.5, -t\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -1.9999999999999999e59 or 2e14 < a

      1. Initial program 99.6%

        \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
      2. Step-by-step derivation
        1. 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. associate-+l-N/A

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

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

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

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

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

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

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

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

          \[\leadsto a \cdot \color{blue}{\log t} \]
        2. lower-log.f6437.9%

          \[\leadsto a \cdot \log t \]
      6. Applied rewrites37.9%

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

      if -1.9999999999999999e59 < a < 2e14

      1. Initial program 99.6%

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

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

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

        \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. Applied rewrites41.8%

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

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

            \[\leadsto \color{blue}{\frac{-1}{2} \cdot \log t + -1 \cdot t} \]
          3. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\log t \cdot \frac{-1}{2}} + -1 \cdot t \]
          5. lift-*.f64N/A

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

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

            \[\leadsto \log t \cdot \frac{-1}{2} + \left(-t\right) \]
          8. lower-fma.f6441.8%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\log t, -0.5, -t\right)} \]
        3. Applied rewrites41.8%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\log t, -0.5, -t\right)} \]
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 12: 62.7% accurate, 2.5× speedup?

      \[\begin{array}{l} \mathbf{if}\;t \leq 2.2 \cdot 10^{+38}:\\ \;\;\;\;a \cdot \log t\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-t\right)\\ \end{array} \]
      (FPCore (x y z t a)
        :precision binary64
        (if (<= t 2.2e+38) (* a (log t)) (* 1.0 (- t))))
      double code(double x, double y, double z, double t, double a) {
      	double tmp;
      	if (t <= 2.2e+38) {
      		tmp = a * log(t);
      	} else {
      		tmp = 1.0 * -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 <= 2.2d+38) then
              tmp = a * log(t)
          else
              tmp = 1.0d0 * -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 <= 2.2e+38) {
      		tmp = a * Math.log(t);
      	} else {
      		tmp = 1.0 * -t;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t, a):
      	tmp = 0
      	if t <= 2.2e+38:
      		tmp = a * math.log(t)
      	else:
      		tmp = 1.0 * -t
      	return tmp
      
      function code(x, y, z, t, a)
      	tmp = 0.0
      	if (t <= 2.2e+38)
      		tmp = Float64(a * log(t));
      	else
      		tmp = Float64(1.0 * Float64(-t));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t, a)
      	tmp = 0.0;
      	if (t <= 2.2e+38)
      		tmp = a * log(t);
      	else
      		tmp = 1.0 * -t;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2.2e+38], N[(a * N[Log[t], $MachinePrecision]), $MachinePrecision], N[(1.0 * (-t)), $MachinePrecision]]
      
      \begin{array}{l}
      \mathbf{if}\;t \leq 2.2 \cdot 10^{+38}:\\
      \;\;\;\;a \cdot \log t\\
      
      \mathbf{else}:\\
      \;\;\;\;1 \cdot \left(-t\right)\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if t < 2.2000000000000001e38

        1. Initial program 99.6%

          \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
        2. Step-by-step derivation
          1. 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. associate-+l-N/A

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

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

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

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

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

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

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

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

            \[\leadsto a \cdot \color{blue}{\log t} \]
          2. lower-log.f6437.9%

            \[\leadsto a \cdot \log t \]
        6. Applied rewrites37.9%

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

        if 2.2000000000000001e38 < t

        1. Initial program 99.6%

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

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

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

          \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

            \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
          3. fp-cancel-sign-sub-invN/A

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

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

            \[\leadsto \color{blue}{\left(1 - \frac{\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t}{-1 \cdot t}\right) \cdot \left(-1 \cdot t\right)} \]
        6. Applied rewrites66.1%

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

          \[\leadsto \color{blue}{1} \cdot \left(-t\right) \]
        8. Step-by-step derivation
          1. Applied rewrites39.0%

            \[\leadsto \color{blue}{1} \cdot \left(-t\right) \]
        9. Recombined 2 regimes into one program.
        10. Add Preprocessing

        Alternative 13: 39.0% accurate, 7.0× speedup?

        \[1 \cdot \left(-t\right) \]
        (FPCore (x y z t a)
          :precision binary64
          (* 1.0 (- t)))
        double code(double x, double y, double z, double t, double a) {
        	return 1.0 * -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
        end function
        
        public static double code(double x, double y, double z, double t, double a) {
        	return 1.0 * -t;
        }
        
        def code(x, y, z, t, a):
        	return 1.0 * -t
        
        function code(x, y, z, t, a)
        	return Float64(1.0 * Float64(-t))
        end
        
        function tmp = code(x, y, z, t, a)
        	tmp = 1.0 * -t;
        end
        
        code[x_, y_, z_, t_, a_] := N[(1.0 * (-t)), $MachinePrecision]
        
        1 \cdot \left(-t\right)
        
        Derivation
        1. Initial program 99.6%

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

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

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

          \[\leadsto \color{blue}{-1 \cdot t} + \left(a - 0.5\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. lift-*.f64N/A

            \[\leadsto -1 \cdot t + \color{blue}{\left(a - \frac{1}{2}\right) \cdot \log t} \]
          3. fp-cancel-sign-sub-invN/A

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

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

            \[\leadsto \color{blue}{\left(1 - \frac{\left(\mathsf{neg}\left(\left(a - \frac{1}{2}\right)\right)\right) \cdot \log t}{-1 \cdot t}\right) \cdot \left(-1 \cdot t\right)} \]
        6. Applied rewrites66.1%

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

          \[\leadsto \color{blue}{1} \cdot \left(-t\right) \]
        8. Step-by-step derivation
          1. Applied rewrites39.0%

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

          Reproduce

          ?
          herbie shell --seed 2025212 
          (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 0.5) (log t))))