Main:z from

Percentage Accurate: 92.0% → 99.8%
Time: 32.2s
Alternatives: 22
Speedup: 1.3×

Specification

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

\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\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 22 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: 92.0% accurate, 1.0× speedup?

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

\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}

Alternative 1: 99.8% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + z}\\ t_2 := \sqrt{x + 1}\\ t_3 := t\_2 - \sqrt{x}\\ t_4 := \sqrt{1 + y}\\ t_5 := \left(t\_3 + \left(t\_4 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\ \mathbf{if}\;t\_5 \leq 0.02:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right) - \sqrt{z}\right)\right)\\ \mathbf{elif}\;t\_5 \leq 2.8:\\ \;\;\;\;t\_3 + \left(\frac{1}{\sqrt{y} + t\_4} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_1}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_4 + \left(\left(t\_1 + \left(t\_3 - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 z)))
        (t_2 (sqrt (+ x 1.0)))
        (t_3 (- t_2 (sqrt x)))
        (t_4 (sqrt (+ 1.0 y)))
        (t_5 (+ (+ t_3 (- t_4 (sqrt y))) (- t_1 (sqrt z)))))
   (if (<= t_5 0.02)
     (+
      (/ 1.0 (+ (sqrt x) t_2))
      (+
       (* 0.5 (sqrt (/ 1.0 y)))
       (- (+ (* 0.5 (sqrt (/ 1.0 t))) t_1) (sqrt z))))
     (if (<= t_5 2.8)
       (+
        t_3
        (+
         (/ 1.0 (+ (sqrt y) t_4))
         (/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) t_1)))) t)))
       (+
        t_4
        (-
         (+ t_1 (- t_3 (sqrt z)))
         (+ (sqrt y) (/ -1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + z));
	double t_2 = sqrt((x + 1.0));
	double t_3 = t_2 - sqrt(x);
	double t_4 = sqrt((1.0 + y));
	double t_5 = (t_3 + (t_4 - sqrt(y))) + (t_1 - sqrt(z));
	double tmp;
	if (t_5 <= 0.02) {
		tmp = (1.0 / (sqrt(x) + t_2)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_1) - sqrt(z)));
	} else if (t_5 <= 2.8) {
		tmp = t_3 + ((1.0 / (sqrt(y) + t_4)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t));
	} else {
		tmp = t_4 + ((t_1 + (t_3 - sqrt(z))) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + z))
    t_2 = sqrt((x + 1.0d0))
    t_3 = t_2 - sqrt(x)
    t_4 = sqrt((1.0d0 + y))
    t_5 = (t_3 + (t_4 - sqrt(y))) + (t_1 - sqrt(z))
    if (t_5 <= 0.02d0) then
        tmp = (1.0d0 / (sqrt(x) + t_2)) + ((0.5d0 * sqrt((1.0d0 / y))) + (((0.5d0 * sqrt((1.0d0 / t))) + t_1) - sqrt(z)))
    else if (t_5 <= 2.8d0) then
        tmp = t_3 + ((1.0d0 / (sqrt(y) + t_4)) + (((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + t_1)))) / t))
    else
        tmp = t_4 + ((t_1 + (t_3 - sqrt(z))) - (sqrt(y) + ((-1.0d0) / (sqrt(t) + sqrt((1.0d0 + t))))))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 + z));
	double t_2 = Math.sqrt((x + 1.0));
	double t_3 = t_2 - Math.sqrt(x);
	double t_4 = Math.sqrt((1.0 + y));
	double t_5 = (t_3 + (t_4 - Math.sqrt(y))) + (t_1 - Math.sqrt(z));
	double tmp;
	if (t_5 <= 0.02) {
		tmp = (1.0 / (Math.sqrt(x) + t_2)) + ((0.5 * Math.sqrt((1.0 / y))) + (((0.5 * Math.sqrt((1.0 / t))) + t_1) - Math.sqrt(z)));
	} else if (t_5 <= 2.8) {
		tmp = t_3 + ((1.0 / (Math.sqrt(y) + t_4)) + (((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + t_1)))) / t));
	} else {
		tmp = t_4 + ((t_1 + (t_3 - Math.sqrt(z))) - (Math.sqrt(y) + (-1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + z))
	t_2 = math.sqrt((x + 1.0))
	t_3 = t_2 - math.sqrt(x)
	t_4 = math.sqrt((1.0 + y))
	t_5 = (t_3 + (t_4 - math.sqrt(y))) + (t_1 - math.sqrt(z))
	tmp = 0
	if t_5 <= 0.02:
		tmp = (1.0 / (math.sqrt(x) + t_2)) + ((0.5 * math.sqrt((1.0 / y))) + (((0.5 * math.sqrt((1.0 / t))) + t_1) - math.sqrt(z)))
	elif t_5 <= 2.8:
		tmp = t_3 + ((1.0 / (math.sqrt(y) + t_4)) + (((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + t_1)))) / t))
	else:
		tmp = t_4 + ((t_1 + (t_3 - math.sqrt(z))) - (math.sqrt(y) + (-1.0 / (math.sqrt(t) + math.sqrt((1.0 + t))))))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + z))
	t_2 = sqrt(Float64(x + 1.0))
	t_3 = Float64(t_2 - sqrt(x))
	t_4 = sqrt(Float64(1.0 + y))
	t_5 = Float64(Float64(t_3 + Float64(t_4 - sqrt(y))) + Float64(t_1 - sqrt(z)))
	tmp = 0.0
	if (t_5 <= 0.02)
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_1) - sqrt(z))));
	elseif (t_5 <= 2.8)
		tmp = Float64(t_3 + Float64(Float64(1.0 / Float64(sqrt(y) + t_4)) + Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + t_1)))) / t)));
	else
		tmp = Float64(t_4 + Float64(Float64(t_1 + Float64(t_3 - sqrt(z))) - Float64(sqrt(y) + Float64(-1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((1.0 + z));
	t_2 = sqrt((x + 1.0));
	t_3 = t_2 - sqrt(x);
	t_4 = sqrt((1.0 + y));
	t_5 = (t_3 + (t_4 - sqrt(y))) + (t_1 - sqrt(z));
	tmp = 0.0;
	if (t_5 <= 0.02)
		tmp = (1.0 / (sqrt(x) + t_2)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_1) - sqrt(z)));
	elseif (t_5 <= 2.8)
		tmp = t_3 + ((1.0 / (sqrt(y) + t_4)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t));
	else
		tmp = t_4 + ((t_1 + (t_3 - sqrt(z))) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$3 + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 0.02], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.8], N[(t$95$3 + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(N[(t$95$1 + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{x + 1}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := \sqrt{1 + y}\\
t_5 := \left(t\_3 + \left(t\_4 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_5 \leq 0.02:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right) - \sqrt{z}\right)\right)\\

\mathbf{elif}\;t\_5 \leq 2.8:\\
\;\;\;\;t\_3 + \left(\frac{1}{\sqrt{y} + t\_4} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_1}}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_4 + \left(\left(t\_1 + \left(t\_3 - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0200000000000000004

    1. Initial program 57.7%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+57.7%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+57.7%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative57.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-57.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative57.7%

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.5%

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

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

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--5.5%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt4.8%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative4.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt5.5%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative5.5%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr5.5%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval10.3%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified10.3%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in y around inf 21.1%

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

    if 0.0200000000000000004 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.7999999999999998

    1. Initial program 96.3%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+96.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+96.3%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative96.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative96.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-79.2%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 50.0%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified50.0%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in t around 0 49.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\frac{0.5 \cdot \sqrt{t} + t \cdot \left(\sqrt{1 + z} - \sqrt{z}\right)}{t}}\right) \]
    9. Step-by-step derivation
      1. flip--49.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\sqrt{1 + z} \cdot \sqrt{1 + z} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
      2. add-sqr-sqrt38.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{\left(1 + z\right)} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. add-sqr-sqrt49.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\left(1 + z\right) - \color{blue}{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
    10. Applied egg-rr49.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\left(1 + z\right) - z}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
    11. Step-by-step derivation
      1. associate--l+50.1%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1 + \color{blue}{0}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. metadata-eval50.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{1}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      4. +-commutative50.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\color{blue}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    12. Simplified50.1%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{1}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    13. Step-by-step derivation
      1. flip--50.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\sqrt{1 + y} + \sqrt{y}}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      2. add-sqr-sqrt39.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{\color{blue}{\left(1 + y\right)} - \sqrt{y} \cdot \sqrt{y}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      3. add-sqr-sqrt50.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
    14. Applied egg-rr50.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\color{blue}{\frac{\left(1 + y\right) - y}{\sqrt{1 + y} + \sqrt{y}}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
    15. Step-by-step derivation
      1. associate--l+50.6%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1 + \color{blue}{0}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      3. metadata-eval50.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      4. +-commutative50.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{\color{blue}{\sqrt{y} + \sqrt{1 + y}}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
    16. Simplified50.6%

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

    if 2.7999999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 99.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative99.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+99.0%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-98.8%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-98.8%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-98.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip--99.0%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \color{blue}{\frac{\sqrt{t} \cdot \sqrt{t} - \sqrt{1 + t} \cdot \sqrt{1 + t}}{\sqrt{t} + \sqrt{1 + t}}}\right)\right) \]
      2. add-sqr-sqrt87.0%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{\color{blue}{t} - \sqrt{1 + t} \cdot \sqrt{1 + t}}{\sqrt{t} + \sqrt{1 + t}}\right)\right) \]
      3. add-sqr-sqrt100.0%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{t - \color{blue}{\left(1 + t\right)}}{\sqrt{t} + \sqrt{1 + t}}\right)\right) \]
      4. +-commutative100.0%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{t - \color{blue}{\left(t + 1\right)}}{\sqrt{t} + \sqrt{1 + t}}\right)\right) \]
      5. +-commutative100.0%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{t - \left(t + 1\right)}{\sqrt{t} + \sqrt{\color{blue}{t + 1}}}\right)\right) \]
    6. Applied egg-rr100.0%

      \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \color{blue}{\frac{t - \left(t + 1\right)}{\sqrt{t} + \sqrt{t + 1}}}\right)\right) \]
    7. Step-by-step derivation
      1. associate--r+99.9%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{\color{blue}{\left(t - t\right) - 1}}{\sqrt{t} + \sqrt{t + 1}}\right)\right) \]
      2. +-inverses99.9%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{\color{blue}{0} - 1}{\sqrt{t} + \sqrt{t + 1}}\right)\right) \]
      3. metadata-eval99.9%

        \[\leadsto \sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{\color{blue}{-1}}{\sqrt{t} + \sqrt{t + 1}}\right)\right) \]
    8. Simplified99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\sqrt{1 + z} - \sqrt{z}\right) \leq 0.02:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right)\\ \mathbf{elif}\;\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\sqrt{1 + z} - \sqrt{z}\right) \leq 2.8:\\ \;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y} + \sqrt{1 + y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.6% accurate, 0.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + z}\\ t_3 := \sqrt{x + 1}\\ t_4 := t\_3 - \sqrt{x}\\ t_5 := \sqrt{1 + t}\\ t_6 := \left(\left(t\_4 + \left(t\_1 - \sqrt{y}\right)\right) + \left(t\_2 - \sqrt{z}\right)\right) + \left(t\_5 - \sqrt{t}\right)\\ \mathbf{if}\;t\_6 \leq 0.02:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_2\right) - \sqrt{z}\right)\right)\\ \mathbf{elif}\;t\_6 \leq 3.01:\\ \;\;\;\;t\_4 + \left(\frac{1}{\sqrt{y} + t\_1} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_2}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\left(t\_3 + \left(t\_2 + t\_5\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y)))
        (t_2 (sqrt (+ 1.0 z)))
        (t_3 (sqrt (+ x 1.0)))
        (t_4 (- t_3 (sqrt x)))
        (t_5 (sqrt (+ 1.0 t)))
        (t_6
         (+ (+ (+ t_4 (- t_1 (sqrt y))) (- t_2 (sqrt z))) (- t_5 (sqrt t)))))
   (if (<= t_6 0.02)
     (+
      (/ 1.0 (+ (sqrt x) t_3))
      (+
       (* 0.5 (sqrt (/ 1.0 y)))
       (- (+ (* 0.5 (sqrt (/ 1.0 t))) t_2) (sqrt z))))
     (if (<= t_6 3.01)
       (+
        t_4
        (+
         (/ 1.0 (+ (sqrt y) t_1))
         (/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) t_2)))) t)))
       (+
        1.0
        (-
         (+ t_3 (+ t_2 t_5))
         (+ (sqrt t) (+ (sqrt z) (+ (sqrt x) (sqrt y))))))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + y));
	double t_2 = sqrt((1.0 + z));
	double t_3 = sqrt((x + 1.0));
	double t_4 = t_3 - sqrt(x);
	double t_5 = sqrt((1.0 + t));
	double t_6 = ((t_4 + (t_1 - sqrt(y))) + (t_2 - sqrt(z))) + (t_5 - sqrt(t));
	double tmp;
	if (t_6 <= 0.02) {
		tmp = (1.0 / (sqrt(x) + t_3)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_2) - sqrt(z)));
	} else if (t_6 <= 3.01) {
		tmp = t_4 + ((1.0 / (sqrt(y) + t_1)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_2)))) / t));
	} else {
		tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y)))));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + y))
    t_2 = sqrt((1.0d0 + z))
    t_3 = sqrt((x + 1.0d0))
    t_4 = t_3 - sqrt(x)
    t_5 = sqrt((1.0d0 + t))
    t_6 = ((t_4 + (t_1 - sqrt(y))) + (t_2 - sqrt(z))) + (t_5 - sqrt(t))
    if (t_6 <= 0.02d0) then
        tmp = (1.0d0 / (sqrt(x) + t_3)) + ((0.5d0 * sqrt((1.0d0 / y))) + (((0.5d0 * sqrt((1.0d0 / t))) + t_2) - sqrt(z)))
    else if (t_6 <= 3.01d0) then
        tmp = t_4 + ((1.0d0 / (sqrt(y) + t_1)) + (((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + t_2)))) / t))
    else
        tmp = 1.0d0 + ((t_3 + (t_2 + t_5)) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y)))))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 + y));
	double t_2 = Math.sqrt((1.0 + z));
	double t_3 = Math.sqrt((x + 1.0));
	double t_4 = t_3 - Math.sqrt(x);
	double t_5 = Math.sqrt((1.0 + t));
	double t_6 = ((t_4 + (t_1 - Math.sqrt(y))) + (t_2 - Math.sqrt(z))) + (t_5 - Math.sqrt(t));
	double tmp;
	if (t_6 <= 0.02) {
		tmp = (1.0 / (Math.sqrt(x) + t_3)) + ((0.5 * Math.sqrt((1.0 / y))) + (((0.5 * Math.sqrt((1.0 / t))) + t_2) - Math.sqrt(z)));
	} else if (t_6 <= 3.01) {
		tmp = t_4 + ((1.0 / (Math.sqrt(y) + t_1)) + (((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + t_2)))) / t));
	} else {
		tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (Math.sqrt(t) + (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)))));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + y))
	t_2 = math.sqrt((1.0 + z))
	t_3 = math.sqrt((x + 1.0))
	t_4 = t_3 - math.sqrt(x)
	t_5 = math.sqrt((1.0 + t))
	t_6 = ((t_4 + (t_1 - math.sqrt(y))) + (t_2 - math.sqrt(z))) + (t_5 - math.sqrt(t))
	tmp = 0
	if t_6 <= 0.02:
		tmp = (1.0 / (math.sqrt(x) + t_3)) + ((0.5 * math.sqrt((1.0 / y))) + (((0.5 * math.sqrt((1.0 / t))) + t_2) - math.sqrt(z)))
	elif t_6 <= 3.01:
		tmp = t_4 + ((1.0 / (math.sqrt(y) + t_1)) + (((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + t_2)))) / t))
	else:
		tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (math.sqrt(t) + (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y)))))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + y))
	t_2 = sqrt(Float64(1.0 + z))
	t_3 = sqrt(Float64(x + 1.0))
	t_4 = Float64(t_3 - sqrt(x))
	t_5 = sqrt(Float64(1.0 + t))
	t_6 = Float64(Float64(Float64(t_4 + Float64(t_1 - sqrt(y))) + Float64(t_2 - sqrt(z))) + Float64(t_5 - sqrt(t)))
	tmp = 0.0
	if (t_6 <= 0.02)
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_2) - sqrt(z))));
	elseif (t_6 <= 3.01)
		tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(sqrt(y) + t_1)) + Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + t_2)))) / t)));
	else
		tmp = Float64(1.0 + Float64(Float64(t_3 + Float64(t_2 + t_5)) - Float64(sqrt(t) + Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y))))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((1.0 + y));
	t_2 = sqrt((1.0 + z));
	t_3 = sqrt((x + 1.0));
	t_4 = t_3 - sqrt(x);
	t_5 = sqrt((1.0 + t));
	t_6 = ((t_4 + (t_1 - sqrt(y))) + (t_2 - sqrt(z))) + (t_5 - sqrt(t));
	tmp = 0.0;
	if (t_6 <= 0.02)
		tmp = (1.0 / (sqrt(x) + t_3)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_2) - sqrt(z)));
	elseif (t_6 <= 3.01)
		tmp = t_4 + ((1.0 / (sqrt(y) + t_1)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_2)))) / t));
	else
		tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y)))));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$4 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.02], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 3.01], N[(t$95$4 + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$3 + N[(t$95$2 + t$95$5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{x + 1}\\
t_4 := t\_3 - \sqrt{x}\\
t_5 := \sqrt{1 + t}\\
t_6 := \left(\left(t\_4 + \left(t\_1 - \sqrt{y}\right)\right) + \left(t\_2 - \sqrt{z}\right)\right) + \left(t\_5 - \sqrt{t}\right)\\
\mathbf{if}\;t\_6 \leq 0.02:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_2\right) - \sqrt{z}\right)\right)\\

\mathbf{elif}\;t\_6 \leq 3.01:\\
\;\;\;\;t\_4 + \left(\frac{1}{\sqrt{y} + t\_1} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_2}}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_3 + \left(t\_2 + t\_5\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\


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

    1. Initial program 17.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+17.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+17.2%

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-17.2%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 4.8%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified4.8%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--4.8%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt4.4%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative4.4%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt4.8%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative4.8%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr4.8%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval13.7%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified13.7%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in y around inf 35.9%

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

    if 0.0200000000000000004 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 3.0099999999999998

    1. Initial program 96.3%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+96.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+96.3%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative96.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative96.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-77.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative77.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified77.3%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 49.8%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified49.8%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in t around 0 49.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\frac{0.5 \cdot \sqrt{t} + t \cdot \left(\sqrt{1 + z} - \sqrt{z}\right)}{t}}\right) \]
    9. Step-by-step derivation
      1. flip--49.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\sqrt{1 + z} \cdot \sqrt{1 + z} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
      2. add-sqr-sqrt40.0%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{\left(1 + z\right)} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. add-sqr-sqrt49.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\left(1 + z\right) - \color{blue}{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
    10. Applied egg-rr49.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\left(1 + z\right) - z}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
    11. Step-by-step derivation
      1. associate--l+50.0%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1 + \color{blue}{0}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. metadata-eval50.0%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{1}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      4. +-commutative50.0%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\color{blue}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    12. Simplified50.0%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{1}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    13. Step-by-step derivation
      1. flip--49.9%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\sqrt{1 + y} + \sqrt{y}}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      2. add-sqr-sqrt40.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{\color{blue}{\left(1 + y\right)} - \sqrt{y} \cdot \sqrt{y}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      3. add-sqr-sqrt50.2%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
    14. Applied egg-rr50.2%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\color{blue}{\frac{\left(1 + y\right) - y}{\sqrt{1 + y} + \sqrt{y}}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
    15. Step-by-step derivation
      1. associate--l+50.4%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1 + \color{blue}{0}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      3. metadata-eval50.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
      4. +-commutative50.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{\color{blue}{\sqrt{y} + \sqrt{1 + y}}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right) \]
    16. Simplified50.4%

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

    if 3.0099999999999998 < (+.f64 (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t)))

    1. Initial program 99.7%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative99.7%

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

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

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-99.7%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-99.7%

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 99.7%

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

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

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

        \[\leadsto 1 + \left(\color{blue}{\left(\left(\sqrt{1 + t} + \sqrt{1 + z}\right) + \sqrt{1 + x}\right)} - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right) \]
      4. +-commutative99.7%

        \[\leadsto 1 + \left(\left(\left(\sqrt{\color{blue}{t + 1}} + \sqrt{1 + z}\right) + \sqrt{1 + x}\right) - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right) \]
      5. associate-+r+99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right) \leq 0.02:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right)\\ \mathbf{elif}\;\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right) \leq 3.01:\\ \;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y} + \sqrt{1 + y}} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\left(\sqrt{x + 1} + \left(\sqrt{1 + z} + \sqrt{1 + t}\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 96.5% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + t}\\ t_3 := \sqrt{1 + z}\\ \mathbf{if}\;t\_2 - \sqrt{t} \leq 5 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_3\right) - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\left(t\_1 + \left(t\_3 + t\_2\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 t))) (t_3 (sqrt (+ 1.0 z))))
   (if (<= (- t_2 (sqrt t)) 5e-6)
     (+
      (/ 1.0 (+ (sqrt x) t_1))
      (+
       (- (+ (* 0.5 (sqrt (/ 1.0 t))) t_3) (sqrt z))
       (- (sqrt (+ 1.0 y)) (sqrt y))))
     (+
      1.0
      (-
       (+ t_1 (+ t_3 t_2))
       (+ (sqrt t) (+ (sqrt z) (+ (sqrt x) (sqrt y)))))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((x + 1.0));
	double t_2 = sqrt((1.0 + t));
	double t_3 = sqrt((1.0 + z));
	double tmp;
	if ((t_2 - sqrt(t)) <= 5e-6) {
		tmp = (1.0 / (sqrt(x) + t_1)) + ((((0.5 * sqrt((1.0 / t))) + t_3) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
	} else {
		tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y)))));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0))
    t_2 = sqrt((1.0d0 + t))
    t_3 = sqrt((1.0d0 + z))
    if ((t_2 - sqrt(t)) <= 5d-6) then
        tmp = (1.0d0 / (sqrt(x) + t_1)) + ((((0.5d0 * sqrt((1.0d0 / t))) + t_3) - sqrt(z)) + (sqrt((1.0d0 + y)) - sqrt(y)))
    else
        tmp = 1.0d0 + ((t_1 + (t_3 + t_2)) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y)))))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((x + 1.0));
	double t_2 = Math.sqrt((1.0 + t));
	double t_3 = Math.sqrt((1.0 + z));
	double tmp;
	if ((t_2 - Math.sqrt(t)) <= 5e-6) {
		tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((((0.5 * Math.sqrt((1.0 / t))) + t_3) - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
	} else {
		tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (Math.sqrt(t) + (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)))));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((x + 1.0))
	t_2 = math.sqrt((1.0 + t))
	t_3 = math.sqrt((1.0 + z))
	tmp = 0
	if (t_2 - math.sqrt(t)) <= 5e-6:
		tmp = (1.0 / (math.sqrt(x) + t_1)) + ((((0.5 * math.sqrt((1.0 / t))) + t_3) - math.sqrt(z)) + (math.sqrt((1.0 + y)) - math.sqrt(y)))
	else:
		tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (math.sqrt(t) + (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y)))))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(x + 1.0))
	t_2 = sqrt(Float64(1.0 + t))
	t_3 = sqrt(Float64(1.0 + z))
	tmp = 0.0
	if (Float64(t_2 - sqrt(t)) <= 5e-6)
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_3) - sqrt(z)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))));
	else
		tmp = Float64(1.0 + Float64(Float64(t_1 + Float64(t_3 + t_2)) - Float64(sqrt(t) + Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y))))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((x + 1.0));
	t_2 = sqrt((1.0 + t));
	t_3 = sqrt((1.0 + z));
	tmp = 0.0;
	if ((t_2 - sqrt(t)) <= 5e-6)
		tmp = (1.0 / (sqrt(x) + t_1)) + ((((0.5 * sqrt((1.0 / t))) + t_3) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
	else
		tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (sqrt(t) + (sqrt(z) + (sqrt(x) + sqrt(y)))));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision], 5e-6], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[(t$95$3 + t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;t\_2 - \sqrt{t} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_3\right) - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + \left(t\_3 + t\_2\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t)) < 5.00000000000000041e-6

    1. Initial program 86.1%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+86.1%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+86.1%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative86.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative86.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-48.9%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative48.9%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative48.9%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified48.9%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 86.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified86.3%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--86.3%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt74.3%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative74.3%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt86.7%

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

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr86.7%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval87.9%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified87.9%

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

    if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))

    1. Initial program 96.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative96.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+96.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.9%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-55.1%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified40.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 13.0%

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

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

        \[\leadsto 1 + \left(\left(\sqrt{1 + t} + \color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + x}\right)}\right) - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right) \]
      3. associate-+r+26.2%

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

        \[\leadsto 1 + \left(\left(\left(\sqrt{\color{blue}{t + 1}} + \sqrt{1 + z}\right) + \sqrt{1 + x}\right) - \left(\sqrt{t} + \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right) \]
      5. associate-+r+26.2%

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

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

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

Alternative 4: 90.4% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := 0.5 \cdot \sqrt{\frac{1}{t}}\\ t_2 := \sqrt{1 + y} - \sqrt{y}\\ t_3 := \sqrt{x + 1}\\ \mathbf{if}\;t\_3 - \sqrt{x} \leq 0.98:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(t\_1 + t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(t\_1 + \sqrt{1 + z}\right) - \sqrt{z}\right) + t\_2\right) + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 0.5 (sqrt (/ 1.0 t))))
        (t_2 (- (sqrt (+ 1.0 y)) (sqrt y)))
        (t_3 (sqrt (+ x 1.0))))
   (if (<= (- t_3 (sqrt x)) 0.98)
     (+ (/ 1.0 (+ (sqrt x) t_3)) (+ t_1 t_2))
     (+
      (+ (- (+ t_1 (sqrt (+ 1.0 z))) (sqrt z)) t_2)
      (+ 1.0 (- (* x 0.5) (sqrt x)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = 0.5 * sqrt((1.0 / t));
	double t_2 = sqrt((1.0 + y)) - sqrt(y);
	double t_3 = sqrt((x + 1.0));
	double tmp;
	if ((t_3 - sqrt(x)) <= 0.98) {
		tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + t_2);
	} else {
		tmp = (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - sqrt(x)));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = 0.5d0 * sqrt((1.0d0 / t))
    t_2 = sqrt((1.0d0 + y)) - sqrt(y)
    t_3 = sqrt((x + 1.0d0))
    if ((t_3 - sqrt(x)) <= 0.98d0) then
        tmp = (1.0d0 / (sqrt(x) + t_3)) + (t_1 + t_2)
    else
        tmp = (((t_1 + sqrt((1.0d0 + z))) - sqrt(z)) + t_2) + (1.0d0 + ((x * 0.5d0) - sqrt(x)))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = 0.5 * Math.sqrt((1.0 / t));
	double t_2 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
	double t_3 = Math.sqrt((x + 1.0));
	double tmp;
	if ((t_3 - Math.sqrt(x)) <= 0.98) {
		tmp = (1.0 / (Math.sqrt(x) + t_3)) + (t_1 + t_2);
	} else {
		tmp = (((t_1 + Math.sqrt((1.0 + z))) - Math.sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - Math.sqrt(x)));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = 0.5 * math.sqrt((1.0 / t))
	t_2 = math.sqrt((1.0 + y)) - math.sqrt(y)
	t_3 = math.sqrt((x + 1.0))
	tmp = 0
	if (t_3 - math.sqrt(x)) <= 0.98:
		tmp = (1.0 / (math.sqrt(x) + t_3)) + (t_1 + t_2)
	else:
		tmp = (((t_1 + math.sqrt((1.0 + z))) - math.sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - math.sqrt(x)))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(0.5 * sqrt(Float64(1.0 / t)))
	t_2 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y))
	t_3 = sqrt(Float64(x + 1.0))
	tmp = 0.0
	if (Float64(t_3 - sqrt(x)) <= 0.98)
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(t_1 + t_2));
	else
		tmp = Float64(Float64(Float64(Float64(t_1 + sqrt(Float64(1.0 + z))) - sqrt(z)) + t_2) + Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = 0.5 * sqrt((1.0 / t));
	t_2 = sqrt((1.0 + y)) - sqrt(y);
	t_3 = sqrt((x + 1.0));
	tmp = 0.0;
	if ((t_3 - sqrt(x)) <= 0.98)
		tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + t_2);
	else
		tmp = (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - sqrt(x)));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.98], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \sqrt{\frac{1}{t}}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
