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

Percentage Accurate: 99.8% → 99.9%
Time: 13.4s
Alternatives: 24
Speedup: 1.0×

Specification

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

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

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

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

Alternative 1: 99.9% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 89.6% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq -1.1 \cdot 10^{+85} \lor \neg \left(z \leq 6.6 \cdot 10^{+109}\right):\\
\;\;\;\;\left(\left(z + \left(y + x\right)\right) - t_1\right) + b \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.35e210

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

    if -1.35e210 < z < -1.1000000000000001e85 or 6.5999999999999998e109 < z

    1. Initial program 99.6%

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

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

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

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

    if -1.1000000000000001e85 < z < 6.5999999999999998e109

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+210}:\\ \;\;\;\;\left(z + b \cdot \left(a - 0.5\right)\right) - z \cdot \log t\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{+85} \lor \neg \left(z \leq 6.6 \cdot 10^{+109}\right):\\ \;\;\;\;\left(\left(z + \left(y + x\right)\right) - z \cdot \log t\right) + b \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \end{array} \]

Alternative 3: 88.4% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ t_2 := t_1 + z \cdot \left(1 - \log t\right)\\ \mathbf{if}\;z \leq -9.2 \cdot 10^{+174}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+88}:\\ \;\;\;\;x + \left(y - \left(z \cdot \log t - z\right)\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+109}:\\ \;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))) (t_2 (+ t_1 (* z (- 1.0 (log t))))))
   (if (<= z -9.2e+174)
     t_2
     (if (<= z -1.6e+88)
       (+ x (- y (- (* z (log t)) z)))
       (if (<= z 1.55e+109) (+ y (+ (+ x z) t_1)) t_2)))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double t_2 = t_1 + (z * (1.0 - log(t)));
	double tmp;
	if (z <= -9.2e+174) {
		tmp = t_2;
	} else if (z <= -1.6e+88) {
		tmp = x + (y - ((z * log(t)) - z));
	} else if (z <= 1.55e+109) {
		tmp = y + ((x + z) + t_1);
	} else {
		tmp = t_2;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = b * (a - 0.5d0)
    t_2 = t_1 + (z * (1.0d0 - log(t)))
    if (z <= (-9.2d+174)) then
        tmp = t_2
    else if (z <= (-1.6d+88)) then
        tmp = x + (y - ((z * log(t)) - z))
    else if (z <= 1.55d+109) then
        tmp = y + ((x + z) + t_1)
    else
        tmp = t_2
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double t_2 = t_1 + (z * (1.0 - Math.log(t)));
	double tmp;
	if (z <= -9.2e+174) {
		tmp = t_2;
	} else if (z <= -1.6e+88) {
		tmp = x + (y - ((z * Math.log(t)) - z));
	} else if (z <= 1.55e+109) {
		tmp = y + ((x + z) + t_1);
	} else {
		tmp = t_2;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	t_2 = t_1 + (z * (1.0 - math.log(t)))
	tmp = 0
	if z <= -9.2e+174:
		tmp = t_2
	elif z <= -1.6e+88:
		tmp = x + (y - ((z * math.log(t)) - z))
	elif z <= 1.55e+109:
		tmp = y + ((x + z) + t_1)
	else:
		tmp = t_2
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a - 0.5))
	t_2 = Float64(t_1 + Float64(z * Float64(1.0 - log(t))))
	tmp = 0.0
	if (z <= -9.2e+174)
		tmp = t_2;
	elseif (z <= -1.6e+88)
		tmp = Float64(x + Float64(y - Float64(Float64(z * log(t)) - z)));
	elseif (z <= 1.55e+109)
		tmp = Float64(y + Float64(Float64(x + z) + t_1));
	else
		tmp = t_2;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a - 0.5);
	t_2 = t_1 + (z * (1.0 - log(t)));
	tmp = 0.0;
	if (z <= -9.2e+174)
		tmp = t_2;
	elseif (z <= -1.6e+88)
		tmp = x + (y - ((z * log(t)) - z));
	elseif (z <= 1.55e+109)
		tmp = y + ((x + z) + t_1);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.2e+174], t$95$2, If[LessEqual[z, -1.6e+88], N[(x + N[(y - N[(N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e+109], N[(y + N[(N[(x + z), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := t_1 + z \cdot \left(1 - \log t\right)\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+174}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -1.6 \cdot 10^{+88}:\\
\;\;\;\;x + \left(y - \left(z \cdot \log t - z\right)\right)\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{+109}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.1999999999999991e174 or 1.54999999999999996e109 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.1999999999999991e174 < z < -1.5999999999999999e88

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5999999999999999e88 < z < 1.54999999999999996e109

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.2 \cdot 10^{+174}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + z \cdot \left(1 - \log t\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+88}:\\ \;\;\;\;x + \left(y - \left(z \cdot \log t - z\right)\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+109}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + z \cdot \left(1 - \log t\right)\\ \end{array} \]

Alternative 4: 88.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := z \cdot \log t\\ t_2 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;z \leq -1.8 \cdot 10^{+175}:\\ \;\;\;\;\left(z + t_2\right) - t_1\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+87}:\\ \;\;\;\;x + \left(y - \left(t_1 - z\right)\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+109}:\\ \;\;\;\;y + \left(\left(x + z\right) + t_2\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + z \cdot \left(1 - \log t\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* z (log t))) (t_2 (* b (- a 0.5))))
   (if (<= z -1.8e+175)
     (- (+ z t_2) t_1)
     (if (<= z -3.6e+87)
       (+ x (- y (- t_1 z)))
       (if (<= z 1.9e+109)
         (+ y (+ (+ x z) t_2))
         (+ t_2 (* z (- 1.0 (log t)))))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = z * log(t);
	double t_2 = b * (a - 0.5);
	double tmp;
	if (z <= -1.8e+175) {
		tmp = (z + t_2) - t_1;
	} else if (z <= -3.6e+87) {
		tmp = x + (y - (t_1 - z));
	} else if (z <= 1.9e+109) {
		tmp = y + ((x + z) + t_2);
	} else {
		tmp = t_2 + (z * (1.0 - log(t)));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = z * log(t)
    t_2 = b * (a - 0.5d0)
    if (z <= (-1.8d+175)) then
        tmp = (z + t_2) - t_1
    else if (z <= (-3.6d+87)) then
        tmp = x + (y - (t_1 - z))
    else if (z <= 1.9d+109) then
        tmp = y + ((x + z) + t_2)
    else
        tmp = t_2 + (z * (1.0d0 - log(t)))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = z * Math.log(t);
	double t_2 = b * (a - 0.5);
	double tmp;
	if (z <= -1.8e+175) {
		tmp = (z + t_2) - t_1;
	} else if (z <= -3.6e+87) {
		tmp = x + (y - (t_1 - z));
	} else if (z <= 1.9e+109) {
		tmp = y + ((x + z) + t_2);
	} else {
		tmp = t_2 + (z * (1.0 - Math.log(t)));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = z * math.log(t)
	t_2 = b * (a - 0.5)
	tmp = 0
	if z <= -1.8e+175:
		tmp = (z + t_2) - t_1
	elif z <= -3.6e+87:
		tmp = x + (y - (t_1 - z))
	elif z <= 1.9e+109:
		tmp = y + ((x + z) + t_2)
	else:
		tmp = t_2 + (z * (1.0 - math.log(t)))
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(z * log(t))
	t_2 = Float64(b * Float64(a - 0.5))
	tmp = 0.0
	if (z <= -1.8e+175)
		tmp = Float64(Float64(z + t_2) - t_1);
	elseif (z <= -3.6e+87)
		tmp = Float64(x + Float64(y - Float64(t_1 - z)));
	elseif (z <= 1.9e+109)
		tmp = Float64(y + Float64(Float64(x + z) + t_2));
	else
		tmp = Float64(t_2 + Float64(z * Float64(1.0 - log(t))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = z * log(t);
	t_2 = b * (a - 0.5);
	tmp = 0.0;
	if (z <= -1.8e+175)
		tmp = (z + t_2) - t_1;
	elseif (z <= -3.6e+87)
		tmp = x + (y - (t_1 - z));
	elseif (z <= 1.9e+109)
		tmp = y + ((x + z) + t_2);
	else
		tmp = t_2 + (z * (1.0 - log(t)));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+175], N[(N[(z + t$95$2), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[z, -3.6e+87], N[(x + N[(y - N[(t$95$1 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+109], N[(y + N[(N[(x + z), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := z \cdot \log t\\
t_2 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+175}:\\
\;\;\;\;\left(z + t_2\right) - t_1\\

\mathbf{elif}\;z \leq -3.6 \cdot 10^{+87}:\\
\;\;\;\;x + \left(y - \left(t_1 - z\right)\right)\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{+109}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.80000000000000017e175

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

    if -1.80000000000000017e175 < z < -3.59999999999999994e87

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.59999999999999994e87 < z < 1.90000000000000019e109

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.90000000000000019e109 < z

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+175}:\\ \;\;\;\;\left(z + b \cdot \left(a - 0.5\right)\right) - z \cdot \log t\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+87}:\\ \;\;\;\;x + \left(y - \left(z \cdot \log t - z\right)\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+109}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + z \cdot \left(1 - \log t\right)\\ \end{array} \]

Alternative 5: 90.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := z \cdot \log t\\ t_2 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;z \leq -1.15 \cdot 10^{+83}:\\ \;\;\;\;\left(y + \left(z + t_2\right)\right) - t_1\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+110}:\\ \;\;\;\;y + \left(\left(x + z\right) + t_2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z + \left(y + x\right)\right) - t_1\right) + b \cdot -0.5\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* z (log t))) (t_2 (* b (- a 0.5))))
   (if (<= z -1.15e+83)
     (- (+ y (+ z t_2)) t_1)
     (if (<= z 3.2e+110)
       (+ y (+ (+ x z) t_2))
       (+ (- (+ z (+ y x)) t_1) (* b -0.5))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = z * log(t);
	double t_2 = b * (a - 0.5);
	double tmp;
	if (z <= -1.15e+83) {
		tmp = (y + (z + t_2)) - t_1;
	} else if (z <= 3.2e+110) {
		tmp = y + ((x + z) + t_2);
	} else {
		tmp = ((z + (y + x)) - t_1) + (b * -0.5);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = z * log(t)
    t_2 = b * (a - 0.5d0)
    if (z <= (-1.15d+83)) then
        tmp = (y + (z + t_2)) - t_1
    else if (z <= 3.2d+110) then
        tmp = y + ((x + z) + t_2)
    else
        tmp = ((z + (y + x)) - t_1) + (b * (-0.5d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = z * Math.log(t);
	double t_2 = b * (a - 0.5);
	double tmp;
	if (z <= -1.15e+83) {
		tmp = (y + (z + t_2)) - t_1;
	} else if (z <= 3.2e+110) {
		tmp = y + ((x + z) + t_2);
	} else {
		tmp = ((z + (y + x)) - t_1) + (b * -0.5);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = z * math.log(t)
	t_2 = b * (a - 0.5)
	tmp = 0
	if z <= -1.15e+83:
		tmp = (y + (z + t_2)) - t_1
	elif z <= 3.2e+110:
		tmp = y + ((x + z) + t_2)
	else:
		tmp = ((z + (y + x)) - t_1) + (b * -0.5)
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(z * log(t))
	t_2 = Float64(b * Float64(a - 0.5))
	tmp = 0.0
	if (z <= -1.15e+83)
		tmp = Float64(Float64(y + Float64(z + t_2)) - t_1);
	elseif (z <= 3.2e+110)
		tmp = Float64(y + Float64(Float64(x + z) + t_2));
	else
		tmp = Float64(Float64(Float64(z + Float64(y + x)) - t_1) + Float64(b * -0.5));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = z * log(t);
	t_2 = b * (a - 0.5);
	tmp = 0.0;
	if (z <= -1.15e+83)
		tmp = (y + (z + t_2)) - t_1;
	elseif (z <= 3.2e+110)
		tmp = y + ((x + z) + t_2);
	else
		tmp = ((z + (y + x)) - t_1) + (b * -0.5);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.15e+83], N[(N[(y + N[(z + t$95$2), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[z, 3.2e+110], N[(y + N[(N[(x + z), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + N[(b * -0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := z \cdot \log t\\
t_2 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+83}:\\
\;\;\;\;\left(y + \left(z + t_2\right)\right) - t_1\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{+110}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_2\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(z + \left(y + x\right)\right) - t_1\right) + b \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.14999999999999997e83

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -1.14999999999999997e83 < z < 3.19999999999999994e110

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.19999999999999994e110 < z

    1. Initial program 99.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+83}:\\ \;\;\;\;\left(y + \left(z + b \cdot \left(a - 0.5\right)\right)\right) - z \cdot \log t\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+110}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z + \left(y + x\right)\right) - z \cdot \log t\right) + b \cdot -0.5\\ \end{array} \]

Alternative 6: 84.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq -1.8 \cdot 10^{+133}:\\
\;\;\;\;t_1 + \left(y + x\right)\\

\mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 7 \cdot 10^{+141}\right):\\
\;\;\;\;x + z \cdot \left(1 - \log t\right)\\

\mathbf{else}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.1999999999999999e215

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} \]
    6. Step-by-step derivation
      1. sub-neg82.2%

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

        \[\leadsto z \cdot \left(1 + \color{blue}{\log \left(\frac{1}{t}\right)}\right) \]
      3. distribute-lft-in82.4%

        \[\leadsto \color{blue}{z \cdot 1 + z \cdot \log \left(\frac{1}{t}\right)} \]
      4. log-rec82.4%

        \[\leadsto z \cdot 1 + z \cdot \color{blue}{\left(-\log t\right)} \]
      5. distribute-rgt-neg-in82.4%

        \[\leadsto z \cdot 1 + \color{blue}{\left(-z \cdot \log t\right)} \]
      6. unsub-neg82.4%

        \[\leadsto \color{blue}{z \cdot 1 - z \cdot \log t} \]
      7. *-rgt-identity82.4%

        \[\leadsto \color{blue}{z} - z \cdot \log t \]
    7. Simplified82.4%

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

    if -3.1999999999999999e215 < z < -1.79999999999999989e133

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.79999999999999989e133 < z < -2.9000000000000001e123 or 6.9999999999999999e141 < z

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9000000000000001e123 < z < 6.9999999999999999e141

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{+215}:\\ \;\;\;\;z - z \cdot \log t\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+133}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + \left(y + x\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 7 \cdot 10^{+141}\right):\\ \;\;\;\;x + z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \end{array} \]

Alternative 7: 83.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ t_2 := z \cdot \left(1 - \log t\right)\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{+215}:\\ \;\;\;\;z - z \cdot \log t\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{+139}:\\ \;\;\;\;t_1 + \left(y + x\right)\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{+88}:\\ \;\;\;\;y + t_2\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+142}:\\ \;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;x + t_2\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))) (t_2 (* z (- 1.0 (log t)))))
   (if (<= z -2.9e+215)
     (- z (* z (log t)))
     (if (<= z -3.9e+139)
       (+ t_1 (+ y x))
       (if (<= z -2.25e+88)
         (+ y t_2)
         (if (<= z 2.4e+142) (+ y (+ (+ x z) t_1)) (+ x t_2)))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double t_2 = z * (1.0 - log(t));
	double tmp;
	if (z <= -2.9e+215) {
		tmp = z - (z * log(t));
	} else if (z <= -3.9e+139) {
		tmp = t_1 + (y + x);
	} else if (z <= -2.25e+88) {
		tmp = y + t_2;
	} else if (z <= 2.4e+142) {
		tmp = y + ((x + z) + t_1);
	} else {
		tmp = x + t_2;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = b * (a - 0.5d0)
    t_2 = z * (1.0d0 - log(t))
    if (z <= (-2.9d+215)) then
        tmp = z - (z * log(t))
    else if (z <= (-3.9d+139)) then
        tmp = t_1 + (y + x)
    else if (z <= (-2.25d+88)) then
        tmp = y + t_2
    else if (z <= 2.4d+142) then
        tmp = y + ((x + z) + t_1)
    else
        tmp = x + t_2
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double t_2 = z * (1.0 - Math.log(t));
	double tmp;
	if (z <= -2.9e+215) {
		tmp = z - (z * Math.log(t));
	} else if (z <= -3.9e+139) {
		tmp = t_1 + (y + x);
	} else if (z <= -2.25e+88) {
		tmp = y + t_2;
	} else if (z <= 2.4e+142) {
		tmp = y + ((x + z) + t_1);
	} else {
		tmp = x + t_2;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	t_2 = z * (1.0 - math.log(t))
	tmp = 0
	if z <= -2.9e+215:
		tmp = z - (z * math.log(t))
	elif z <= -3.9e+139:
		tmp = t_1 + (y + x)
	elif z <= -2.25e+88:
		tmp = y + t_2
	elif z <= 2.4e+142:
		tmp = y + ((x + z) + t_1)
	else:
		tmp = x + t_2
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a - 0.5))
	t_2 = Float64(z * Float64(1.0 - log(t)))
	tmp = 0.0
	if (z <= -2.9e+215)
		tmp = Float64(z - Float64(z * log(t)));
	elseif (z <= -3.9e+139)
		tmp = Float64(t_1 + Float64(y + x));
	elseif (z <= -2.25e+88)
		tmp = Float64(y + t_2);
	elseif (z <= 2.4e+142)
		tmp = Float64(y + Float64(Float64(x + z) + t_1));
	else
		tmp = Float64(x + t_2);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a - 0.5);
	t_2 = z * (1.0 - log(t));
	tmp = 0.0;
	if (z <= -2.9e+215)
		tmp = z - (z * log(t));
	elseif (z <= -3.9e+139)
		tmp = t_1 + (y + x);
	elseif (z <= -2.25e+88)
		tmp = y + t_2;
	elseif (z <= 2.4e+142)
		tmp = y + ((x + z) + t_1);
	else
		tmp = x + t_2;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.9e+215], N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.9e+139], N[(t$95$1 + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.25e+88], N[(y + t$95$2), $MachinePrecision], If[LessEqual[z, 2.4e+142], N[(y + N[(N[(x + z), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(x + t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := z \cdot \left(1 - \log t\right)\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+215}:\\
\;\;\;\;z - z \cdot \log t\\

\mathbf{elif}\;z \leq -3.9 \cdot 10^{+139}:\\
\;\;\;\;t_1 + \left(y + x\right)\\

\mathbf{elif}\;z \leq -2.25 \cdot 10^{+88}:\\
\;\;\;\;y + t_2\\

\mathbf{elif}\;z \leq 2.4 \cdot 10^{+142}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\

\mathbf{else}:\\
\;\;\;\;x + t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -2.8999999999999999e215

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} \]
    6. Step-by-step derivation
      1. sub-neg82.2%

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

        \[\leadsto z \cdot \left(1 + \color{blue}{\log \left(\frac{1}{t}\right)}\right) \]
      3. distribute-lft-in82.4%

        \[\leadsto \color{blue}{z \cdot 1 + z \cdot \log \left(\frac{1}{t}\right)} \]
      4. log-rec82.4%

        \[\leadsto z \cdot 1 + z \cdot \color{blue}{\left(-\log t\right)} \]
      5. distribute-rgt-neg-in82.4%

        \[\leadsto z \cdot 1 + \color{blue}{\left(-z \cdot \log t\right)} \]
      6. unsub-neg82.4%

        \[\leadsto \color{blue}{z \cdot 1 - z \cdot \log t} \]
      7. *-rgt-identity82.4%

        \[\leadsto \color{blue}{z} - z \cdot \log t \]
    7. Simplified82.4%

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

    if -2.8999999999999999e215 < z < -3.90000000000000006e139

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.90000000000000006e139 < z < -2.25e88

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.25e88 < z < 2.3999999999999999e142

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3999999999999999e142 < z

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+215}:\\ \;\;\;\;z - z \cdot \log t\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{+139}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + \left(y + x\right)\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{+88}:\\ \;\;\;\;y + z \cdot \left(1 - \log t\right)\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+142}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(1 - \log t\right)\\ \end{array} \]

Alternative 8: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 84.4% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ t_2 := z \cdot \left(1 - \log t\right)\\ \mathbf{if}\;z \leq -9 \cdot 10^{+214}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{+132}:\\ \;\;\;\;t_1 + \left(y + x\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 2.2 \cdot 10^{+230}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))) (t_2 (* z (- 1.0 (log t)))))
   (if (<= z -9e+214)
     t_2
     (if (<= z -9.8e+132)
       (+ t_1 (+ y x))
       (if (or (<= z -2.9e+123) (not (<= z 2.2e+230)))
         t_2
         (+ y (+ (+ x z) t_1)))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double t_2 = z * (1.0 - log(t));
	double tmp;
	if (z <= -9e+214) {
		tmp = t_2;
	} else if (z <= -9.8e+132) {
		tmp = t_1 + (y + x);
	} else if ((z <= -2.9e+123) || !(z <= 2.2e+230)) {
		tmp = t_2;
	} else {
		tmp = y + ((x + z) + t_1);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = b * (a - 0.5d0)
    t_2 = z * (1.0d0 - log(t))
    if (z <= (-9d+214)) then
        tmp = t_2
    else if (z <= (-9.8d+132)) then
        tmp = t_1 + (y + x)
    else if ((z <= (-2.9d+123)) .or. (.not. (z <= 2.2d+230))) then
        tmp = t_2
    else
        tmp = y + ((x + z) + t_1)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double t_2 = z * (1.0 - Math.log(t));
	double tmp;
	if (z <= -9e+214) {
		tmp = t_2;
	} else if (z <= -9.8e+132) {
		tmp = t_1 + (y + x);
	} else if ((z <= -2.9e+123) || !(z <= 2.2e+230)) {
		tmp = t_2;
	} else {
		tmp = y + ((x + z) + t_1);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	t_2 = z * (1.0 - math.log(t))
	tmp = 0
	if z <= -9e+214:
		tmp = t_2
	elif z <= -9.8e+132:
		tmp = t_1 + (y + x)
	elif (z <= -2.9e+123) or not (z <= 2.2e+230):
		tmp = t_2
	else:
		tmp = y + ((x + z) + t_1)
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a - 0.5))
	t_2 = Float64(z * Float64(1.0 - log(t)))
	tmp = 0.0
	if (z <= -9e+214)
		tmp = t_2;
	elseif (z <= -9.8e+132)
		tmp = Float64(t_1 + Float64(y + x));
	elseif ((z <= -2.9e+123) || !(z <= 2.2e+230))
		tmp = t_2;
	else
		tmp = Float64(y + Float64(Float64(x + z) + t_1));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a - 0.5);
	t_2 = z * (1.0 - log(t));
	tmp = 0.0;
	if (z <= -9e+214)
		tmp = t_2;
	elseif (z <= -9.8e+132)
		tmp = t_1 + (y + x);
	elseif ((z <= -2.9e+123) || ~((z <= 2.2e+230)))
		tmp = t_2;
	else
		tmp = y + ((x + z) + t_1);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9e+214], t$95$2, If[LessEqual[z, -9.8e+132], N[(t$95$1 + N[(y + x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.9e+123], N[Not[LessEqual[z, 2.2e+230]], $MachinePrecision]], t$95$2, N[(y + N[(N[(x + z), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := z \cdot \left(1 - \log t\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{+214}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -9.8 \cdot 10^{+132}:\\
\;\;\;\;t_1 + \left(y + x\right)\\

\mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 2.2 \cdot 10^{+230}\right):\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.99999999999999935e214 or -9.8000000000000003e132 < z < -2.9000000000000001e123 or 2.2000000000000001e230 < z

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

    if -8.99999999999999935e214 < z < -9.8000000000000003e132

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9000000000000001e123 < z < 2.2000000000000001e230

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+214}:\\ \;\;\;\;z \cdot \left(1 - \log t\right)\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{+132}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + \left(y + x\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 2.2 \cdot 10^{+230}\right):\\ \;\;\;\;z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \end{array} \]

Alternative 10: 84.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;z \leq -2.25 \cdot 10^{+132}:\\
\;\;\;\;t_1 + \left(y + x\right)\\

\mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 4.1 \cdot 10^{+229}\right):\\
\;\;\;\;z \cdot \left(1 - \log t\right)\\

\mathbf{else}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -8.2000000000000007e215

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} \]
    6. Step-by-step derivation
      1. sub-neg82.2%

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

        \[\leadsto z \cdot \left(1 + \color{blue}{\log \left(\frac{1}{t}\right)}\right) \]
      3. distribute-lft-in82.4%

        \[\leadsto \color{blue}{z \cdot 1 + z \cdot \log \left(\frac{1}{t}\right)} \]
      4. log-rec82.4%

        \[\leadsto z \cdot 1 + z \cdot \color{blue}{\left(-\log t\right)} \]
      5. distribute-rgt-neg-in82.4%

        \[\leadsto z \cdot 1 + \color{blue}{\left(-z \cdot \log t\right)} \]
      6. unsub-neg82.4%

        \[\leadsto \color{blue}{z \cdot 1 - z \cdot \log t} \]
      7. *-rgt-identity82.4%

        \[\leadsto \color{blue}{z} - z \cdot \log t \]
    7. Simplified82.4%

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

    if -8.2000000000000007e215 < z < -2.24999999999999986e132

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.24999999999999986e132 < z < -2.9000000000000001e123 or 4.1000000000000001e229 < z

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

    if -2.9000000000000001e123 < z < 4.1000000000000001e229

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{+215}:\\ \;\;\;\;z - z \cdot \log t\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{+132}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + \left(y + x\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{+123} \lor \neg \left(z \leq 4.1 \cdot 10^{+229}\right):\\ \;\;\;\;z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \end{array} \]

Alternative 11: 88.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 1.15 \cdot 10^{-37}:\\
\;\;\;\;x + \left(y - \left(z \cdot \log t - z\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y + \left(\left(x + z\right) + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.30000000000000009e-21

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.30000000000000009e-21 < b < 1.15e-37

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.15e-37 < b

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{-21}:\\ \;\;\;\;b \cdot \left(a - 0.5\right) + \left(y + x\right)\\ \mathbf{elif}\;b \leq 1.15 \cdot 10^{-37}:\\ \;\;\;\;x + \left(y - \left(z \cdot \log t - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right)\\ \end{array} \]

Alternative 12: 61.9% accurate, 8.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;b \leq -2.7 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{-33}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;b \leq 2.25 \cdot 10^{+90}:\\ \;\;\;\;x + b \cdot a\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{+119}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))))
   (if (<= b -2.7e-16)
     t_1
     (if (<= b 2.2e-33)
       (+ y x)
       (if (<= b 2.25e+90) (+ x (* b a)) (if (<= b 2.1e+119) (+ y x) t_1))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double tmp;
	if (b <= -2.7e-16) {
		tmp = t_1;
	} else if (b <= 2.2e-33) {
		tmp = y + x;
	} else if (b <= 2.25e+90) {
		tmp = x + (b * a);
	} else if (b <= 2.1e+119) {
		tmp = y + x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = b * (a - 0.5d0)
    if (b <= (-2.7d-16)) then
        tmp = t_1
    else if (b <= 2.2d-33) then
        tmp = y + x
    else if (b <= 2.25d+90) then
        tmp = x + (b * a)
    else if (b <= 2.1d+119) then
        tmp = y + x
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double tmp;
	if (b <= -2.7e-16) {
		tmp = t_1;
	} else if (b <= 2.2e-33) {
		tmp = y + x;
	} else if (b <= 2.25e+90) {
		tmp = x + (b * a);
	} else if (b <= 2.1e+119) {
		tmp = y + x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	tmp = 0
	if b <= -2.7e-16:
		tmp = t_1
	elif b <= 2.2e-33:
		tmp = y + x
	elif b <= 2.25e+90:
		tmp = x + (b * a)
	elif b <= 2.1e+119:
		tmp = y + x
	else:
		tmp = t_1
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a - 0.5))
	tmp = 0.0
	if (b <= -2.7e-16)
		tmp = t_1;
	elseif (b <= 2.2e-33)
		tmp = Float64(y + x);
	elseif (b <= 2.25e+90)
		tmp = Float64(x + Float64(b * a));
	elseif (b <= 2.1e+119)
		tmp = Float64(y + x);
	else
		tmp = t_1;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a - 0.5);
	tmp = 0.0;
	if (b <= -2.7e-16)
		tmp = t_1;
	elseif (b <= 2.2e-33)
		tmp = y + x;
	elseif (b <= 2.25e+90)
		tmp = x + (b * a);
	elseif (b <= 2.1e+119)
		tmp = y + x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.7e-16], t$95$1, If[LessEqual[b, 2.2e-33], N[(y + x), $MachinePrecision], If[LessEqual[b, 2.25e+90], N[(x + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.1e+119], N[(y + x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;b \leq -2.7 \cdot 10^{-16}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq 2.2 \cdot 10^{-33}:\\
\;\;\;\;y + x\\

\mathbf{elif}\;b \leq 2.25 \cdot 10^{+90}:\\
\;\;\;\;x + b \cdot a\\

\mathbf{elif}\;b \leq 2.1 \cdot 10^{+119}:\\
\;\;\;\;y + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -2.69999999999999999e-16 or 2.09999999999999983e119 < b

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

    if -2.69999999999999999e-16 < b < 2.20000000000000005e-33 or 2.25e90 < b < 2.09999999999999983e119

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{x} \]

    if 2.20000000000000005e-33 < b < 2.25e90

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{a \cdot b} \]
    7. Step-by-step derivation
      1. *-commutative53.9%

        \[\leadsto x + \color{blue}{b \cdot a} \]
    8. Simplified53.9%

      \[\leadsto x + \color{blue}{b \cdot a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.7 \cdot 10^{-16}:\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{-33}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;b \leq 2.25 \cdot 10^{+90}:\\ \;\;\;\;x + b \cdot a\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{+119}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \end{array} \]

Alternative 13: 78.4% accurate, 8.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < -1.9999999999999999e-94

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999999e-94 < (+.f64 x y)

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y + x \leq -2 \cdot 10^{-94}:\\ \;\;\;\;x - b \cdot \left(0.5 - a\right)\\ \mathbf{else}:\\ \;\;\;\;y + \left(z + b \cdot \left(a - 0.5\right)\right)\\ \end{array} \]

Alternative 14: 50.6% accurate, 10.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -1.65 \cdot 10^{+156}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;a \leq -6.8 \cdot 10^{+111} \lor \neg \left(a \leq -5.5 \cdot 10^{+48}\right) \land a \leq 3.8 \cdot 10^{+28}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a -1.65e+156)
   (* b a)
   (if (or (<= a -6.8e+111) (and (not (<= a -5.5e+48)) (<= a 3.8e+28)))
     (+ y x)
     (* b a))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -1.65e+156) {
		tmp = b * a;
	} else if ((a <= -6.8e+111) || (!(a <= -5.5e+48) && (a <= 3.8e+28))) {
		tmp = y + x;
	} else {
		tmp = b * a;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: tmp
    if (a <= (-1.65d+156)) then
        tmp = b * a
    else if ((a <= (-6.8d+111)) .or. (.not. (a <= (-5.5d+48))) .and. (a <= 3.8d+28)) then
        tmp = y + x
    else
        tmp = b * a
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -1.65e+156) {
		tmp = b * a;
	} else if ((a <= -6.8e+111) || (!(a <= -5.5e+48) && (a <= 3.8e+28))) {
		tmp = y + x;
	} else {
		tmp = b * a;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= -1.65e+156:
		tmp = b * a
	elif (a <= -6.8e+111) or (not (a <= -5.5e+48) and (a <= 3.8e+28)):
		tmp = y + x
	else:
		tmp = b * a
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= -1.65e+156)
		tmp = Float64(b * a);
	elseif ((a <= -6.8e+111) || (!(a <= -5.5e+48) && (a <= 3.8e+28)))
		tmp = Float64(y + x);
	else
		tmp = Float64(b * a);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= -1.65e+156)
		tmp = b * a;
	elseif ((a <= -6.8e+111) || (~((a <= -5.5e+48)) && (a <= 3.8e+28)))
		tmp = y + x;
	else
		tmp = b * a;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.65e+156], N[(b * a), $MachinePrecision], If[Or[LessEqual[a, -6.8e+111], And[N[Not[LessEqual[a, -5.5e+48]], $MachinePrecision], LessEqual[a, 3.8e+28]]], N[(y + x), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.65 \cdot 10^{+156}:\\
\;\;\;\;b \cdot a\\

\mathbf{elif}\;a \leq -6.8 \cdot 10^{+111} \lor \neg \left(a \leq -5.5 \cdot 10^{+48}\right) \land a \leq 3.8 \cdot 10^{+28}:\\
\;\;\;\;y + x\\

\mathbf{else}:\\
\;\;\;\;b \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.6499999999999999e156 or -6.8000000000000003e111 < a < -5.5000000000000002e48 or 3.7999999999999999e28 < a

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} \]
    6. Step-by-step derivation
      1. *-commutative62.4%

        \[\leadsto \color{blue}{b \cdot a} \]
    7. Simplified62.4%

      \[\leadsto \color{blue}{b \cdot a} \]

    if -1.6499999999999999e156 < a < -6.8000000000000003e111 or -5.5000000000000002e48 < a < 3.7999999999999999e28

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification55.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.65 \cdot 10^{+156}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;a \leq -6.8 \cdot 10^{+111} \lor \neg \left(a \leq -5.5 \cdot 10^{+48}\right) \land a \leq 3.8 \cdot 10^{+28}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]

Alternative 15: 37.3% accurate, 10.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;a \leq -5.6 \cdot 10^{+48}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;a \leq -2.5 \cdot 10^{-155}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{-182}:\\ \;\;\;\;y\\ \mathbf{elif}\;a \leq 350000000000:\\ \;\;\;\;b \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a -5.6e+48)
   (* b a)
   (if (<= a -2.5e-155)
     x
     (if (<= a 6.2e-182) y (if (<= a 350000000000.0) (* b -0.5) (* b a))))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -5.6e+48) {
		tmp = b * a;
	} else if (a <= -2.5e-155) {
		tmp = x;
	} else if (a <= 6.2e-182) {
		tmp = y;
	} else if (a <= 350000000000.0) {
		tmp = b * -0.5;
	} else {
		tmp = b * a;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: tmp
    if (a <= (-5.6d+48)) then
        tmp = b * a
    else if (a <= (-2.5d-155)) then
        tmp = x
    else if (a <= 6.2d-182) then
        tmp = y
    else if (a <= 350000000000.0d0) then
        tmp = b * (-0.5d0)
    else
        tmp = b * a
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -5.6e+48) {
		tmp = b * a;
	} else if (a <= -2.5e-155) {
		tmp = x;
	} else if (a <= 6.2e-182) {
		tmp = y;
	} else if (a <= 350000000000.0) {
		tmp = b * -0.5;
	} else {
		tmp = b * a;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= -5.6e+48:
		tmp = b * a
	elif a <= -2.5e-155:
		tmp = x
	elif a <= 6.2e-182:
		tmp = y
	elif a <= 350000000000.0:
		tmp = b * -0.5
	else:
		tmp = b * a
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= -5.6e+48)
		tmp = Float64(b * a);
	elseif (a <= -2.5e-155)
		tmp = x;
	elseif (a <= 6.2e-182)
		tmp = y;
	elseif (a <= 350000000000.0)
		tmp = Float64(b * -0.5);
	else
		tmp = Float64(b * a);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= -5.6e+48)
		tmp = b * a;
	elseif (a <= -2.5e-155)
		tmp = x;
	elseif (a <= 6.2e-182)
		tmp = y;
	elseif (a <= 350000000000.0)
		tmp = b * -0.5;
	else
		tmp = b * a;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -5.6e+48], N[(b * a), $MachinePrecision], If[LessEqual[a, -2.5e-155], x, If[LessEqual[a, 6.2e-182], y, If[LessEqual[a, 350000000000.0], N[(b * -0.5), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{+48}:\\
\;\;\;\;b \cdot a\\

\mathbf{elif}\;a \leq -2.5 \cdot 10^{-155}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 6.2 \cdot 10^{-182}:\\
\;\;\;\;y\\

\mathbf{elif}\;a \leq 350000000000:\\
\;\;\;\;b \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;b \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -5.60000000000000025e48 or 3.5e11 < a

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} \]
    6. Step-by-step derivation
      1. *-commutative57.9%

        \[\leadsto \color{blue}{b \cdot a} \]
    7. Simplified57.9%

      \[\leadsto \color{blue}{b \cdot a} \]

    if -5.60000000000000025e48 < a < -2.4999999999999999e-155

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x} \]

    if -2.4999999999999999e-155 < a < 6.20000000000000016e-182

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y} \]

    if 6.20000000000000016e-182 < a < 3.5e11

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \left(a - 0.5\right)} \]
    6. Taylor expanded in a around 0 35.1%

      \[\leadsto \color{blue}{-0.5 \cdot b} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification39.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.6 \cdot 10^{+48}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;a \leq -2.5 \cdot 10^{-155}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{-182}:\\ \;\;\;\;y\\ \mathbf{elif}\;a \leq 350000000000:\\ \;\;\;\;b \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]

Alternative 16: 61.7% accurate, 10.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;b \leq -6 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 10^{-23}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;b \leq 2.3 \cdot 10^{+199}:\\ \;\;\;\;y + b \cdot a\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))))
   (if (<= b -6e-16)
     t_1
     (if (<= b 1e-23) (+ y x) (if (<= b 2.3e+199) (+ y (* b a)) t_1)))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double tmp;
	if (b <= -6e-16) {
		tmp = t_1;
	} else if (b <= 1e-23) {
		tmp = y + x;
	} else if (b <= 2.3e+199) {
		tmp = y + (b * a);
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = b * (a - 0.5d0)
    if (b <= (-6d-16)) then
        tmp = t_1
    else if (b <= 1d-23) then
        tmp = y + x
    else if (b <= 2.3d+199) then
        tmp = y + (b * a)
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double tmp;
	if (b <= -6e-16) {
		tmp = t_1;
	} else if (b <= 1e-23) {
		tmp = y + x;
	} else if (b <= 2.3e+199) {
		tmp = y + (b * a);
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	tmp = 0
	if b <= -6e-16:
		tmp = t_1
	elif b <= 1e-23:
		tmp = y + x
	elif b <= 2.3e+199:
		tmp = y + (b * a)
	else:
		tmp = t_1
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a - 0.5))
	tmp = 0.0
	if (b <= -6e-16)
		tmp = t_1;
	elseif (b <= 1e-23)
		tmp = Float64(y + x);
	elseif (b <= 2.3e+199)
		tmp = Float64(y + Float64(b * a));
	else
		tmp = t_1;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a - 0.5);
	tmp = 0.0;
	if (b <= -6e-16)
		tmp = t_1;
	elseif (b <= 1e-23)
		tmp = y + x;
	elseif (b <= 2.3e+199)
		tmp = y + (b * a);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -6e-16], t$95$1, If[LessEqual[b, 1e-23], N[(y + x), $MachinePrecision], If[LessEqual[b, 2.3e+199], N[(y + N[(b * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;b \leq -6 \cdot 10^{-16}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;b \leq 10^{-23}:\\
\;\;\;\;y + x\\

\mathbf{elif}\;b \leq 2.3 \cdot 10^{+199}:\\
\;\;\;\;y + b \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -5.99999999999999987e-16 or 2.29999999999999995e199 < b

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999987e-16 < b < 9.9999999999999996e-24

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{x} \]

    if 9.9999999999999996e-24 < b < 2.29999999999999995e199

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{a \cdot b} \]
    5. Step-by-step derivation
      1. *-commutative51.5%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    6. Simplified51.5%

      \[\leadsto y + \color{blue}{b \cdot a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{-16}:\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{elif}\;b \leq 10^{-23}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;b \leq 2.3 \cdot 10^{+199}:\\ \;\;\;\;y + b \cdot a\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \end{array} \]

Alternative 17: 77.9% accurate, 10.4× speedup?

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

\mathbf{else}:\\
\;\;\;\;y + b \cdot \left(a - 0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < -4.9999999999999997e-127

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999997e-127 < (+.f64 x y)

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{b \cdot \left(a - 0.5\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y + x \leq -5 \cdot 10^{-127}:\\ \;\;\;\;x - b \cdot \left(0.5 - a\right)\\ \mathbf{else}:\\ \;\;\;\;y + b \cdot \left(a - 0.5\right)\\ \end{array} \]

Alternative 18: 79.4% accurate, 10.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto y + \left(\left(x + z\right) - \color{blue}{b \cdot \left(0.5 - a\right)}\right) \]
  5. Final simplification78.8%

    \[\leadsto y + \left(\left(x + z\right) + b \cdot \left(a - 0.5\right)\right) \]

Alternative 19: 35.8% accurate, 12.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{-262}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq 1.26 \cdot 10^{-217}:\\ \;\;\;\;b \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
 :precision binary64
 (if (<= x -4.4e+40)
   x
   (if (<= x -4.6e-262) y (if (<= x 1.26e-217) (* b -0.5) y))))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -4.4e+40) {
		tmp = x;
	} else if (x <= -4.6e-262) {
		tmp = y;
	} else if (x <= 1.26e-217) {
		tmp = b * -0.5;
	} else {
		tmp = y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: tmp
    if (x <= (-4.4d+40)) then
        tmp = x
    else if (x <= (-4.6d-262)) then
        tmp = y
    else if (x <= 1.26d-217) then
        tmp = b * (-0.5d0)
    else
        tmp = y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -4.4e+40) {
		tmp = x;
	} else if (x <= -4.6e-262) {
		tmp = y;
	} else if (x <= 1.26e-217) {
		tmp = b * -0.5;
	} else {
		tmp = y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -4.4e+40:
		tmp = x
	elif x <= -4.6e-262:
		tmp = y
	elif x <= 1.26e-217:
		tmp = b * -0.5
	else:
		tmp = y
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -4.4e+40)
		tmp = x;
	elseif (x <= -4.6e-262)
		tmp = y;
	elseif (x <= 1.26e-217)
		tmp = Float64(b * -0.5);
	else
		tmp = y;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -4.4e+40)
		tmp = x;
	elseif (x <= -4.6e-262)
		tmp = y;
	elseif (x <= 1.26e-217)
		tmp = b * -0.5;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -4.4e+40], x, If[LessEqual[x, -4.6e-262], y, If[LessEqual[x, 1.26e-217], N[(b * -0.5), $MachinePrecision], y]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+40}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq -4.6 \cdot 10^{-262}:\\
\;\;\;\;y\\

\mathbf{elif}\;x \leq 1.26 \cdot 10^{-217}:\\
\;\;\;\;b \cdot -0.5\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.3999999999999998e40

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x} \]

    if -4.3999999999999998e40 < x < -4.6000000000000002e-262 or 1.2599999999999999e-217 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y} \]

    if -4.6000000000000002e-262 < x < 1.2599999999999999e-217

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \left(a - 0.5\right)} \]
    6. Taylor expanded in a around 0 37.9%

      \[\leadsto \color{blue}{-0.5 \cdot b} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification30.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{-262}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq 1.26 \cdot 10^{-217}:\\ \;\;\;\;b \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 20: 61.1% accurate, 12.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;y + x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -4.89999999999999995e-14 or 1.2e119 < b

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

    if -4.89999999999999995e-14 < b < 1.2e119

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.9 \cdot 10^{-14} \lor \neg \left(b \leq 1.2 \cdot 10^{+119}\right):\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]

