Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2

Percentage Accurate: 99.6% → 99.6%
Time: 21.0s
Alternatives: 19
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 19 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.8× speedup?

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

\\
\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)
\end{array}
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. associate-+l-99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 89.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log t \cdot \left(a - 0.5\right)\\ t_2 := \log \left(x + y\right)\\ t_3 := t_2 + \log z\\ t_4 := \left(\log z + \log y\right) + t_1\\ \mathbf{if}\;t_3 \leq -740:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_3 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + t_1\right) - t\\ \mathbf{elif}\;t_3 \leq 1220:\\ \;\;\;\;t_2 + \left(\log z - \left(\log t \cdot 0.5 + t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (log t) (- a 0.5)))
        (t_2 (log (+ x y)))
        (t_3 (+ t_2 (log z)))
        (t_4 (+ (+ (log z) (log y)) t_1)))
   (if (<= t_3 -740.0)
     t_4
     (if (<= t_3 700.0)
       (- (+ (log (* z (+ x y))) t_1) t)
       (if (<= t_3 1220.0) (+ t_2 (- (log z) (+ (* (log t) 0.5) t))) t_4)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log(t) * (a - 0.5);
	double t_2 = log((x + y));
	double t_3 = t_2 + log(z);
	double t_4 = (log(z) + log(y)) + t_1;
	double tmp;
	if (t_3 <= -740.0) {
		tmp = t_4;
	} else if (t_3 <= 700.0) {
		tmp = (log((z * (x + y))) + t_1) - t;
	} else if (t_3 <= 1220.0) {
		tmp = t_2 + (log(z) - ((log(t) * 0.5) + t));
	} else {
		tmp = t_4;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = log(t) * (a - 0.5d0)
    t_2 = log((x + y))
    t_3 = t_2 + log(z)
    t_4 = (log(z) + log(y)) + t_1
    if (t_3 <= (-740.0d0)) then
        tmp = t_4
    else if (t_3 <= 700.0d0) then
        tmp = (log((z * (x + y))) + t_1) - t
    else if (t_3 <= 1220.0d0) then
        tmp = t_2 + (log(z) - ((log(t) * 0.5d0) + t))
    else
        tmp = t_4
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log(t) * (a - 0.5);
	double t_2 = Math.log((x + y));
	double t_3 = t_2 + Math.log(z);
	double t_4 = (Math.log(z) + Math.log(y)) + t_1;
	double tmp;
	if (t_3 <= -740.0) {
		tmp = t_4;
	} else if (t_3 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + t_1) - t;
	} else if (t_3 <= 1220.0) {
		tmp = t_2 + (Math.log(z) - ((Math.log(t) * 0.5) + t));
	} else {
		tmp = t_4;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log(t) * (a - 0.5)
	t_2 = math.log((x + y))
	t_3 = t_2 + math.log(z)
	t_4 = (math.log(z) + math.log(y)) + t_1
	tmp = 0
	if t_3 <= -740.0:
		tmp = t_4
	elif t_3 <= 700.0:
		tmp = (math.log((z * (x + y))) + t_1) - t
	elif t_3 <= 1220.0:
		tmp = t_2 + (math.log(z) - ((math.log(t) * 0.5) + t))
	else:
		tmp = t_4
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(t) * Float64(a - 0.5))
	t_2 = log(Float64(x + y))
	t_3 = Float64(t_2 + log(z))
	t_4 = Float64(Float64(log(z) + log(y)) + t_1)
	tmp = 0.0
	if (t_3 <= -740.0)
		tmp = t_4;
	elseif (t_3 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + t_1) - t);
	elseif (t_3 <= 1220.0)
		tmp = Float64(t_2 + Float64(log(z) - Float64(Float64(log(t) * 0.5) + t)));
	else
		tmp = t_4;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log(t) * (a - 0.5);
	t_2 = log((x + y));
	t_3 = t_2 + log(z);
	t_4 = (log(z) + log(y)) + t_1;
	tmp = 0.0;
	if (t_3 <= -740.0)
		tmp = t_4;
	elseif (t_3 <= 700.0)
		tmp = (log((z * (x + y))) + t_1) - t;
	elseif (t_3 <= 1220.0)
		tmp = t_2 + (log(z) - ((log(t) * 0.5) + t));
	else
		tmp = t_4;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -740.0], t$95$4, If[LessEqual[t$95$3, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$3, 1220.0], N[(t$95$2 + N[(N[Log[z], $MachinePrecision] - N[(N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log t \cdot \left(a - 0.5\right)\\
t_2 := \log \left(x + y\right)\\
t_3 := t_2 + \log z\\
t_4 := \left(\log z + \log y\right) + t_1\\
\mathbf{if}\;t_3 \leq -740:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t_3 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + t_1\right) - t\\

\mathbf{elif}\;t_3 \leq 1220:\\
\;\;\;\;t_2 + \left(\log z - \left(\log t \cdot 0.5 + t\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_4\\


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1220

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 1220:\\ \;\;\;\;\log \left(x + y\right) + \left(\log z - \left(\log t \cdot 0.5 + t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 85.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log t \cdot \left(a - 0.5\right)\\ t_2 := \log \left(x + y\right) + \log z\\ t_3 := \left(\log z + \log y\right) + t_1\\ \mathbf{if}\;t_2 \leq -740:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + t_1\right) - t\\ \mathbf{elif}\;t_2 \leq 1220:\\ \;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (log t) (- a 0.5)))
        (t_2 (+ (log (+ x y)) (log z)))
        (t_3 (+ (+ (log z) (log y)) t_1)))
   (if (<= t_2 -740.0)
     t_3
     (if (<= t_2 700.0)
       (- (+ (log (* z (+ x y))) t_1) t)
       (if (<= t_2 1220.0)
         (- (+ (log y) (+ (log z) (* (log t) -0.5))) t)
         t_3)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log(t) * (a - 0.5);
	double t_2 = log((x + y)) + log(z);
	double t_3 = (log(z) + log(y)) + t_1;
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_3;
	} else if (t_2 <= 700.0) {
		tmp = (log((z * (x + y))) + t_1) - t;
	} else if (t_2 <= 1220.0) {
		tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = log(t) * (a - 0.5d0)
    t_2 = log((x + y)) + log(z)
    t_3 = (log(z) + log(y)) + t_1
    if (t_2 <= (-740.0d0)) then
        tmp = t_3
    else if (t_2 <= 700.0d0) then
        tmp = (log((z * (x + y))) + t_1) - t
    else if (t_2 <= 1220.0d0) then
        tmp = (log(y) + (log(z) + (log(t) * (-0.5d0)))) - t
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log(t) * (a - 0.5);
	double t_2 = Math.log((x + y)) + Math.log(z);
	double t_3 = (Math.log(z) + Math.log(y)) + t_1;
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_3;
	} else if (t_2 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + t_1) - t;
	} else if (t_2 <= 1220.0) {
		tmp = (Math.log(y) + (Math.log(z) + (Math.log(t) * -0.5))) - t;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log(t) * (a - 0.5)
	t_2 = math.log((x + y)) + math.log(z)
	t_3 = (math.log(z) + math.log(y)) + t_1
	tmp = 0
	if t_2 <= -740.0:
		tmp = t_3
	elif t_2 <= 700.0:
		tmp = (math.log((z * (x + y))) + t_1) - t
	elif t_2 <= 1220.0:
		tmp = (math.log(y) + (math.log(z) + (math.log(t) * -0.5))) - t
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(t) * Float64(a - 0.5))
	t_2 = Float64(log(Float64(x + y)) + log(z))
	t_3 = Float64(Float64(log(z) + log(y)) + t_1)
	tmp = 0.0
	if (t_2 <= -740.0)
		tmp = t_3;
	elseif (t_2 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + t_1) - t);
	elseif (t_2 <= 1220.0)
		tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * -0.5))) - t);
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log(t) * (a - 0.5);
	t_2 = log((x + y)) + log(z);
	t_3 = (log(z) + log(y)) + t_1;
	tmp = 0.0;
	if (t_2 <= -740.0)
		tmp = t_3;
	elseif (t_2 <= 700.0)
		tmp = (log((z * (x + y))) + t_1) - t;
	elseif (t_2 <= 1220.0)
		tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -740.0], t$95$3, If[LessEqual[t$95$2, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 1220.0], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log t \cdot \left(a - 0.5\right)\\
t_2 := \log \left(x + y\right) + \log z\\
t_3 := \left(\log z + \log y\right) + t_1\\
\mathbf{if}\;t_2 \leq -740:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + t_1\right) - t\\