t_3 := \sqrt{x + 1}\\
\mathbf{if}\;t\_3 - \sqrt{x} \leq 0.98:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(t\_1 + t\_2\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t\_1 + \sqrt{1 + z}\right) - \sqrt{z}\right) + t\_2\right) + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.97999999999999998

    1. Initial program 86.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+86.5%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+86.5%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative86.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative86.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-68.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative68.7%

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 36.8%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified36.8%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--36.8%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt24.3%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative24.3%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt37.1%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative37.1%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr37.1%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval38.4%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified38.4%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in t around 0 20.0%

      \[\leadsto \frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \sqrt{\frac{1}{t}}}\right) \]

    if 0.97999999999999998 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x))

    1. Initial program 96.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+96.5%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+96.5%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative96.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative96.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-80.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative80.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified80.3%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 53.4%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified53.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in x around 0 53.4%

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

        \[\leadsto \color{blue}{\left(1 + \left(0.5 \cdot x - \sqrt{x}\right)\right)} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    10. Simplified53.4%

      \[\leadsto \color{blue}{\left(1 + \left(0.5 \cdot x - \sqrt{x}\right)\right)} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification36.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.98:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 91.4% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{\frac{1}{t}}\\ t_2 := \sqrt{x + 1}\\ t_3 := t\_2 - \sqrt{x}\\ t_4 := 0.5 \cdot t\_1\\ t_5 := \sqrt{1 + y} - \sqrt{y}\\ \mathbf{if}\;z \leq 2250000:\\ \;\;\;\;t\_3 + \left(\left(\left(t\_4 + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+31}:\\ \;\;\;\;t\_3 + \left(t\_5 + 0.5 \cdot \left(t\_1 + \sqrt{\frac{1}{z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_4 + t\_5\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (/ 1.0 t)))
        (t_2 (sqrt (+ x 1.0)))
        (t_3 (- t_2 (sqrt x)))
        (t_4 (* 0.5 t_1))
        (t_5 (- (sqrt (+ 1.0 y)) (sqrt y))))
   (if (<= z 2250000.0)
     (+ t_3 (+ (- (+ t_4 (sqrt (+ 1.0 z))) (sqrt z)) (- 1.0 (sqrt y))))
     (if (<= z 4.8e+31)
       (+ t_3 (+ t_5 (* 0.5 (+ t_1 (sqrt (/ 1.0 z))))))
       (+ (/ 1.0 (+ (sqrt x) t_2)) (+ t_4 t_5))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 / t));
	double t_2 = sqrt((x + 1.0));
	double t_3 = t_2 - sqrt(x);
	double t_4 = 0.5 * t_1;
	double t_5 = sqrt((1.0 + y)) - sqrt(y);
	double tmp;
	if (z <= 2250000.0) {
		tmp = t_3 + (((t_4 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
	} else if (z <= 4.8e+31) {
		tmp = t_3 + (t_5 + (0.5 * (t_1 + sqrt((1.0 / z)))));
	} else {
		tmp = (1.0 / (sqrt(x) + t_2)) + (t_4 + t_5);
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = sqrt((1.0d0 / t))
    t_2 = sqrt((x + 1.0d0))
    t_3 = t_2 - sqrt(x)
    t_4 = 0.5d0 * t_1
    t_5 = sqrt((1.0d0 + y)) - sqrt(y)
    if (z <= 2250000.0d0) then
        tmp = t_3 + (((t_4 + sqrt((1.0d0 + z))) - sqrt(z)) + (1.0d0 - sqrt(y)))
    else if (z <= 4.8d+31) then
        tmp = t_3 + (t_5 + (0.5d0 * (t_1 + sqrt((1.0d0 / z)))))
    else
        tmp = (1.0d0 / (sqrt(x) + t_2)) + (t_4 + t_5)
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 / t));
	double t_2 = Math.sqrt((x + 1.0));
	double t_3 = t_2 - Math.sqrt(x);
	double t_4 = 0.5 * t_1;
	double t_5 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
	double tmp;
	if (z <= 2250000.0) {
		tmp = t_3 + (((t_4 + Math.sqrt((1.0 + z))) - Math.sqrt(z)) + (1.0 - Math.sqrt(y)));
	} else if (z <= 4.8e+31) {
		tmp = t_3 + (t_5 + (0.5 * (t_1 + Math.sqrt((1.0 / z)))));
	} else {
		tmp = (1.0 / (Math.sqrt(x) + t_2)) + (t_4 + t_5);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 / t))
	t_2 = math.sqrt((x + 1.0))
	t_3 = t_2 - math.sqrt(x)
	t_4 = 0.5 * t_1
	t_5 = math.sqrt((1.0 + y)) - math.sqrt(y)
	tmp = 0
	if z <= 2250000.0:
		tmp = t_3 + (((t_4 + math.sqrt((1.0 + z))) - math.sqrt(z)) + (1.0 - math.sqrt(y)))
	elif z <= 4.8e+31:
		tmp = t_3 + (t_5 + (0.5 * (t_1 + math.sqrt((1.0 / z)))))
	else:
		tmp = (1.0 / (math.sqrt(x) + t_2)) + (t_4 + t_5)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 / t))
	t_2 = sqrt(Float64(x + 1.0))
	t_3 = Float64(t_2 - sqrt(x))
	t_4 = Float64(0.5 * t_1)
	t_5 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y))
	tmp = 0.0
	if (z <= 2250000.0)
		tmp = Float64(t_3 + Float64(Float64(Float64(t_4 + sqrt(Float64(1.0 + z))) - sqrt(z)) + Float64(1.0 - sqrt(y))));
	elseif (z <= 4.8e+31)
		tmp = Float64(t_3 + Float64(t_5 + Float64(0.5 * Float64(t_1 + sqrt(Float64(1.0 / z))))));
	else
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(t_4 + t_5));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((1.0 / t));
	t_2 = sqrt((x + 1.0));
	t_3 = t_2 - sqrt(x);
	t_4 = 0.5 * t_1;
	t_5 = sqrt((1.0 + y)) - sqrt(y);
	tmp = 0.0;
	if (z <= 2250000.0)
		tmp = t_3 + (((t_4 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
	elseif (z <= 4.8e+31)
		tmp = t_3 + (t_5 + (0.5 * (t_1 + sqrt((1.0 / z)))));
	else
		tmp = (1.0 / (sqrt(x) + t_2)) + (t_4 + t_5);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * t$95$1), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2250000.0], N[(t$95$3 + N[(N[(N[(t$95$4 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e+31], N[(t$95$3 + N[(t$95$5 + N[(0.5 * N[(t$95$1 + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + t$95$5), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{1}{t}}\\
t_2 := \sqrt{x + 1}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := 0.5 \cdot t\_1\\
t_5 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;z \leq 2250000:\\
\;\;\;\;t\_3 + \left(\left(\left(t\_4 + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{+31}:\\
\;\;\;\;t\_3 + \left(t\_5 + 0.5 \cdot \left(t\_1 + \sqrt{\frac{1}{z}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_4 + t\_5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 2.25e6

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+98.2%

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-62.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative62.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative62.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified62.5%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 50.2%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{1 + z} + 0.5 \cdot \sqrt{\frac{1}{t}}\right) - \sqrt{z}\right)}\right) \]
    6. Step-by-step derivation
      1. +-commutative50.2%

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

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in y around 0 26.9%

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

    if 2.25e6 < z < 4.79999999999999965e31

    1. Initial program 73.6%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+73.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+73.6%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative73.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative73.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-73.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative73.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative73.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified73.6%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 38.0%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified38.0%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in z around inf 55.8%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)}\right) \]
    9. Step-by-step derivation
      1. distribute-lft-out55.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \left(\sqrt{\frac{1}{t}} + \sqrt{\frac{1}{z}}\right)}\right) \]
    10. Simplified55.8%

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

    if 4.79999999999999965e31 < z

    1. Initial program 87.1%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+87.1%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+87.1%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative87.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative87.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-87.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative87.1%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified87.1%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 40.8%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified40.8%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--40.8%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt37.3%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative37.3%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt40.9%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative40.9%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr40.9%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval42.2%

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in t around 0 43.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2250000:\\ \;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+31}:\\ \;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + 0.5 \cdot \left(\sqrt{\frac{1}{t}} + \sqrt{\frac{1}{z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 93.4% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 16200000:\\ \;\;\;\;\left(1 - \sqrt{x}\right) + \left(\frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_1}}{t} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right) - \sqrt{z}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 z))))
   (if (<= y 16200000.0)
     (+
      (- 1.0 (sqrt x))
      (+
       (/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) t_1)))) t)
       (- (sqrt (+ 1.0 y)) (sqrt y))))
     (+
      (/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))
      (+
       (* 0.5 (sqrt (/ 1.0 y)))
       (- (+ (* 0.5 (sqrt (/ 1.0 t))) t_1) (sqrt z)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + z));
	double tmp;
	if (y <= 16200000.0) {
		tmp = (1.0 - sqrt(x)) + ((((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t) + (sqrt((1.0 + y)) - sqrt(y)));
	} else {
		tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_1) - sqrt(z)));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + z))
    if (y <= 16200000.0d0) then
        tmp = (1.0d0 - sqrt(x)) + ((((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + t_1)))) / t) + (sqrt((1.0d0 + y)) - sqrt(y)))
    else
        tmp = (1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (((0.5d0 * sqrt((1.0d0 / t))) + t_1) - sqrt(z)))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 + z));
	double tmp;
	if (y <= 16200000.0) {
		tmp = (1.0 - Math.sqrt(x)) + ((((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + t_1)))) / t) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
	} else {
		tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (((0.5 * Math.sqrt((1.0 / t))) + t_1) - Math.sqrt(z)));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + z))
	tmp = 0
	if y <= 16200000.0:
		tmp = (1.0 - math.sqrt(x)) + ((((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + t_1)))) / t) + (math.sqrt((1.0 + y)) - math.sqrt(y)))
	else:
		tmp = (1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (((0.5 * math.sqrt((1.0 / t))) + t_1) - math.sqrt(z)))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + z))
	tmp = 0.0
	if (y <= 16200000.0)
		tmp = Float64(Float64(1.0 - sqrt(x)) + Float64(Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + t_1)))) / t) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))));
	else
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_1) - sqrt(z))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((1.0 + z));
	tmp = 0.0;
	if (y <= 16200000.0)
		tmp = (1.0 - sqrt(x)) + ((((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t) + (sqrt((1.0 + y)) - sqrt(y)));
	else
		tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_1) - sqrt(z)));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 16200000.0], N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 16200000:\\