Alternative 21: 69.8% accurate, 12.7× speedup?

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

\mathbf{else}:\\
\;\;\;\;y + b \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.3e21

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3e21 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{a \cdot b} \]
    5. Step-by-step derivation
      1. *-commutative54.3%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    6. Simplified54.3%

      \[\leadsto y + \color{blue}{b \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.3 \cdot 10^{+21}:\\ \;\;\;\;x - b \cdot \left(0.5 - a\right)\\ \mathbf{else}:\\ \;\;\;\;y + b \cdot a\\ \end{array} \]

Alternative 22: 78.5% accurate, 12.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(x + y\right) - b \cdot \left(0.5 - a\right)} \]
  5. Final simplification77.8%

    \[\leadsto b \cdot \left(a - 0.5\right) + \left(y + x\right) \]

Alternative 23: 37.1% accurate, 37.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.3e+40) x y))
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.3e+40) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    real(8) :: tmp
    if (x <= (-2.3d+40)) then
        tmp = x
    else
        tmp = y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (x <= -2.3e+40) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	tmp = 0
	if x <= -2.3e+40:
		tmp = x
	else:
		tmp = y
	return tmp
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (x <= -2.3e+40)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (x <= -2.3e+40)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.3e+40], x, y]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+40}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.29999999999999994e40

    1. Initial program 99.8%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Step-by-step derivation
      1. remove-double-neg99.8%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \color{blue}{\left(-\left(-\left(a - 0.5\right) \cdot b\right)\right)} \]
      2. distribute-rgt-neg-out99.8%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(-\color{blue}{\left(a - 0.5\right) \cdot \left(-b\right)}\right) \]
      3. associate--l+99.9%

        \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} + \left(-\left(a - 0.5\right) \cdot \left(-b\right)\right) \]
      4. distribute-rgt-neg-in99.9%

        \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \color{blue}{\left(a - 0.5\right) \cdot \left(-\left(-b\right)\right)} \]
      5. sub-neg99.9%

        \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \left(-\left(-b\right)\right) \]
      6. metadata-eval99.9%

        \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \left(-\left(-b\right)\right) \]
      7. remove-double-neg99.9%

        \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + -0.5\right) \cdot \color{blue}{b} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + -0.5\right) \cdot b} \]
    4. Taylor expanded in a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    5. Taylor expanded in x around inf 40.6%

      \[\leadsto \color{blue}{x} \]

    if -2.29999999999999994e40 < x

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l-99.9%

        \[\leadsto \color{blue}{\left(\left(x + y\right) + z\right) - \left(z \cdot \log t - \left(a - 0.5\right) \cdot b\right)} \]
      2. +-commutative99.9%

        \[\leadsto \left(\color{blue}{\left(y + x\right)} + z\right) - \left(z \cdot \log t - \left(a - 0.5\right) \cdot b\right) \]
      3. associate-+l+99.9%

        \[\leadsto \color{blue}{\left(y + \left(x + z\right)\right)} - \left(z \cdot \log t - \left(a - 0.5\right) \cdot b\right) \]
      4. associate--l+99.9%

        \[\leadsto \color{blue}{y + \left(\left(x + z\right) - \left(z \cdot \log t - \left(a - 0.5\right) \cdot b\right)\right)} \]
      5. fma-neg99.9%

        \[\leadsto y + \left(\left(x + z\right) - \color{blue}{\mathsf{fma}\left(z, \log t, -\left(a - 0.5\right) \cdot b\right)}\right) \]
      6. distribute-lft-neg-in99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, \color{blue}{\left(-\left(a - 0.5\right)\right) \cdot b}\right)\right) \]
      7. *-commutative99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, \color{blue}{b \cdot \left(-\left(a - 0.5\right)\right)}\right)\right) \]
      8. sub-neg99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \left(-\color{blue}{\left(a + \left(-0.5\right)\right)}\right)\right)\right) \]
      9. +-commutative99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \left(-\color{blue}{\left(\left(-0.5\right) + a\right)}\right)\right)\right) \]
      10. distribute-neg-in99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \color{blue}{\left(\left(-\left(-0.5\right)\right) + \left(-a\right)\right)}\right)\right) \]
      11. metadata-eval99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \left(\left(-\color{blue}{-0.5}\right) + \left(-a\right)\right)\right)\right) \]
      12. metadata-eval99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \left(\color{blue}{0.5} + \left(-a\right)\right)\right)\right) \]
      13. unsub-neg99.9%

        \[\leadsto y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \color{blue}{\left(0.5 - a\right)}\right)\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{y + \left(\left(x + z\right) - \mathsf{fma}\left(z, \log t, b \cdot \left(0.5 - a\right)\right)\right)} \]
    4. Taylor expanded in y around inf 25.8%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 24: 21.9% accurate, 115.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ x \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a b) :precision binary64 x)