\mathbf{elif}\;t_2 \leq 1220:\\
\;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\

\mathbf{else}:\\
\;\;\;\;t_3\\


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1220

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 1220:\\ \;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log z + \log y\\ t_2 := \log t \cdot \left(a - 0.5\right)\\ t_3 := \log \left(x + y\right) + \log z\\ t_4 := t_1 + t_2\\ \mathbf{if}\;t_3 \leq -740:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_3 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + t_2\right) - t\\ \mathbf{elif}\;t_3 \leq 1220:\\ \;\;\;\;t_1 - \left(\log t \cdot 0.5 + t\right)\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ (log z) (log y)))
        (t_2 (* (log t) (- a 0.5)))
        (t_3 (+ (log (+ x y)) (log z)))
        (t_4 (+ t_1 t_2)))
   (if (<= t_3 -740.0)
     t_4
     (if (<= t_3 700.0)
       (- (+ (log (* z (+ x y))) t_2) t)
       (if (<= t_3 1220.0) (- t_1 (+ (* (log t) 0.5) t)) t_4)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log(z) + log(y);
	double t_2 = log(t) * (a - 0.5);
	double t_3 = log((x + y)) + log(z);
	double t_4 = t_1 + t_2;
	double tmp;
	if (t_3 <= -740.0) {
		tmp = t_4;
	} else if (t_3 <= 700.0) {
		tmp = (log((z * (x + y))) + t_2) - t;
	} else if (t_3 <= 1220.0) {
		tmp = t_1 - ((log(t) * 0.5) + t);
	} else {
		tmp = t_4;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = log(z) + log(y)
    t_2 = log(t) * (a - 0.5d0)
    t_3 = log((x + y)) + log(z)
    t_4 = t_1 + t_2
    if (t_3 <= (-740.0d0)) then
        tmp = t_4
    else if (t_3 <= 700.0d0) then
        tmp = (log((z * (x + y))) + t_2) - t
    else if (t_3 <= 1220.0d0) then
        tmp = t_1 - ((log(t) * 0.5d0) + t)
    else
        tmp = t_4
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log(z) + Math.log(y);
	double t_2 = Math.log(t) * (a - 0.5);
	double t_3 = Math.log((x + y)) + Math.log(z);
	double t_4 = t_1 + t_2;
	double tmp;
	if (t_3 <= -740.0) {
		tmp = t_4;
	} else if (t_3 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + t_2) - t;
	} else if (t_3 <= 1220.0) {
		tmp = t_1 - ((Math.log(t) * 0.5) + t);
	} else {
		tmp = t_4;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log(z) + math.log(y)
	t_2 = math.log(t) * (a - 0.5)
	t_3 = math.log((x + y)) + math.log(z)
	t_4 = t_1 + t_2
	tmp = 0
	if t_3 <= -740.0:
		tmp = t_4
	elif t_3 <= 700.0:
		tmp = (math.log((z * (x + y))) + t_2) - t
	elif t_3 <= 1220.0:
		tmp = t_1 - ((math.log(t) * 0.5) + t)
	else:
		tmp = t_4
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(z) + log(y))
	t_2 = Float64(log(t) * Float64(a - 0.5))
	t_3 = Float64(log(Float64(x + y)) + log(z))
	t_4 = Float64(t_1 + t_2)
	tmp = 0.0
	if (t_3 <= -740.0)
		tmp = t_4;
	elseif (t_3 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + t_2) - t);
	elseif (t_3 <= 1220.0)
		tmp = Float64(t_1 - Float64(Float64(log(t) * 0.5) + t));
	else
		tmp = t_4;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log(z) + log(y);
	t_2 = log(t) * (a - 0.5);
	t_3 = log((x + y)) + log(z);
	t_4 = t_1 + t_2;
	tmp = 0.0;
	if (t_3 <= -740.0)
		tmp = t_4;
	elseif (t_3 <= 700.0)
		tmp = (log((z * (x + y))) + t_2) - t;
	elseif (t_3 <= 1220.0)
		tmp = t_1 - ((log(t) * 0.5) + t);
	else
		tmp = t_4;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -740.0], t$95$4, If[LessEqual[t$95$3, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$3, 1220.0], N[(t$95$1 - N[(N[(N[Log[t], $MachinePrecision] * 0.5), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log z + \log y\\
t_2 := \log t \cdot \left(a - 0.5\right)\\
t_3 := \log \left(x + y\right) + \log z\\
t_4 := t_1 + t_2\\
\mathbf{if}\;t_3 \leq -740:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t_3 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + t_2\right) - t\\

\mathbf{elif}\;t_3 \leq 1220:\\
\;\;\;\;t_1 - \left(\log t \cdot 0.5 + t\right)\\

\mathbf{else}:\\
\;\;\;\;t_4\\


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1220

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 1220:\\ \;\;\;\;\left(\log z + \log y\right) - \left(\log t \cdot 0.5 + t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot \left(a - 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 57.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log \left(x + y\right)\\ t_2 := t_1 + \log z\\ t_3 := t_1 + \log t \cdot a\\ \mathbf{if}\;t_2 \leq -740:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq 700:\\ \;\;\;\;\left(\log \left(y \cdot z\right) - t\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;t_2 \leq 1220:\\ \;\;\;\;\left(\log z + \log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (log (+ x y))) (t_2 (+ t_1 (log z))) (t_3 (+ t_1 (* (log t) a))))
   (if (<= t_2 -740.0)
     t_3
     (if (<= t_2 700.0)
       (+ (- (log (* y z)) t) (* (log t) (- a 0.5)))
       (if (<= t_2 1220.0) (- (+ (log z) (log y)) t) t_3)))))
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);
	double t_3 = t_1 + (log(t) * a);
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_3;
	} else if (t_2 <= 700.0) {
		tmp = (log((y * z)) - t) + (log(t) * (a - 0.5));
	} else if (t_2 <= 1220.0) {
		tmp = (log(z) + log(y)) - t;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = log((x + y))
    t_2 = t_1 + log(z)
    t_3 = t_1 + (log(t) * a)
    if (t_2 <= (-740.0d0)) then
        tmp = t_3
    else if (t_2 <= 700.0d0) then
        tmp = (log((y * z)) - t) + (log(t) * (a - 0.5d0))
    else if (t_2 <= 1220.0d0) then
        tmp = (log(z) + log(y)) - t
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log((x + y));
	double t_2 = t_1 + Math.log(z);
	double t_3 = t_1 + (Math.log(t) * a);
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_3;
	} else if (t_2 <= 700.0) {
		tmp = (Math.log((y * z)) - t) + (Math.log(t) * (a - 0.5));
	} else if (t_2 <= 1220.0) {
		tmp = (Math.log(z) + Math.log(y)) - t;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log((x + y))
	t_2 = t_1 + math.log(z)
	t_3 = t_1 + (math.log(t) * a)
	tmp = 0
	if t_2 <= -740.0:
		tmp = t_3
	elif t_2 <= 700.0:
		tmp = (math.log((y * z)) - t) + (math.log(t) * (a - 0.5))
	elif t_2 <= 1220.0:
		tmp = (math.log(z) + math.log(y)) - t
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a)
	t_1 = log(Float64(x + y))
	t_2 = Float64(t_1 + log(z))
	t_3 = Float64(t_1 + Float64(log(t) * a))
	tmp = 0.0
	if (t_2 <= -740.0)
		tmp = t_3;
	elseif (t_2 <= 700.0)
		tmp = Float64(Float64(log(Float64(y * z)) - t) + Float64(log(t) * Float64(a - 0.5)));
	elseif (t_2 <= 1220.0)
		tmp = Float64(Float64(log(z) + log(y)) - t);
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log((x + y));
	t_2 = t_1 + log(z);
	t_3 = t_1 + (log(t) * a);
	tmp = 0.0;
	if (t_2 <= -740.0)
		tmp = t_3;
	elseif (t_2 <= 700.0)
		tmp = (log((y * z)) - t) + (log(t) * (a - 0.5));
	elseif (t_2 <= 1220.0)
		tmp = (log(z) + log(y)) - t;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -740.0], t$95$3, If[LessEqual[t$95$2, 700.0], N[(N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1220.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := t_1 + \log z\\
t_3 := t_1 + \log t \cdot a\\
\mathbf{if}\;t_2 \leq -740:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq 700:\\
\;\;\;\;\left(\log \left(y \cdot z\right) - t\right) + \log t \cdot \left(a - 0.5\right)\\

\mathbf{elif}\;t_2 \leq 1220:\\
\;\;\;\;\left(\log z + \log y\right) - t\\

\mathbf{else}:\\
\;\;\;\;t_3\\


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(x + y\right) + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. *-commutative56.4%

        \[\leadsto \log \left(x + y\right) + \color{blue}{\log t \cdot a} \]
    7. Simplified56.4%

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1220

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\log \left(x + y\right) + \log t \cdot a\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(y \cdot z\right) - t\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 1220:\\ \;\;\;\;\left(\log z + \log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + y\right) + \log t \cdot a\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 83.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log \left(x + y\right)\\ t_2 := t_1 + \log z\\ t_3 := t_1 + \log t \cdot a\\ \mathbf{if}\;t_2 \leq -740:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{elif}\;t_2 \leq 1220:\\ \;\;\;\;\left(\log z + \log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (log (+ x y))) (t_2 (+ t_1 (log z))) (t_3 (+ t_1 (* (log t) a))))
   (if (<= t_2 -740.0)
     t_3
     (if (<= t_2 700.0)
       (- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t)
       (if (<= t_2 1220.0) (- (+ (log z) (log y)) t) t_3)))))
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);
	double t_3 = t_1 + (log(t) * a);
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_3;
	} else if (t_2 <= 700.0) {
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	} else if (t_2 <= 1220.0) {
		tmp = (log(z) + log(y)) - t;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = log((x + y))
    t_2 = t_1 + log(z)
    t_3 = t_1 + (log(t) * a)
    if (t_2 <= (-740.0d0)) then
        tmp = t_3
    else if (t_2 <= 700.0d0) then
        tmp = (log((z * (x + y))) + (log(t) * (a - 0.5d0))) - t
    else if (t_2 <= 1220.0d0) then
        tmp = (log(z) + log(y)) - t
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log((x + y));
	double t_2 = t_1 + Math.log(z);
	double t_3 = t_1 + (Math.log(t) * a);
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_3;
	} else if (t_2 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + (Math.log(t) * (a - 0.5))) - t;
	} else if (t_2 <= 1220.0) {
		tmp = (Math.log(z) + Math.log(y)) - t;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log((x + y))
	t_2 = t_1 + math.log(z)
	t_3 = t_1 + (math.log(t) * a)
	tmp = 0
	if t_2 <= -740.0:
		tmp = t_3
	elif t_2 <= 700.0:
		tmp = (math.log((z * (x + y))) + (math.log(t) * (a - 0.5))) - t
	elif t_2 <= 1220.0:
		tmp = (math.log(z) + math.log(y)) - t
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a)
	t_1 = log(Float64(x + y))
	t_2 = Float64(t_1 + log(z))
	t_3 = Float64(t_1 + Float64(log(t) * a))
	tmp = 0.0
	if (t_2 <= -740.0)
		tmp = t_3;
	elseif (t_2 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t);
	elseif (t_2 <= 1220.0)
		tmp = Float64(Float64(log(z) + log(y)) - t);
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log((x + y));
	t_2 = t_1 + log(z);
	t_3 = t_1 + (log(t) * a);
	tmp = 0.0;
	if (t_2 <= -740.0)
		tmp = t_3;
	elseif (t_2 <= 700.0)
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	elseif (t_2 <= 1220.0)
		tmp = (log(z) + log(y)) - t;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -740.0], t$95$3, If[LessEqual[t$95$2, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 1220.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := t_1 + \log z\\
t_3 := t_1 + \log t \cdot a\\
\mathbf{if}\;t_2 \leq -740:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\

\mathbf{elif}\;t_2 \leq 1220:\\
\;\;\;\;\left(\log z + \log y\right) - t\\

\mathbf{else}:\\
\;\;\;\;t_3\\


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(x + y\right) + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. *-commutative56.4%

        \[\leadsto \log \left(x + y\right) + \color{blue}{\log t \cdot a} \]
    7. Simplified56.4%

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 1220

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\log \left(x + y\right) + \log t \cdot a\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 1220:\\ \;\;\;\;\left(\log z + \log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + y\right) + \log t \cdot a\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 85.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log \left(x + y\right) + \log z\\ \mathbf{if}\;t_1 \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot a\\ \mathbf{elif}\;t_1 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ (log (+ x y)) (log z))))
   (if (<= t_1 -740.0)
     (+ (+ (log z) (log y)) (* (log t) a))
     (if (<= t_1 700.0)
       (- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t)
       (- (+ (log y) (+ (log z) (* (log t) -0.5))) t)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log((x + y)) + log(z);
	double tmp;
	if (t_1 <= -740.0) {
		tmp = (log(z) + log(y)) + (log(t) * a);
	} else if (t_1 <= 700.0) {
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	} else {
		tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = log((x + y)) + log(z)
    if (t_1 <= (-740.0d0)) then
        tmp = (log(z) + log(y)) + (log(t) * a)
    else if (t_1 <= 700.0d0) then
        tmp = (log((z * (x + y))) + (log(t) * (a - 0.5d0))) - t
    else
        tmp = (log(y) + (log(z) + (log(t) * (-0.5d0)))) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log((x + y)) + Math.log(z);
	double tmp;
	if (t_1 <= -740.0) {
		tmp = (Math.log(z) + Math.log(y)) + (Math.log(t) * a);
	} else if (t_1 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + (Math.log(t) * (a - 0.5))) - t;
	} else {
		tmp = (Math.log(y) + (Math.log(z) + (Math.log(t) * -0.5))) - t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log((x + y)) + math.log(z)
	tmp = 0
	if t_1 <= -740.0:
		tmp = (math.log(z) + math.log(y)) + (math.log(t) * a)
	elif t_1 <= 700.0:
		tmp = (math.log((z * (x + y))) + (math.log(t) * (a - 0.5))) - t
	else:
		tmp = (math.log(y) + (math.log(z) + (math.log(t) * -0.5))) - t
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(Float64(x + y)) + log(z))
	tmp = 0.0
	if (t_1 <= -740.0)
		tmp = Float64(Float64(log(z) + log(y)) + Float64(log(t) * a));
	elseif (t_1 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t);
	else
		tmp = Float64(Float64(log(y) + Float64(log(z) + Float64(log(t) * -0.5))) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log((x + y)) + log(z);
	tmp = 0.0;
	if (t_1 <= -740.0)
		tmp = (log(z) + log(y)) + (log(t) * a);
	elseif (t_1 <= 700.0)
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	else
		tmp = (log(y) + (log(z) + (log(t) * -0.5))) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -740.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] + N[(N[Log[z], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t_1 \leq -740:\\
\;\;\;\;\left(\log z + \log y\right) + \log t \cdot a\\

\mathbf{elif}\;t_1 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\log z + \log y\right) - \color{blue}{\log t \cdot \left(-a\right)} \]
    10. Simplified33.6%

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.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. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot a\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(\log y + \left(\log z + \log t \cdot -0.5\right)\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 84.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log \left(x + y\right)\\ t_2 := t_1 + \log z\\ \mathbf{if}\;t_2 \leq -740:\\ \;\;\;\;t_1 + \log t \cdot a\\ \mathbf{elif}\;t_2 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log y + \left(\log \left(z \cdot {t}^{-0.5}\right) - t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (log (+ x y))) (t_2 (+ t_1 (log z))))
   (if (<= t_2 -740.0)
     (+ t_1 (* (log t) a))
     (if (<= t_2 700.0)
       (- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t)
       (+ (log y) (- (log (* z (pow t -0.5))) 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);
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_1 + (log(t) * a);
	} else if (t_2 <= 700.0) {
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	} else {
		tmp = log(y) + (log((z * pow(t, -0.5))) - t);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = log((x + y))
    t_2 = t_1 + log(z)
    if (t_2 <= (-740.0d0)) then
        tmp = t_1 + (log(t) * a)
    else if (t_2 <= 700.0d0) then
        tmp = (log((z * (x + y))) + (log(t) * (a - 0.5d0))) - t
    else
        tmp = log(y) + (log((z * (t ** (-0.5d0)))) - t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log((x + y));
	double t_2 = t_1 + Math.log(z);
	double tmp;
	if (t_2 <= -740.0) {
		tmp = t_1 + (Math.log(t) * a);
	} else if (t_2 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + (Math.log(t) * (a - 0.5))) - t;
	} else {
		tmp = Math.log(y) + (Math.log((z * Math.pow(t, -0.5))) - t);
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log((x + y))
	t_2 = t_1 + math.log(z)
	tmp = 0
	if t_2 <= -740.0:
		tmp = t_1 + (math.log(t) * a)
	elif t_2 <= 700.0:
		tmp = (math.log((z * (x + y))) + (math.log(t) * (a - 0.5))) - t
	else:
		tmp = math.log(y) + (math.log((z * math.pow(t, -0.5))) - t)
	return tmp
function code(x, y, z, t, a)
	t_1 = log(Float64(x + y))
	t_2 = Float64(t_1 + log(z))
	tmp = 0.0
	if (t_2 <= -740.0)
		tmp = Float64(t_1 + Float64(log(t) * a));
	elseif (t_2 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t);
	else
		tmp = Float64(log(y) + Float64(log(Float64(z * (t ^ -0.5))) - t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log((x + y));
	t_2 = t_1 + log(z);
	tmp = 0.0;
	if (t_2 <= -740.0)
		tmp = t_1 + (log(t) * a);
	elseif (t_2 <= 700.0)
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	else
		tmp = log(y) + (log((z * (t ^ -0.5))) - t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -740.0], N[(t$95$1 + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] + N[(N[Log[N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log \left(x + y\right)\\
t_2 := t_1 + \log z\\
\mathbf{if}\;t_2 \leq -740:\\
\;\;\;\;t_1 + \log t \cdot a\\

\mathbf{elif}\;t_2 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(x + y\right) + \color{blue}{\log t \cdot a} \]
    7. Simplified54.6%

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.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. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + -0.5 \cdot \log t\right)\right)} - t \]
    9. Step-by-step derivation
      1. associate--l+30.7%

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

        \[\leadsto \log y + \left(\left(\log z + \color{blue}{\log \left(e^{-0.5 \cdot \log t}\right)}\right) - t\right) \]
      3. sum-log30.4%

        \[\leadsto \log y + \left(\color{blue}{\log \left(z \cdot e^{-0.5 \cdot \log t}\right)} - t\right) \]
      4. *-commutative30.4%

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

        \[\leadsto \log y + \left(\log \left(z \cdot \color{blue}{{t}^{-0.5}}\right) - t\right) \]
    10. Applied egg-rr30.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\log \left(x + y\right) + \log t \cdot a\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log y + \left(\log \left(z \cdot {t}^{-0.5}\right) - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 83.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log \left(x + y\right) + \log z\\ \mathbf{if}\;t_1 \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot a\\ \mathbf{elif}\;t_1 \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log y + \left(\log \left(z \cdot {t}^{-0.5}\right) - t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ (log (+ x y)) (log z))))
   (if (<= t_1 -740.0)
     (+ (+ (log z) (log y)) (* (log t) a))
     (if (<= t_1 700.0)
       (- (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) t)
       (+ (log y) (- (log (* z (pow t -0.5))) t))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log((x + y)) + log(z);
	double tmp;
	if (t_1 <= -740.0) {
		tmp = (log(z) + log(y)) + (log(t) * a);
	} else if (t_1 <= 700.0) {
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	} else {
		tmp = log(y) + (log((z * pow(t, -0.5))) - t);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = log((x + y)) + log(z)
    if (t_1 <= (-740.0d0)) then
        tmp = (log(z) + log(y)) + (log(t) * a)
    else if (t_1 <= 700.0d0) then
        tmp = (log((z * (x + y))) + (log(t) * (a - 0.5d0))) - t
    else
        tmp = log(y) + (log((z * (t ** (-0.5d0)))) - t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log((x + y)) + Math.log(z);
	double tmp;
	if (t_1 <= -740.0) {
		tmp = (Math.log(z) + Math.log(y)) + (Math.log(t) * a);
	} else if (t_1 <= 700.0) {
		tmp = (Math.log((z * (x + y))) + (Math.log(t) * (a - 0.5))) - t;
	} else {
		tmp = Math.log(y) + (Math.log((z * Math.pow(t, -0.5))) - t);
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log((x + y)) + math.log(z)
	tmp = 0
	if t_1 <= -740.0:
		tmp = (math.log(z) + math.log(y)) + (math.log(t) * a)
	elif t_1 <= 700.0:
		tmp = (math.log((z * (x + y))) + (math.log(t) * (a - 0.5))) - t
	else:
		tmp = math.log(y) + (math.log((z * math.pow(t, -0.5))) - t)
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(Float64(x + y)) + log(z))
	tmp = 0.0
	if (t_1 <= -740.0)
		tmp = Float64(Float64(log(z) + log(y)) + Float64(log(t) * a));
	elseif (t_1 <= 700.0)
		tmp = Float64(Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5))) - t);
	else
		tmp = Float64(log(y) + Float64(log(Float64(z * (t ^ -0.5))) - t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log((x + y)) + log(z);
	tmp = 0.0;
	if (t_1 <= -740.0)
		tmp = (log(z) + log(y)) + (log(t) * a);
	elseif (t_1 <= 700.0)
		tmp = (log((z * (x + y))) + (log(t) * (a - 0.5))) - t;
	else
		tmp = log(y) + (log((z * (t ^ -0.5))) - t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -740.0], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 700.0], N[(N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] + N[(N[Log[N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log \left(x + y\right) + \log z\\
\mathbf{if}\;t_1 \leq -740:\\
\;\;\;\;\left(\log z + \log y\right) + \log t \cdot a\\

\mathbf{elif}\;t_1 \leq 700:\\
\;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\log z + \log y\right) - \color{blue}{\log t \cdot \left(-a\right)} \]
    10. Simplified33.6%

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

    if -740 < (+.f64 (log.f64 (+.f64 x y)) (log.f64 z)) < 700

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 700 < (+.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. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\log y + \left(\log z + -0.5 \cdot \log t\right)\right)} - t \]
    9. Step-by-step derivation
      1. associate--l+30.7%

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

        \[\leadsto \log y + \left(\left(\log z + \color{blue}{\log \left(e^{-0.5 \cdot \log t}\right)}\right) - t\right) \]
      3. sum-log30.4%

        \[\leadsto \log y + \left(\color{blue}{\log \left(z \cdot e^{-0.5 \cdot \log t}\right)} - t\right) \]
      4. *-commutative30.4%

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

        \[\leadsto \log y + \left(\log \left(z \cdot \color{blue}{{t}^{-0.5}}\right) - t\right) \]
    10. Applied egg-rr30.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log \left(x + y\right) + \log z \leq -740:\\ \;\;\;\;\left(\log z + \log y\right) + \log t \cdot a\\ \mathbf{elif}\;\log \left(x + y\right) + \log z \leq 700:\\ \;\;\;\;\left(\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log y + \left(\log \left(z \cdot {t}^{-0.5}\right) - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 99.6% accurate, 1.0× speedup?

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

\\
\left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \log t \cdot \left(a + -0.5\right)
\end{array}
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. associate--l+99.7%

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

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

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

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

    \[\leadsto \left(\log \left(x + y\right) + \left(\log z - t\right)\right) + \log t \cdot \left(a + -0.5\right) \]
  6. Add Preprocessing

Alternative 11: 69.5% accurate, 1.0× speedup?

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

\\
\left(\log z + \log y\right) + \left(\log t \cdot \left(a - 0.5\right) - t\right)
\end{array}
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. associate-+l-99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 74.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 1.4 \cdot 10^{+26}:\\ \;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t 1.4e+26) (+ (log (* z (+ x y))) (* (log t) (- a 0.5))) (- t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 1.4e+26) {
		tmp = log((z * (x + y))) + (log(t) * (a - 0.5));
	} else {
		tmp = -t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= 1.4d+26) then
        tmp = log((z * (x + y))) + (log(t) * (a - 0.5d0))
    else
        tmp = -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 <= 1.4e+26) {
		tmp = Math.log((z * (x + y))) + (Math.log(t) * (a - 0.5));
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= 1.4e+26:
		tmp = math.log((z * (x + y))) + (math.log(t) * (a - 0.5))
	else:
		tmp = -t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 1.4e+26)
		tmp = Float64(log(Float64(z * Float64(x + y))) + Float64(log(t) * Float64(a - 0.5)));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 1.4e+26)
		tmp = log((z * (x + y))) + (log(t) * (a - 0.5));
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.4e+26], N[(N[Log[N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.4 \cdot 10^{+26}:\\
\;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\\

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


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e26 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    10. Simplified73.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.4 \cdot 10^{+26}:\\ \;\;\;\;\log \left(z \cdot \left(x + y\right)\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 59.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log t \cdot a\\ \mathbf{if}\;a \leq -105000000000:\\ \;\;\;\;\log \left(x + y\right) + t_1\\ \mathbf{elif}\;a \leq 620000000000:\\ \;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (log t) a)))
   (if (<= a -105000000000.0)
     (+ (log (+ x y)) t_1)
     (if (<= a 620000000000.0) (- (log (* y (* z (pow t -0.5)))) t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = log(t) * a;
	double tmp;
	if (a <= -105000000000.0) {
		tmp = log((x + y)) + t_1;
	} else if (a <= 620000000000.0) {
		tmp = log((y * (z * pow(t, -0.5)))) - t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = log(t) * a
    if (a <= (-105000000000.0d0)) then
        tmp = log((x + y)) + t_1
    else if (a <= 620000000000.0d0) then
        tmp = log((y * (z * (t ** (-0.5d0))))) - t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = Math.log(t) * a;
	double tmp;
	if (a <= -105000000000.0) {
		tmp = Math.log((x + y)) + t_1;
	} else if (a <= 620000000000.0) {
		tmp = Math.log((y * (z * Math.pow(t, -0.5)))) - t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = math.log(t) * a
	tmp = 0
	if a <= -105000000000.0:
		tmp = math.log((x + y)) + t_1
	elif a <= 620000000000.0:
		tmp = math.log((y * (z * math.pow(t, -0.5)))) - t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(log(t) * a)
	tmp = 0.0
	if (a <= -105000000000.0)
		tmp = Float64(log(Float64(x + y)) + t_1);
	elseif (a <= 620000000000.0)
		tmp = Float64(log(Float64(y * Float64(z * (t ^ -0.5)))) - t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = log(t) * a;
	tmp = 0.0;
	if (a <= -105000000000.0)
		tmp = log((x + y)) + t_1;
	elseif (a <= 620000000000.0)
		tmp = log((y * (z * (t ^ -0.5)))) - t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -105000000000.0], N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[a, 620000000000.0], N[(N[Log[N[(y * N[(z * N[Power[t, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \log t \cdot a\\
\mathbf{if}\;a \leq -105000000000:\\
\;\;\;\;\log \left(x + y\right) + t_1\\

\mathbf{elif}\;a \leq 620000000000:\\
\;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(x + y\right) + \color{blue}{a \cdot \log t} \]
    6. Step-by-step derivation
      1. *-commutative82.2%

        \[\leadsto \log \left(x + y\right) + \color{blue}{\log t \cdot a} \]
    7. Simplified82.2%

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

    if -1.05e11 < a < 6.2e11

    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. +-commutative99.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-1 \cdot \log \left(\frac{1}{y}\right) + \color{blue}{\log \left({t}^{-0.5}\right)}\right) + \log z\right) - t \]
      3. mul-1-neg59.1%

        \[\leadsto \left(\left(\color{blue}{\left(-\log \left(\frac{1}{y}\right)\right)} + \log \left({t}^{-0.5}\right)\right) + \log z\right) - t \]
      4. log-rec59.1%

        \[\leadsto \left(\left(\left(-\color{blue}{\left(-\log y\right)}\right) + \log \left({t}^{-0.5}\right)\right) + \log z\right) - t \]
      5. remove-double-neg59.1%

        \[\leadsto \left(\left(\color{blue}{\log y} + \log \left({t}^{-0.5}\right)\right) + \log z\right) - t \]
      6. associate-+r+59.2%

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

        \[\leadsto \left(\log y + \color{blue}{\left(\log z + \log \left({t}^{-0.5}\right)\right)}\right) - t \]
      8. log-prod55.0%

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

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

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

    if 6.2e11 < a

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log t \cdot a} \]
    10. Simplified80.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -105000000000:\\ \;\;\;\;\log \left(x + y\right) + \log t \cdot a\\ \mathbf{elif}\;a \leq 620000000000:\\ \;\;\;\;\log \left(y \cdot \left(z \cdot {t}^{-0.5}\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log t \cdot a\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 60.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 3.05 \cdot 10^{+26}:\\ \;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t 3.05e+26) (+ (log (* y z)) (* (log t) (- a 0.5))) (- t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 3.05e+26) {
		tmp = log((y * z)) + (log(t) * (a - 0.5));
	} else {
		tmp = -t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= 3.05d+26) then
        tmp = log((y * z)) + (log(t) * (a - 0.5d0))
    else
        tmp = -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 <= 3.05e+26) {
		tmp = Math.log((y * z)) + (Math.log(t) * (a - 0.5));
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= 3.05e+26:
		tmp = math.log((y * z)) + (math.log(t) * (a - 0.5))
	else:
		tmp = -t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 3.05e+26)
		tmp = Float64(log(Float64(y * z)) + Float64(log(t) * Float64(a - 0.5)));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 3.05e+26)
		tmp = log((y * z)) + (log(t) * (a - 0.5));
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 3.05e+26], N[(N[Log[N[(y * z), $MachinePrecision]], $MachinePrecision] + N[(N[Log[t], $MachinePrecision] * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-t)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.05 \cdot 10^{+26}:\\
\;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\

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


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.0500000000000001e26 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    10. Simplified73.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 3.05 \cdot 10^{+26}:\\ \;\;\;\;\log \left(y \cdot z\right) + \log t \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 58.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3 \cdot 10^{+23} \lor \neg \left(a \leq 920000000000\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\log z + \log y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -3e+23) (not (<= a 920000000000.0)))
   (* (log t) a)
   (- (+ (log z) (log y)) t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -3e+23) || !(a <= 920000000000.0)) {
		tmp = log(t) * a;
	} else {
		tmp = (log(z) + log(y)) - t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-3d+23)) .or. (.not. (a <= 920000000000.0d0))) then
        tmp = log(t) * a
    else
        tmp = (log(z) + log(y)) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -3e+23) || !(a <= 920000000000.0)) {
		tmp = Math.log(t) * a;
	} else {
		tmp = (Math.log(z) + Math.log(y)) - t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -3e+23) or not (a <= 920000000000.0):
		tmp = math.log(t) * a
	else:
		tmp = (math.log(z) + math.log(y)) - t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -3e+23) || !(a <= 920000000000.0))
		tmp = Float64(log(t) * a);
	else
		tmp = Float64(Float64(log(z) + log(y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -3e+23) || ~((a <= 920000000000.0)))
		tmp = log(t) * a;
	else
		tmp = (log(z) + log(y)) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3e+23], N[Not[LessEqual[a, 920000000000.0]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Log[z], $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3 \cdot 10^{+23} \lor \neg \left(a \leq 920000000000\right):\\
\;\;\;\;\log t \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.0000000000000001e23 or 9.2e11 < a

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log t \cdot a} \]
    10. Simplified81.9%

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

    if -3.0000000000000001e23 < a < 9.2e11

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3 \cdot 10^{+23} \lor \neg \left(a \leq 920000000000\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\log z + \log y\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 62.8% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{+28} \lor \neg \left(a \leq 5000000000000\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -5.8e+28) (not (<= a 5000000000000.0))) (* (log t) a) (- t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -5.8e+28) || !(a <= 5000000000000.0)) {
		tmp = log(t) * a;
	} else {
		tmp = -t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-5.8d+28)) .or. (.not. (a <= 5000000000000.0d0))) then
        tmp = log(t) * a
    else
        tmp = -t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -5.8e+28) || !(a <= 5000000000000.0)) {
		tmp = Math.log(t) * a;
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -5.8e+28) or not (a <= 5000000000000.0):
		tmp = math.log(t) * a
	else:
		tmp = -t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -5.8e+28) || !(a <= 5000000000000.0))
		tmp = Float64(log(t) * a);
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -5.8e+28) || ~((a <= 5000000000000.0)))
		tmp = log(t) * a;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.8e+28], N[Not[LessEqual[a, 5000000000000.0]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], (-t)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+28} \lor \neg \left(a \leq 5000000000000\right):\\
\;\;\;\;\log t \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.8000000000000002e28 or 5e12 < a

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log t \cdot a} \]
    10. Simplified81.9%

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

    if -5.8000000000000002e28 < a < 5e12

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t} \]
    9. Step-by-step derivation
      1. mul-1-neg52.8%

        \[\leadsto \color{blue}{-t} \]
    10. Simplified52.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{+28} \lor \neg \left(a \leq 5000000000000\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 58.1% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.6 \cdot 10^{+22} \lor \neg \left(a \leq 9500000000000\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;\log y - t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= a -1.6e+22) (not (<= a 9500000000000.0)))
   (* (log t) a)
   (- (log y) t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -1.6e+22) || !(a <= 9500000000000.0)) {
		tmp = log(t) * a;
	} else {
		tmp = log(y) - t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if ((a <= (-1.6d+22)) .or. (.not. (a <= 9500000000000.0d0))) then
        tmp = log(t) * a
    else
        tmp = log(y) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((a <= -1.6e+22) || !(a <= 9500000000000.0)) {
		tmp = Math.log(t) * a;
	} else {
		tmp = Math.log(y) - t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (a <= -1.6e+22) or not (a <= 9500000000000.0):
		tmp = math.log(t) * a
	else:
		tmp = math.log(y) - t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((a <= -1.6e+22) || !(a <= 9500000000000.0))
		tmp = Float64(log(t) * a);
	else
		tmp = Float64(log(y) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((a <= -1.6e+22) || ~((a <= 9500000000000.0)))
		tmp = log(t) * a;
	else
		tmp = log(y) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.6e+22], N[Not[LessEqual[a, 9500000000000.0]], $MachinePrecision]], N[(N[Log[t], $MachinePrecision] * a), $MachinePrecision], N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+22} \lor \neg \left(a \leq 9500000000000\right):\\