\;\;\;\;\left(1 - \sqrt{x}\right) + \left(\frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_1}}{t} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right) - \sqrt{z}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.62e7

    1. Initial program 96.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+96.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+96.0%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative96.0%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative96.0%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-78.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative78.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative78.5%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified78.5%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 50.4%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified50.4%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in t around 0 49.2%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\frac{0.5 \cdot \sqrt{t} + t \cdot \left(\sqrt{1 + z} - \sqrt{z}\right)}{t}}\right) \]
    9. Step-by-step derivation
      1. flip--49.2%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\sqrt{1 + z} \cdot \sqrt{1 + z} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
      2. add-sqr-sqrt39.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{\left(1 + z\right)} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. add-sqr-sqrt49.2%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\left(1 + z\right) - \color{blue}{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
    10. Applied egg-rr49.2%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\left(1 + z\right) - z}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
    11. Step-by-step derivation
      1. associate--l+50.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1 + \color{blue}{0}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. metadata-eval50.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{1}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      4. +-commutative50.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\color{blue}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    12. Simplified50.3%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{1}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    13. Taylor expanded in x around 0 26.8%

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

    if 1.62e7 < y

    1. Initial program 87.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+87.4%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+87.4%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative87.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative87.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-70.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative70.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative70.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified70.8%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 40.2%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{1 + z} + 0.5 \cdot \sqrt{\frac{1}{t}}\right) - \sqrt{z}\right)}\right) \]
    6. Step-by-step derivation
      1. +-commutative40.2%

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

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--40.2%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt36.1%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative36.1%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt40.2%

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

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr40.2%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval41.4%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified41.4%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in y around inf 44.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 16200000:\\ \;\;\;\;\left(1 - \sqrt{x}\right) + \left(\frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 91.3% accurate, 1.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 4.49999999999999985e73

    1. Initial program 93.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+93.4%

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

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative93.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative93.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-65.3%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative65.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified65.3%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 45.9%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified45.9%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in t around 0 46.7%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\frac{0.5 \cdot \sqrt{t} + t \cdot \left(\sqrt{1 + z} - \sqrt{z}\right)}{t}}\right) \]
    9. Step-by-step derivation
      1. flip--46.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\sqrt{1 + z} \cdot \sqrt{1 + z} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
      2. add-sqr-sqrt45.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{\left(1 + z\right)} - \sqrt{z} \cdot \sqrt{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. add-sqr-sqrt46.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\left(1 + z\right) - \color{blue}{z}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
    10. Applied egg-rr46.7%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{\left(1 + z\right) - z}{\sqrt{1 + z} + \sqrt{z}}}}{t}\right) \]
    11. Step-by-step derivation
      1. associate--l+49.8%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1 + \color{blue}{0}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      3. metadata-eval49.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{\color{blue}{1}}{\sqrt{1 + z} + \sqrt{z}}}{t}\right) \]
      4. +-commutative49.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\color{blue}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    12. Simplified49.8%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \frac{0.5 \cdot \sqrt{t} + t \cdot \color{blue}{\frac{1}{\sqrt{z} + \sqrt{1 + z}}}}{t}\right) \]
    13. Taylor expanded in x around 0 24.7%

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

    if 4.49999999999999985e73 < z

    1. Initial program 88.7%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+88.7%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+88.7%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative88.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-88.7%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative88.7%

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 44.0%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified44.0%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--44.0%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt40.8%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative40.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt44.0%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative44.0%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr44.0%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval45.3%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified45.3%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in t around 0 46.2%

      \[\leadsto \frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \sqrt{\frac{1}{t}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 4.5 \cdot 10^{+73}:\\ \;\;\;\;\left(1 - \sqrt{x}\right) + \left(\frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 90.1% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := 0.5 \cdot \sqrt{\frac{1}{t}}\\ t_2 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 6.6 \cdot 10^{-15}:\\ \;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(\left(\left(t\_1 + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* 0.5 (sqrt (/ 1.0 t)))) (t_2 (sqrt (+ x 1.0))))
   (if (<= y 6.6e-15)
     (+
      (- t_2 (sqrt x))
      (+ (- (+ t_1 (sqrt (+ 1.0 z))) (sqrt z)) (- 1.0 (sqrt y))))
     (+ (/ 1.0 (+ (sqrt x) t_2)) (+ t_1 (- (sqrt (+ 1.0 y)) (sqrt y)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = 0.5 * sqrt((1.0 / t));
	double t_2 = sqrt((x + 1.0));
	double tmp;
	if (y <= 6.6e-15) {
		tmp = (t_2 - sqrt(x)) + (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
	} else {
		tmp = (1.0 / (sqrt(x) + t_2)) + (t_1 + (sqrt((1.0 + y)) - sqrt(y)));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 0.5d0 * sqrt((1.0d0 / t))
    t_2 = sqrt((x + 1.0d0))
    if (y <= 6.6d-15) then
        tmp = (t_2 - sqrt(x)) + (((t_1 + sqrt((1.0d0 + z))) - sqrt(z)) + (1.0d0 - sqrt(y)))
    else
        tmp = (1.0d0 / (sqrt(x) + t_2)) + (t_1 + (sqrt((1.0d0 + y)) - sqrt(y)))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = 0.5 * Math.sqrt((1.0 / t));
	double t_2 = Math.sqrt((x + 1.0));
	double tmp;
	if (y <= 6.6e-15) {
		tmp = (t_2 - Math.sqrt(x)) + (((t_1 + Math.sqrt((1.0 + z))) - Math.sqrt(z)) + (1.0 - Math.sqrt(y)));
	} else {
		tmp = (1.0 / (Math.sqrt(x) + t_2)) + (t_1 + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = 0.5 * math.sqrt((1.0 / t))
	t_2 = math.sqrt((x + 1.0))
	tmp = 0
	if y <= 6.6e-15:
		tmp = (t_2 - math.sqrt(x)) + (((t_1 + math.sqrt((1.0 + z))) - math.sqrt(z)) + (1.0 - math.sqrt(y)))
	else:
		tmp = (1.0 / (math.sqrt(x) + t_2)) + (t_1 + (math.sqrt((1.0 + y)) - math.sqrt(y)))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(0.5 * sqrt(Float64(1.0 / t)))
	t_2 = sqrt(Float64(x + 1.0))
	tmp = 0.0
	if (y <= 6.6e-15)
		tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(Float64(Float64(t_1 + sqrt(Float64(1.0 + z))) - sqrt(z)) + Float64(1.0 - sqrt(y))));
	else
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = 0.5 * sqrt((1.0 / t));
	t_2 = sqrt((x + 1.0));
	tmp = 0.0;
	if (y <= 6.6e-15)
		tmp = (t_2 - sqrt(x)) + (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
	else
		tmp = (1.0 / (sqrt(x) + t_2)) + (t_1 + (sqrt((1.0 + y)) - sqrt(y)));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6.6e-15], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \sqrt{\frac{1}{t}}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 6.6 \cdot 10^{-15}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(\left(\left(t\_1 + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 6.6e-15

    1. Initial program 96.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+96.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+96.2%

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-78.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative78.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative78.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified78.4%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 49.9%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified49.9%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in y around 0 49.9%

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

    if 6.6e-15 < y

    1. Initial program 88.1%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+88.1%

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

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative88.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative88.1%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-71.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative71.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative71.8%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified71.8%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 41.7%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified41.7%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--41.7%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt36.7%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative36.7%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt41.7%

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

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr41.7%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval42.8%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified42.8%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in t around 0 28.0%

      \[\leadsto \frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \sqrt{\frac{1}{t}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.6 \cdot 10^{-15}:\\ \;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 90.5% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 2.4 \cdot 10^{+16}:\\ \;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_2 - \sqrt{y}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
   (if (<= z 2.4e+16)
     (+ t_1 (+ t_2 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (+ (sqrt x) (sqrt y))))))
     (+
      (/ 1.0 (+ (sqrt x) t_1))
      (+ (* 0.5 (sqrt (/ 1.0 t))) (- t_2 (sqrt y)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((x + 1.0));
	double t_2 = sqrt((1.0 + y));
	double tmp;
	if (z <= 2.4e+16) {
		tmp = t_1 + (t_2 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y)))));
	} else {
		tmp = (1.0 / (sqrt(x) + t_1)) + ((0.5 * sqrt((1.0 / t))) + (t_2 - sqrt(y)));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0))
    t_2 = sqrt((1.0d0 + y))
    if (z <= 2.4d+16) then
        tmp = t_1 + (t_2 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y)))))
    else
        tmp = (1.0d0 / (sqrt(x) + t_1)) + ((0.5d0 * sqrt((1.0d0 / t))) + (t_2 - sqrt(y)))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((x + 1.0));
	double t_2 = Math.sqrt((1.0 + y));
	double tmp;
	if (z <= 2.4e+16) {
		tmp = t_1 + (t_2 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)))));
	} else {
		tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((0.5 * Math.sqrt((1.0 / t))) + (t_2 - Math.sqrt(y)));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((x + 1.0))
	t_2 = math.sqrt((1.0 + y))
	tmp = 0
	if z <= 2.4e+16:
		tmp = t_1 + (t_2 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y)))))
	else:
		tmp = (1.0 / (math.sqrt(x) + t_1)) + ((0.5 * math.sqrt((1.0 / t))) + (t_2 - math.sqrt(y)))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(x + 1.0))
	t_2 = sqrt(Float64(1.0 + y))
	tmp = 0.0
	if (z <= 2.4e+16)
		tmp = Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y))))));
	else
		tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(t_2 - sqrt(y))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((x + 1.0));
	t_2 = sqrt((1.0 + y));
	tmp = 0.0;
	if (z <= 2.4e+16)
		tmp = t_1 + (t_2 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y)))));
	else
		tmp = (1.0 / (sqrt(x) + t_1)) + ((0.5 * sqrt((1.0 / t))) + (t_2 - sqrt(y)));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.4e+16], N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_2 - \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.4e16

    1. Initial program 98.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.0%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.5%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.2%

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.0%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.3%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.3%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.3%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]

    if 2.4e16 < z

    1. Initial program 85.6%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+85.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+85.6%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified85.6%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 40.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified40.3%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--40.3%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt37.0%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative37.0%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt40.3%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative40.3%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr40.3%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval41.5%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified41.5%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in t around 0 42.9%

      \[\leadsto \frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \sqrt{\frac{1}{t}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification32.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.4 \cdot 10^{+16}:\\ \;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 90.5% accurate, 1.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_1 - \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 9.6e15

    1. Initial program 98.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.0%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.5%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.2%

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.0%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.3%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.3%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.3%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 14.8%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]

    if 9.6e15 < z

    1. Initial program 85.6%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+85.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+85.6%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative85.6%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified85.6%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 40.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified40.3%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Step-by-step derivation
      1. flip--40.3%

        \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      2. add-sqr-sqrt37.0%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. +-commutative37.0%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      4. add-sqr-sqrt40.3%

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      5. +-commutative40.3%

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    9. Applied egg-rr40.3%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
      3. metadata-eval41.5%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    11. Simplified41.5%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)\right) \]
    12. Taylor expanded in t around 0 42.9%

      \[\leadsto \frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \sqrt{\frac{1}{t}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9.6 \cdot 10^{+15}:\\ \;\;\;\;\left(1 + \left(\sqrt{1 + z} + \sqrt{1 + y}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 86.4% accurate, 1.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_1 - \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 9e16

    1. Initial program 97.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative97.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+97.0%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-77.6%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.0%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified50.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.2%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.5%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.5%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.5%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 15.1%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]

    if 9e16 < z

    1. Initial program 86.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+86.4%

        \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      2. associate-+l+86.4%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative86.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
      4. +-commutative86.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-86.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\sqrt{t + 1} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)}\right) \]
      6. +-commutative86.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{\color{blue}{1 + t}} - \left(\sqrt{t} - \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right)\right) \]
      7. +-commutative86.4%

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right)\right)\right)\right) \]
    3. Simplified86.4%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + t} - \left(\sqrt{t} - \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 40.3%

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right)} - \sqrt{z}\right)\right) \]
    7. Simplified40.3%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + \sqrt{1 + z}\right) - \sqrt{z}\right)}\right) \]
    8. Taylor expanded in t around 0 42.2%

      \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{0.5 \cdot \sqrt{\frac{1}{t}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9 \cdot 10^{+16}:\\ \;\;\;\;\left(1 + \left(\sqrt{1 + z} + \sqrt{1 + y}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 85.9% accurate, 1.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x} + \sqrt{y}\\ \mathbf{if}\;z \leq 3000000:\\ \;\;\;\;\sqrt{x + 1} + \left(1 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - t\_1\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (sqrt x) (sqrt y))))
   (if (<= z 3000000.0)
     (+ (sqrt (+ x 1.0)) (+ 1.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1))))
     (+ 1.0 (+ (* 0.5 (sqrt (/ 1.0 z))) (- (sqrt (+ 1.0 y)) t_1))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt(x) + sqrt(y);
	double tmp;
	if (z <= 3000000.0) {
		tmp = sqrt((x + 1.0)) + (1.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1)));
	} else {
		tmp = 1.0 + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + y)) - t_1));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt(x) + sqrt(y)
    if (z <= 3000000.0d0) then
        tmp = sqrt((x + 1.0d0)) + (1.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + t_1)))
    else
        tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / z))) + (sqrt((1.0d0 + y)) - t_1))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt(x) + Math.sqrt(y);
	double tmp;
	if (z <= 3000000.0) {
		tmp = Math.sqrt((x + 1.0)) + (1.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1)));
	} else {
		tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / z))) + (Math.sqrt((1.0 + y)) - t_1));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt(x) + math.sqrt(y)
	tmp = 0
	if z <= 3000000.0:
		tmp = math.sqrt((x + 1.0)) + (1.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1)))
	else:
		tmp = 1.0 + ((0.5 * math.sqrt((1.0 / z))) + (math.sqrt((1.0 + y)) - t_1))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(sqrt(x) + sqrt(y))
	tmp = 0.0
	if (z <= 3000000.0)
		tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1))));
	else
		tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(sqrt(Float64(1.0 + y)) - t_1)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt(x) + sqrt(y);
	tmp = 0.0;
	if (z <= 3000000.0)
		tmp = sqrt((x + 1.0)) + (1.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1)));
	else
		tmp = 1.0 + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + y)) - t_1));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 3000000:\\