assert(x < y);
double code(double x, double y, double z, double t, double a, double b) {
	return x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    code = x
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a, double b) {
	return x;
}
[x, y] = sort([x, y])
def code(x, y, z, t, a, b):
	return x
x, y = sort([x, y])
function code(x, y, z, t, a, b)
	return x
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a, b)
	tmp = x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Step-by-step derivation
    1. remove-double-neg99.9%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \color{blue}{\left(-\left(-\left(a - 0.5\right) \cdot b\right)\right)} \]
    2. distribute-rgt-neg-out99.9%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(-\color{blue}{\left(a - 0.5\right) \cdot \left(-b\right)}\right) \]
    3. associate--l+99.9%

      \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} + \left(-\left(a - 0.5\right) \cdot \left(-b\right)\right) \]
    4. distribute-rgt-neg-in99.9%

      \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \color{blue}{\left(a - 0.5\right) \cdot \left(-\left(-b\right)\right)} \]
    5. sub-neg99.9%

      \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \color{blue}{\left(a + \left(-0.5\right)\right)} \cdot \left(-\left(-b\right)\right) \]
    6. metadata-eval99.9%

      \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + \color{blue}{-0.5}\right) \cdot \left(-\left(-b\right)\right) \]
    7. remove-double-neg99.9%

      \[\leadsto \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + -0.5\right) \cdot \color{blue}{b} \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + -0.5\right) \cdot b} \]
  4. Taylor expanded in a around 0 99.9%

    \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
  5. Taylor expanded in x around inf 20.2%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification20.2%

    \[\leadsto x \]