\;\;\;\;\log t \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.6e22 or 9.5e12 < a

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log t \cdot a} \]
    10. Simplified81.9%

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

    if -1.6e22 < a < 9.5e12

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(x + y\right) + \color{blue}{-1 \cdot t} \]
    6. Step-by-step derivation
      1. neg-mul-158.0%

        \[\leadsto \log \left(x + y\right) + \color{blue}{\left(-t\right)} \]
    7. Simplified58.0%

      \[\leadsto \log \left(x + y\right) + \color{blue}{\left(-t\right)} \]
    8. Taylor expanded in x around 0 40.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.6 \cdot 10^{+22} \lor \neg \left(a \leq 9500000000000\right):\\ \;\;\;\;\log t \cdot a\\ \mathbf{else}:\\ \;\;\;\;\log y - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 41.3% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 2700000000:\\ \;\;\;\;\log \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t 2700000000.0) (log (+ x y)) (- t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= 2700000000.0) {
		tmp = log((x + y));
	} else {
		tmp = -t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= 2700000000.0d0) then
        tmp = log((x + y))
    else
        tmp = -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 <= 2700000000.0) {
		tmp = Math.log((x + y));
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= 2700000000.0:
		tmp = math.log((x + y))
	else:
		tmp = -t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= 2700000000.0)
		tmp = log(Float64(x + y));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= 2700000000.0)
		tmp = log((x + y));
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 2700000000.0], N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision], (-t)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 2700000000:\\
\;\;\;\;\log \left(x + y\right)\\

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


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 8.5%

      \[\leadsto \log \left(x + y\right) + \color{blue}{-1 \cdot t} \]
    6. Step-by-step derivation
      1. neg-mul-18.5%

        \[\leadsto \log \left(x + y\right) + \color{blue}{\left(-t\right)} \]
    7. Simplified8.5%

      \[\leadsto \log \left(x + y\right) + \color{blue}{\left(-t\right)} \]
    8. Taylor expanded in t around 0 8.6%

      \[\leadsto \color{blue}{\log \left(x + y\right)} \]
    9. Step-by-step derivation
      1. +-commutative8.6%

        \[\leadsto \log \color{blue}{\left(y + x\right)} \]
    10. Simplified8.6%

      \[\leadsto \color{blue}{\log \left(y + x\right)} \]

    if 2.7e9 < t

    1. Initial program 99.9%

      \[\left(\left(\log \left(x + y\right) + \log z\right) - t\right) + \left(a - 0.5\right) \cdot \log t \]
    2. Step-by-step derivation
      1. associate-+l-99.9%

        \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
      2. associate--l+99.9%

        \[\leadsto \color{blue}{\log \left(x + y\right) + \left(\log z - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
      3. sub-neg99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
      4. +-commutative99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
      5. *-commutative99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
      6. distribute-rgt-neg-in99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
      7. fma-udef99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
      8. sub-neg99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
      9. +-commutative99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
      10. distribute-neg-in99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
      11. metadata-eval99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
      12. metadata-eval99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 72.9%

      \[\leadsto \color{blue}{\left(\log y + \log z\right) - \left(t + \log t \cdot \left(0.5 - a\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutative72.9%

        \[\leadsto \color{blue}{\left(\log z + \log y\right)} - \left(t + \log t \cdot \left(0.5 - a\right)\right) \]
      2. +-commutative72.9%

        \[\leadsto \left(\log z + \log y\right) - \color{blue}{\left(\log t \cdot \left(0.5 - a\right) + t\right)} \]
      3. fma-def72.9%

        \[\leadsto \left(\log z + \log y\right) - \color{blue}{\mathsf{fma}\left(\log t, 0.5 - a, t\right)} \]
    7. Simplified72.9%

      \[\leadsto \color{blue}{\left(\log z + \log y\right) - \mathsf{fma}\left(\log t, 0.5 - a, t\right)} \]
    8. Taylor expanded in t around inf 72.3%

      \[\leadsto \color{blue}{-1 \cdot t} \]
    9. Step-by-step derivation
      1. mul-1-neg72.3%

        \[\leadsto \color{blue}{-t} \]
    10. Simplified72.3%

      \[\leadsto \color{blue}{-t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification40.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 2700000000:\\ \;\;\;\;\log \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 38.3% accurate, 156.5× speedup?

\[\begin{array}{l} \\ -t \end{array} \]
(FPCore (x y z t a) :precision binary64 (- t))
double code(double x, double y, double z, double t, double a) {
	return -t;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = -t
end function
public static double code(double x, double y, double z, double t, double a) {
	return -t;
}
def code(x, y, z, t, a):
	return -t
function code(x, y, z, t, a)
	return Float64(-t)
end
function tmp = code(x, y, z, t, a)
	tmp = -t;
end
code[x_, y_, z_, t_, a_] := (-t)
\begin{array}{l}

\\
-t
\end{array}
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. associate-+l-99.7%

      \[\leadsto \color{blue}{\left(\log \left(x + y\right) + \log z\right) - \left(t - \left(a - 0.5\right) \cdot \log t\right)} \]
    2. associate--l+99.7%

      \[\leadsto \color{blue}{\log \left(x + y\right) + \left(\log z - \left(t - \left(a - 0.5\right) \cdot \log t\right)\right)} \]
    3. sub-neg99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \color{blue}{\left(t + \left(-\left(a - 0.5\right) \cdot \log t\right)\right)}\right) \]
    4. +-commutative99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \color{blue}{\left(\left(-\left(a - 0.5\right) \cdot \log t\right) + t\right)}\right) \]
    5. *-commutative99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \left(\left(-\color{blue}{\log t \cdot \left(a - 0.5\right)}\right) + t\right)\right) \]
    6. distribute-rgt-neg-in99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \left(\color{blue}{\log t \cdot \left(-\left(a - 0.5\right)\right)} + t\right)\right) \]
    7. fma-udef99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \color{blue}{\mathsf{fma}\left(\log t, -\left(a - 0.5\right), t\right)}\right) \]
    8. sub-neg99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, -\color{blue}{\left(a + \left(-0.5\right)\right)}, t\right)\right) \]
    9. +-commutative99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, -\color{blue}{\left(\left(-0.5\right) + a\right)}, t\right)\right) \]
    10. distribute-neg-in99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \color{blue}{\left(-\left(-0.5\right)\right) + \left(-a\right)}, t\right)\right) \]
    11. metadata-eval99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \left(-\color{blue}{-0.5}\right) + \left(-a\right), t\right)\right) \]
    12. metadata-eval99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \color{blue}{0.5} + \left(-a\right), t\right)\right) \]
    13. unsub-neg99.7%

      \[\leadsto \log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, \color{blue}{0.5 - a}, t\right)\right) \]
  3. Simplified99.7%

    \[\leadsto \color{blue}{\log \left(x + y\right) + \left(\log z - \mathsf{fma}\left(\log t, 0.5 - a, t\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 67.0%

    \[\leadsto \color{blue}{\left(\log y + \log z\right) - \left(t + \log t \cdot \left(0.5 - a\right)\right)} \]
  6. Step-by-step derivation
    1. +-commutative67.0%

      \[\leadsto \color{blue}{\left(\log z + \log y\right)} - \left(t + \log t \cdot \left(0.5 - a\right)\right) \]
    2. +-commutative67.0%

      \[\leadsto \left(\log z + \log y\right) - \color{blue}{\left(\log t \cdot \left(0.5 - a\right) + t\right)} \]
    3. fma-def67.0%

      \[\leadsto \left(\log z + \log y\right) - \color{blue}{\mathsf{fma}\left(\log t, 0.5 - a, t\right)} \]
  7. Simplified67.0%

    \[\leadsto \color{blue}{\left(\log z + \log y\right) - \mathsf{fma}\left(\log t, 0.5 - a, t\right)} \]
  8. Taylor expanded in t around inf 37.0%

    \[\leadsto \color{blue}{-1 \cdot t} \]
  9. Step-by-step derivation
    1. mul-1-neg37.0%

      \[\leadsto \color{blue}{-t} \]
  10. Simplified37.0%

    \[\leadsto \color{blue}{-t} \]
  11. Final simplification37.0%

    \[\leadsto -t \]
  12. Add Preprocessing

Developer target: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right) \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t)))))
double code(double x, double y, double z, double t, double a) {
	return log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = log((x + y)) + ((log(z) - t) + ((a - 0.5d0) * log(t)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return Math.log((x + y)) + ((Math.log(z) - t) + ((a - 0.5) * Math.log(t)));
}
def code(x, y, z, t, a):
	return math.log((x + y)) + ((math.log(z) - t) + ((a - 0.5) * math.log(t)))
function code(x, y, z, t, a)
	return Float64(log(Float64(x + y)) + Float64(Float64(log(z) - t) + Float64(Float64(a - 0.5) * log(t))))
end
function tmp = code(x, y, z, t, a)
	tmp = log((x + y)) + ((log(z) - t) + ((a - 0.5) * log(t)));
end
code[x_, y_, z_, t_, a_] := N[(N[Log[N[(x + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\log \left(x + y\right) + \left(\left(\log z - t\right) + \left(a - 0.5\right) \cdot \log t\right)
\end{array}

Reproduce

?
herbie shell --seed 2024010 
(FPCore (x y z t a)
  :name "Numeric.SpecFunctions:logGammaL from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (+ (log (+ x y)) (+ (- (log z) t) (* (- a 0.5) (log t))))

  (+ (- (+ (log (+ x y)) (log z)) t) (* (- a 0.5) (log t))))