\;\;\;\;\sqrt{x + 1} + \left(1 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - t\_1\right)\right)\\


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

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified51.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.1%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.5%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.5%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.5%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in y around 0 14.8%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\left(1 + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate--l+14.8%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      2. associate-+r+14.8%

        \[\leadsto \sqrt{1 + x} + \left(1 + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
      3. +-commutative14.8%

        \[\leadsto \sqrt{1 + x} + \left(1 + \left(\sqrt{1 + z} - \color{blue}{\left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)}\right)\right) \]
    10. Simplified14.8%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(1 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)} \]

    if 3e6 < z

    1. Initial program 85.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.5%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.5%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-63.8%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-50.7%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.7%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified30.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.2%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+26.0%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+26.0%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified26.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 4.8%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    9. Taylor expanded in z around inf 18.5%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)} \]
    10. Step-by-step derivation
      1. associate--l+37.0%

        \[\leadsto \color{blue}{1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
      2. +-commutative37.0%

        \[\leadsto 1 + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \sqrt{y}\right)\right) \]
      3. associate--l+37.1%

        \[\leadsto 1 + \color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    11. Simplified37.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3000000:\\ \;\;\;\;\sqrt{x + 1} + \left(1 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 85.9% accurate, 2.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\


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

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified51.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.1%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.5%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.5%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.5%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 14.9%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    9. Taylor expanded in y around 0 12.7%

      \[\leadsto \color{blue}{\left(2 + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    10. Step-by-step derivation
      1. +-commutative12.7%

        \[\leadsto \color{blue}{\left(\sqrt{1 + z} + 2\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
    11. Simplified12.7%

      \[\leadsto \color{blue}{\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]

    if 3e6 < z

    1. Initial program 85.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.5%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.5%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-63.8%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-50.7%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.7%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified30.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.2%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+26.0%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+26.0%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified26.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 4.8%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    9. Taylor expanded in z around inf 18.5%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)} \]
    10. Step-by-step derivation
      1. associate--l+37.0%

        \[\leadsto \color{blue}{1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
      2. +-commutative37.0%

        \[\leadsto 1 + \left(\color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{z}} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \sqrt{y}\right)\right) \]
      3. associate--l+37.1%

        \[\leadsto 1 + \color{blue}{\left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    11. Simplified37.1%

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

Alternative 14: 84.8% accurate, 2.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 7.5e10

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified51.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.1%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.5%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.5%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.5%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 14.9%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    9. Taylor expanded in y around 0 12.7%

      \[\leadsto \color{blue}{\left(2 + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    10. Step-by-step derivation
      1. +-commutative12.7%

        \[\leadsto \color{blue}{\left(\sqrt{1 + z} + 2\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
    11. Simplified12.7%

      \[\leadsto \color{blue}{\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]

    if 7.5e10 < z

    1. Initial program 85.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.5%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.5%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-63.8%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-50.7%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.7%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified30.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.2%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+26.0%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+26.0%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified26.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in z around inf 34.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 75000000000:\\ \;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 84.8% accurate, 2.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.6e10

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-78.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-65.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified51.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.1%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.5%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.5%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.5%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 14.9%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    9. Taylor expanded in y around 0 12.7%

      \[\leadsto \color{blue}{\left(2 + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    10. Step-by-step derivation
      1. +-commutative12.7%

        \[\leadsto \color{blue}{\left(\sqrt{1 + z} + 2\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
      2. associate--l+12.7%

        \[\leadsto \color{blue}{\sqrt{1 + z} + \left(2 - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    11. Simplified12.7%

      \[\leadsto \color{blue}{\sqrt{1 + z} + \left(2 - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]

    if 6.6e10 < z

    1. Initial program 85.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.5%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.5%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-63.8%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-50.7%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.7%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified30.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.2%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+26.0%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+26.0%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified26.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in z around inf 34.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 66000000000:\\ \;\;\;\;\sqrt{1 + z} + \left(2 - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 80.9% accurate, 2.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 0.66:\\ \;\;\;\;t\_1 + \left(\left(1 + t\_2\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 + \left(t\_2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
   (if (<= z 0.66)
     (+ t_1 (- (+ 1.0 t_2) (sqrt y)))
     (+ t_1 (- t_2 (+ (sqrt x) (sqrt y)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((x + 1.0));
	double t_2 = sqrt((1.0 + y));
	double tmp;
	if (z <= 0.66) {
		tmp = t_1 + ((1.0 + t_2) - sqrt(y));
	} else {
		tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0))
    t_2 = sqrt((1.0d0 + y))
    if (z <= 0.66d0) then
        tmp = t_1 + ((1.0d0 + t_2) - sqrt(y))
    else
        tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((x + 1.0));
	double t_2 = Math.sqrt((1.0 + y));
	double tmp;
	if (z <= 0.66) {
		tmp = t_1 + ((1.0 + t_2) - Math.sqrt(y));
	} else {
		tmp = t_1 + (t_2 - (Math.sqrt(x) + Math.sqrt(y)));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((x + 1.0))
	t_2 = math.sqrt((1.0 + y))
	tmp = 0
	if z <= 0.66:
		tmp = t_1 + ((1.0 + t_2) - math.sqrt(y))
	else:
		tmp = t_1 + (t_2 - (math.sqrt(x) + math.sqrt(y)))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(x + 1.0))
	t_2 = sqrt(Float64(1.0 + y))
	tmp = 0.0
	if (z <= 0.66)
		tmp = Float64(t_1 + Float64(Float64(1.0 + t_2) - sqrt(y)));
	else
		tmp = Float64(t_1 + Float64(t_2 - Float64(sqrt(x) + sqrt(y))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((x + 1.0));
	t_2 = sqrt((1.0 + y));
	tmp = 0.0;
	if (z <= 0.66)
		tmp = t_1 + ((1.0 + t_2) - sqrt(y));
	else
		tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.66], N[(t$95$1 + N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.66:\\
\;\;\;\;t\_1 + \left(\left(1 + t\_2\right) - \sqrt{y}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 0.660000000000000031

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-79.1%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-66.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.8%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified51.8%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.4%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.6%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.6%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in y around inf 21.1%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\sqrt{y}}\right)\right) \]
    9. Taylor expanded in z around 0 21.1%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)} \]

    if 0.660000000000000031 < z

    1. Initial program 85.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.9%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-63.6%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-50.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified29.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.3%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+25.7%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+25.7%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified25.7%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in z around inf 34.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 0.66:\\ \;\;\;\;\sqrt{x + 1} + \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 80.8% accurate, 2.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 0.56:\\ \;\;\;\;t\_1 + \left(\left(1 + t\_2\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 + \left(t\_2 - \sqrt{y}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
   (if (<= z 0.56) (+ t_1 (- (+ 1.0 t_2) (sqrt y))) (+ t_1 (- t_2 (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((x + 1.0));
	double t_2 = sqrt((1.0 + y));
	double tmp;
	if (z <= 0.56) {
		tmp = t_1 + ((1.0 + t_2) - sqrt(y));
	} else {
		tmp = t_1 + (t_2 - sqrt(y));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0))
    t_2 = sqrt((1.0d0 + y))
    if (z <= 0.56d0) then
        tmp = t_1 + ((1.0d0 + t_2) - sqrt(y))
    else
        tmp = t_1 + (t_2 - sqrt(y))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((x + 1.0));
	double t_2 = Math.sqrt((1.0 + y));
	double tmp;
	if (z <= 0.56) {
		tmp = t_1 + ((1.0 + t_2) - Math.sqrt(y));
	} else {
		tmp = t_1 + (t_2 - Math.sqrt(y));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((x + 1.0))
	t_2 = math.sqrt((1.0 + y))
	tmp = 0
	if z <= 0.56:
		tmp = t_1 + ((1.0 + t_2) - math.sqrt(y))
	else:
		tmp = t_1 + (t_2 - math.sqrt(y))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(x + 1.0))
	t_2 = sqrt(Float64(1.0 + y))
	tmp = 0.0
	if (z <= 0.56)
		tmp = Float64(t_1 + Float64(Float64(1.0 + t_2) - sqrt(y)));
	else
		tmp = Float64(t_1 + Float64(t_2 - sqrt(y)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((x + 1.0));
	t_2 = sqrt((1.0 + y));
	tmp = 0.0;
	if (z <= 0.56)
		tmp = t_1 + ((1.0 + t_2) - sqrt(y));
	else
		tmp = t_1 + (t_2 - sqrt(y));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.56], N[(t$95$1 + N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.56:\\
\;\;\;\;t\_1 + \left(\left(1 + t\_2\right) - \sqrt{y}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 - \sqrt{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 0.56000000000000005

    1. Initial program 98.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative98.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+98.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-79.1%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-66.4%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-51.8%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified51.8%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.4%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+21.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+21.6%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified21.6%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in y around inf 21.1%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\sqrt{y}}\right)\right) \]
    9. Taylor expanded in z around 0 21.1%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)} \]

    if 0.56000000000000005 < z

    1. Initial program 85.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.9%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-63.6%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-50.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-50.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified29.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 5.3%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+25.7%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+25.7%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified25.7%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in y around inf 34.4%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{y}}\right) \]
    9. Step-by-step derivation
      1. mul-1-neg34.4%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{y}\right)}\right) \]
    10. Simplified34.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 0.56:\\ \;\;\;\;\sqrt{x + 1} + \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 65.3% accurate, 2.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3e17

    1. Initial program 95.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative95.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+95.0%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-95.0%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-95.0%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-95.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified75.3%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 17.7%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+29.0%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+29.0%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified29.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 15.7%

      \[\leadsto \color{blue}{\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    9. Step-by-step derivation
      1. add-cube-cbrt15.7%

        \[\leadsto \left(1 + \color{blue}{\left(\sqrt[3]{\sqrt{1 + y} + \sqrt{1 + z}} \cdot \sqrt[3]{\sqrt{1 + y} + \sqrt{1 + z}}\right) \cdot \sqrt[3]{\sqrt{1 + y} + \sqrt{1 + z}}}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
      2. pow315.7%

        \[\leadsto \left(1 + \color{blue}{{\left(\sqrt[3]{\sqrt{1 + y} + \sqrt{1 + z}}\right)}^{3}}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
    10. Applied egg-rr15.7%

      \[\leadsto \left(1 + \color{blue}{{\left(\sqrt[3]{\sqrt{1 + y} + \sqrt{1 + z}}\right)}^{3}}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
    11. Taylor expanded in z around inf 20.6%

      \[\leadsto \color{blue}{\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)} \]
    12. Step-by-step derivation
      1. associate--l+20.6%

        \[\leadsto \color{blue}{1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
      2. +-commutative20.6%

        \[\leadsto 1 + \left(\sqrt{1 + y} - \color{blue}{\left(\sqrt{y} + \sqrt{x}\right)}\right) \]
    13. Simplified20.6%

      \[\leadsto \color{blue}{1 + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)} \]

    if 3e17 < y

    1. Initial program 88.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative88.0%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+88.0%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-46.1%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-19.9%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-6.0%

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 3.9%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+18.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+18.6%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified18.6%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 5.8%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{x}}\right) \]
    9. Step-by-step derivation
      1. neg-mul-15.8%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
    10. Simplified5.8%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
    11. Taylor expanded in x around inf 23.7%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    12. Step-by-step derivation
      1. neg-mul-123.7%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    13. Simplified23.7%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+17}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - \sqrt{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 61.5% accurate, 3.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x + 1} - \sqrt{x}\\ \mathbf{if}\;y \leq 3.8:\\ \;\;\;\;1 + t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))) (if (<= y 3.8) (+ 1.0 t_1) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((x + 1.0)) - sqrt(x);
	double tmp;
	if (y <= 3.8) {
		tmp = 1.0 + t_1;
	} else {
		tmp = t_1;
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0)) - sqrt(x)
    if (y <= 3.8d0) then
        tmp = 1.0d0 + t_1
    else
        tmp = t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
	double tmp;
	if (y <= 3.8) {
		tmp = 1.0 + t_1;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((x + 1.0)) - math.sqrt(x)
	tmp = 0
	if y <= 3.8:
		tmp = 1.0 + t_1
	else:
		tmp = t_1
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x))
	tmp = 0.0
	if (y <= 3.8)
		tmp = Float64(1.0 + t_1);
	else
		tmp = t_1;
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((x + 1.0)) - sqrt(x);
	tmp = 0.0;
	if (y <= 3.8)
		tmp = 1.0 + t_1;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.8], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;y \leq 3.8:\\
\;\;\;\;1 + t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.7999999999999998

    1. Initial program 96.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative96.2%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+96.2%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-96.1%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-96.1%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-96.1%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified77.6%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 18.4%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+30.0%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+30.0%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified30.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 21.1%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{x}}\right) \]
    9. Step-by-step derivation
      1. neg-mul-121.1%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
    10. Simplified21.1%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
    11. Taylor expanded in y around 0 21.1%

      \[\leadsto \color{blue}{\left(1 + \sqrt{1 + x}\right) - \sqrt{x}} \]
    12. Step-by-step derivation
      1. associate--l+33.1%

        \[\leadsto \color{blue}{1 + \left(\sqrt{1 + x} - \sqrt{x}\right)} \]
    13. Simplified33.1%

      \[\leadsto \color{blue}{1 + \left(\sqrt{1 + x} - \sqrt{x}\right)} \]

    if 3.7999999999999998 < y

    1. Initial program 87.3%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative87.3%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+87.3%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-47.6%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-22.7%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-9.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified5.8%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 4.0%

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

        \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
      2. associate--l+18.2%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
      3. associate-+r+18.2%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
    7. Simplified18.2%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 6.1%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{x}}\right) \]
    9. Step-by-step derivation
      1. neg-mul-16.1%

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
    10. Simplified6.1%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
    11. Taylor expanded in x around inf 24.1%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    12. Step-by-step derivation
      1. neg-mul-124.1%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    13. Simplified24.1%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.8:\\ \;\;\;\;1 + \left(\sqrt{x + 1} - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - \sqrt{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 35.4% accurate, 4.0× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Step-by-step derivation
    1. +-commutative91.6%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. associate-+r+91.6%

      \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. associate-+r-70.7%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-57.7%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. associate-+r-50.8%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
  3. Simplified40.0%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 10.9%

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

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    2. associate--l+23.8%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
    3. associate-+r+23.8%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
  7. Simplified23.8%

    \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
  8. Taylor expanded in x around inf 13.2%

    \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{x}}\right) \]
  9. Step-by-step derivation
    1. neg-mul-113.2%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
  10. Simplified13.2%

    \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
  11. Taylor expanded in x around inf 17.7%

    \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
  12. Step-by-step derivation
    1. neg-mul-117.7%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
  13. Simplified17.7%

    \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
  14. Final simplification17.7%

    \[\leadsto \sqrt{x + 1} - \sqrt{x} \]
  15. Add Preprocessing

Alternative 21: 15.2% accurate, 8.0× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Step-by-step derivation
    1. +-commutative91.6%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. associate-+r+91.6%

      \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. associate-+r-70.7%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-57.7%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. associate-+r-50.8%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
  3. Simplified40.0%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 10.9%

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

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    2. associate--l+23.8%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
    3. associate-+r+23.8%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
  7. Simplified23.8%

    \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
  8. Taylor expanded in x around inf 13.2%

    \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{x}}\right) \]
  9. Step-by-step derivation
    1. neg-mul-113.2%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
  10. Simplified13.2%

    \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
  11. Taylor expanded in x around inf 14.6%

    \[\leadsto \color{blue}{\sqrt{1 + y}} \]
  12. Add Preprocessing

Alternative 22: 7.6% accurate, 8.1× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Step-by-step derivation
    1. +-commutative91.6%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. associate-+r+91.6%

      \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. associate-+r-70.7%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-57.7%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. associate-+r-50.8%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
  3. Simplified40.0%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 10.9%

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

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    2. associate--l+23.8%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)} \]
    3. associate-+r+23.8%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \color{blue}{\left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)}\right)\right) \]
  7. Simplified23.8%

    \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right)\right)} \]
  8. Taylor expanded in x around inf 13.2%

    \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{-1 \cdot \sqrt{x}}\right) \]
  9. Step-by-step derivation
    1. neg-mul-113.2%

      \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
  10. Simplified13.2%

    \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + y} + \color{blue}{\left(-\sqrt{x}\right)}\right) \]
  11. Taylor expanded in y around inf 6.9%

    \[\leadsto \color{blue}{\sqrt{y}} \]
  12. Add Preprocessing

Developer target: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+
  (+
   (+
    (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
    (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
   (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
  (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
	return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
	return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t):
	return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t)))
end
function tmp = code(x, y, z, t)
	tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}

Reproduce

?
herbie shell --seed 2024108 
(FPCore (x y z t)
  :name "Main:z from "
  :precision binary64

  :alt
  (+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))

  (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))