Developer target: 99.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \left(\left(x + y\right) + \frac{\left(1 - {\log t}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+
  (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t))))
  (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x + y) + (((1.0 - pow(log(t), 2.0)) * z) / (1.0 + log(t)))) + ((a - 0.5) * b);
}
real(8) function code(x, y, z, t, a, b)
    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), intent (in) :: b
    code = ((x + y) + (((1.0d0 - (log(t) ** 2.0d0)) * z) / (1.0d0 + log(t)))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x + y) + (((1.0 - Math.pow(Math.log(t), 2.0)) * z) / (1.0 + Math.log(t)))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b):
	return ((x + y) + (((1.0 - math.pow(math.log(t), 2.0)) * z) / (1.0 + math.log(t)))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x + y) + Float64(Float64(Float64(1.0 - (log(t) ^ 2.0)) * z) / Float64(1.0 + log(t)))) + Float64(Float64(a - 0.5) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x + y) + (((1.0 - (log(t) ^ 2.0)) * z) / (1.0 + log(t)))) + ((a - 0.5) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + y), $MachinePrecision] + N[(N[(N[(1.0 - N[Power[N[Log[t], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] / N[(1.0 + N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x + y\right) + \frac{\left(1 - {\log t}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b
\end{array}

Reproduce

?
herbie shell --seed 2023293 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

  (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))