Main:z from

Percentage Accurate: 91.7% → 99.4%
Time: 25.6s
Alternatives: 16
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 16 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: 91.7% 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.4% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\ t_2 := \sqrt{1 + x}\\ t_3 := t_2 - \sqrt{x}\\ t_4 := \sqrt{1 + z}\\ \mathbf{if}\;t_3 \leq 0.999999999998:\\ \;\;\;\;\left(\frac{1}{t_2 + \sqrt{x}} + t_1\right) + \left(t_4 - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + t_3\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t_4 + \sqrt{z}}\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 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
        (t_2 (sqrt (+ 1.0 x)))
        (t_3 (- t_2 (sqrt x)))
        (t_4 (sqrt (+ 1.0 z))))
   (if (<= t_3 0.999999999998)
     (+ (+ (/ 1.0 (+ t_2 (sqrt x))) t_1) (- t_4 (sqrt z)))
     (+
      (+ t_1 t_3)
      (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_4 (sqrt z))))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
	double t_2 = sqrt((1.0 + x));
	double t_3 = t_2 - sqrt(x);
	double t_4 = sqrt((1.0 + z));
	double tmp;
	if (t_3 <= 0.999999999998) {
		tmp = ((1.0 / (t_2 + sqrt(x))) + t_1) + (t_4 - sqrt(z));
	} else {
		tmp = (t_1 + t_3) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_4 + 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) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
    t_2 = sqrt((1.0d0 + x))
    t_3 = t_2 - sqrt(x)
    t_4 = sqrt((1.0d0 + z))
    if (t_3 <= 0.999999999998d0) then
        tmp = ((1.0d0 / (t_2 + sqrt(x))) + t_1) + (t_4 - sqrt(z))
    else
        tmp = (t_1 + t_3) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_4 + 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 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
	double t_2 = Math.sqrt((1.0 + x));
	double t_3 = t_2 - Math.sqrt(x);
	double t_4 = Math.sqrt((1.0 + z));
	double tmp;
	if (t_3 <= 0.999999999998) {
		tmp = ((1.0 / (t_2 + Math.sqrt(x))) + t_1) + (t_4 - Math.sqrt(z));
	} else {
		tmp = (t_1 + t_3) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_4 + Math.sqrt(z))));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))
	t_2 = math.sqrt((1.0 + x))
	t_3 = t_2 - math.sqrt(x)
	t_4 = math.sqrt((1.0 + z))
	tmp = 0
	if t_3 <= 0.999999999998:
		tmp = ((1.0 / (t_2 + math.sqrt(x))) + t_1) + (t_4 - math.sqrt(z))
	else:
		tmp = (t_1 + t_3) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_4 + math.sqrt(z))))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))
	t_2 = sqrt(Float64(1.0 + x))
	t_3 = Float64(t_2 - sqrt(x))
	t_4 = sqrt(Float64(1.0 + z))
	tmp = 0.0
	if (t_3 <= 0.999999999998)
		tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + t_1) + Float64(t_4 - sqrt(z)));
	else
		tmp = Float64(Float64(t_1 + t_3) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_4 + 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 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
	t_2 = sqrt((1.0 + x));
	t_3 = t_2 - sqrt(x);
	t_4 = sqrt((1.0 + z));
	tmp = 0.0;
	if (t_3 <= 0.999999999998)
		tmp = ((1.0 / (t_2 + sqrt(x))) + t_1) + (t_4 - sqrt(z));
	else
		tmp = (t_1 + t_3) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_4 + 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[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.999999999998], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + t$95$3), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
t_2 := \sqrt{1 + x}\\
t_3 := t_2 - \sqrt{x}\\
t_4 := \sqrt{1 + z}\\
\mathbf{if}\;t_3 \leq 0.999999999998:\\
\;\;\;\;\left(\frac{1}{t_2 + \sqrt{x}} + t_1\right) + \left(t_4 - \sqrt{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t_1 + t_3\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t_4 + \sqrt{z}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.99999999999800004

    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. associate-+l+88.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-48.6%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-88.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) \]
      4. sub-neg88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.99999999999800004 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x))

    1. Initial program 97.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+97.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-97.5%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-97.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) \]
      4. sub-neg97.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{1 + x} - \sqrt{x} \leq 0.999999999998:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\sqrt{1 + x} - \sqrt{x}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\ \end{array} \]

Alternative 2: 98.4% accurate, 0.6× 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} - \sqrt{z}\\ t_3 := \sqrt{1 + x}\\ t_4 := \left(t_3 - \sqrt{x}\right) + \left(t_1 - \sqrt{y}\right)\\ \mathbf{if}\;t_2 + t_4 \leq 2.1:\\ \;\;\;\;\left(\frac{1}{t_3 + \sqrt{x}} + \frac{1}{t_1 + \sqrt{y}}\right) + t_2\\ \mathbf{else}:\\ \;\;\;\;t_4 + \left(t_2 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\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)) (sqrt z)))
        (t_3 (sqrt (+ 1.0 x)))
        (t_4 (+ (- t_3 (sqrt x)) (- t_1 (sqrt y)))))
   (if (<= (+ t_2 t_4) 2.1)
     (+ (+ (/ 1.0 (+ t_3 (sqrt x))) (/ 1.0 (+ t_1 (sqrt y)))) t_2)
     (+ t_4 (+ t_2 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))))))
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)) - sqrt(z);
	double t_3 = sqrt((1.0 + x));
	double t_4 = (t_3 - sqrt(x)) + (t_1 - sqrt(y));
	double tmp;
	if ((t_2 + t_4) <= 2.1) {
		tmp = ((1.0 / (t_3 + sqrt(x))) + (1.0 / (t_1 + sqrt(y)))) + t_2;
	} else {
		tmp = t_4 + (t_2 + (1.0 / (sqrt((1.0 + t)) + sqrt(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) :: tmp
    t_1 = sqrt((1.0d0 + y))
    t_2 = sqrt((1.0d0 + z)) - sqrt(z)
    t_3 = sqrt((1.0d0 + x))
    t_4 = (t_3 - sqrt(x)) + (t_1 - sqrt(y))
    if ((t_2 + t_4) <= 2.1d0) then
        tmp = ((1.0d0 / (t_3 + sqrt(x))) + (1.0d0 / (t_1 + sqrt(y)))) + t_2
    else
        tmp = t_4 + (t_2 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(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 + y));
	double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
	double t_3 = Math.sqrt((1.0 + x));
	double t_4 = (t_3 - Math.sqrt(x)) + (t_1 - Math.sqrt(y));
	double tmp;
	if ((t_2 + t_4) <= 2.1) {
		tmp = ((1.0 / (t_3 + Math.sqrt(x))) + (1.0 / (t_1 + Math.sqrt(y)))) + t_2;
	} else {
		tmp = t_4 + (t_2 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
	}
	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)) - math.sqrt(z)
	t_3 = math.sqrt((1.0 + x))
	t_4 = (t_3 - math.sqrt(x)) + (t_1 - math.sqrt(y))
	tmp = 0
	if (t_2 + t_4) <= 2.1:
		tmp = ((1.0 / (t_3 + math.sqrt(x))) + (1.0 / (t_1 + math.sqrt(y)))) + t_2
	else:
		tmp = t_4 + (t_2 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))))
	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 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z))
	t_3 = sqrt(Float64(1.0 + x))
	t_4 = Float64(Float64(t_3 - sqrt(x)) + Float64(t_1 - sqrt(y)))
	tmp = 0.0
	if (Float64(t_2 + t_4) <= 2.1)
		tmp = Float64(Float64(Float64(1.0 / Float64(t_3 + sqrt(x))) + Float64(1.0 / Float64(t_1 + sqrt(y)))) + t_2);
	else
		tmp = Float64(t_4 + Float64(t_2 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(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 + y));
	t_2 = sqrt((1.0 + z)) - sqrt(z);
	t_3 = sqrt((1.0 + x));
	t_4 = (t_3 - sqrt(x)) + (t_1 - sqrt(y));
	tmp = 0.0;
	if ((t_2 + t_4) <= 2.1)
		tmp = ((1.0 / (t_3 + sqrt(x))) + (1.0 / (t_1 + sqrt(y)))) + t_2;
	else
		tmp = t_4 + (t_2 + (1.0 / (sqrt((1.0 + t)) + sqrt(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 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 + t$95$4), $MachinePrecision], 2.1], N[(N[(N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(t$95$4 + N[(t$95$2 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $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} - \sqrt{z}\\
t_3 := \sqrt{1 + x}\\
t_4 := \left(t_3 - \sqrt{x}\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{if}\;t_2 + t_4 \leq 2.1:\\
\;\;\;\;\left(\frac{1}{t_3 + \sqrt{x}} + \frac{1}{t_1 + \sqrt{y}}\right) + t_2\\

\mathbf{else}:\\
\;\;\;\;t_4 + \left(t_2 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\


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

    1. Initial program 91.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+91.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-67.2%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-91.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) \]
      4. sub-neg91.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.10000000000000009 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)))

    1. Initial program 99.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+99.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-99.1%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-99.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) \]
      4. sub-neg99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) \leq 2.1:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\ \end{array} \]

Alternative 3: 99.2% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + x}\\ t_2 := \sqrt{1 + z}\\ t_3 := \sqrt{1 + y}\\ t_4 := \left(t_1 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\\ \mathbf{if}\;t_4 \leq 1.2:\\ \;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + \left(t_2 - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t_2 + \sqrt{z}}\right) + t_4\\ \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 x)))
        (t_2 (sqrt (+ 1.0 z)))
        (t_3 (sqrt (+ 1.0 y)))
        (t_4 (+ (- t_1 (sqrt x)) (- t_3 (sqrt y)))))
   (if (<= t_4 1.2)
     (+ (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y)))) (- t_2 (sqrt z)))
     (+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_2 (sqrt z)))) t_4))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + x));
	double t_2 = sqrt((1.0 + z));
	double t_3 = sqrt((1.0 + y));
	double t_4 = (t_1 - sqrt(x)) + (t_3 - sqrt(y));
	double tmp;
	if (t_4 <= 1.2) {
		tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (t_2 - sqrt(z));
	} else {
		tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_2 + sqrt(z)))) + t_4;
	}
	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) :: tmp
    t_1 = sqrt((1.0d0 + x))
    t_2 = sqrt((1.0d0 + z))
    t_3 = sqrt((1.0d0 + y))
    t_4 = (t_1 - sqrt(x)) + (t_3 - sqrt(y))
    if (t_4 <= 1.2d0) then
        tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + (t_2 - sqrt(z))
    else
        tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_2 + sqrt(z)))) + t_4
    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 + x));
	double t_2 = Math.sqrt((1.0 + z));
	double t_3 = Math.sqrt((1.0 + y));
	double t_4 = (t_1 - Math.sqrt(x)) + (t_3 - Math.sqrt(y));
	double tmp;
	if (t_4 <= 1.2) {
		tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + (t_2 - Math.sqrt(z));
	} else {
		tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_2 + Math.sqrt(z)))) + t_4;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + x))
	t_2 = math.sqrt((1.0 + z))
	t_3 = math.sqrt((1.0 + y))
	t_4 = (t_1 - math.sqrt(x)) + (t_3 - math.sqrt(y))
	tmp = 0
	if t_4 <= 1.2:
		tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + (t_2 - math.sqrt(z))
	else:
		tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_2 + math.sqrt(z)))) + t_4
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + x))
	t_2 = sqrt(Float64(1.0 + z))
	t_3 = sqrt(Float64(1.0 + y))
	t_4 = Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 - sqrt(y)))
	tmp = 0.0
	if (t_4 <= 1.2)
		tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + Float64(t_2 - sqrt(z)));
	else
		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_2 + sqrt(z)))) + t_4);
	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 + x));
	t_2 = sqrt((1.0 + z));
	t_3 = sqrt((1.0 + y));
	t_4 = (t_1 - sqrt(x)) + (t_3 - sqrt(y));
	tmp = 0.0;
	if (t_4 <= 1.2)
		tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (t_2 - sqrt(z));
	else
		tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_2 + sqrt(z)))) + t_4;
	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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 1.2], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + y}\\
t_4 := \left(t_1 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\\
\mathbf{if}\;t_4 \leq 1.2:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + \left(t_2 - \sqrt{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t_2 + \sqrt{z}}\right) + t_4\\


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

    1. Initial program 90.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+90.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-61.2%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-90.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) \]
      4. sub-neg90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.19999999999999996 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)))

    1. Initial program 98.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+98.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-98.1%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-98.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) \]
      4. sub-neg98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right) \leq 1.2:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]

Alternative 4: 98.3% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + x}\\ t_2 := \sqrt{1 + z} - \sqrt{z}\\ t_3 := \sqrt{1 + y}\\ \mathbf{if}\;t_2 \leq 0.9999996:\\ \;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + t_2\\ \mathbf{else}:\\ \;\;\;\;\left(\left(t_1 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\right) + \left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(\left(1 + z \cdot 0.5\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 x)))
        (t_2 (- (sqrt (+ 1.0 z)) (sqrt z)))
        (t_3 (sqrt (+ 1.0 y))))
   (if (<= t_2 0.9999996)
     (+ (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y)))) t_2)
     (+
      (+ (- t_1 (sqrt x)) (- t_3 (sqrt y)))
      (+
       (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))
       (- (+ 1.0 (* z 0.5)) (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 + x));
	double t_2 = sqrt((1.0 + z)) - sqrt(z);
	double t_3 = sqrt((1.0 + y));
	double tmp;
	if (t_2 <= 0.9999996) {
		tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + t_2;
	} else {
		tmp = ((t_1 - sqrt(x)) + (t_3 - sqrt(y))) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((1.0 + (z * 0.5)) - 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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + x))
    t_2 = sqrt((1.0d0 + z)) - sqrt(z)
    t_3 = sqrt((1.0d0 + y))
    if (t_2 <= 0.9999996d0) then
        tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + t_2
    else
        tmp = ((t_1 - sqrt(x)) + (t_3 - sqrt(y))) + ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + ((1.0d0 + (z * 0.5d0)) - 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 + x));
	double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
	double t_3 = Math.sqrt((1.0 + y));
	double tmp;
	if (t_2 <= 0.9999996) {
		tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + t_2;
	} else {
		tmp = ((t_1 - Math.sqrt(x)) + (t_3 - Math.sqrt(y))) + ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + ((1.0 + (z * 0.5)) - 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 + x))
	t_2 = math.sqrt((1.0 + z)) - math.sqrt(z)
	t_3 = math.sqrt((1.0 + y))
	tmp = 0
	if t_2 <= 0.9999996:
		tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + t_2
	else:
		tmp = ((t_1 - math.sqrt(x)) + (t_3 - math.sqrt(y))) + ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + ((1.0 + (z * 0.5)) - 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 + x))
	t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z))
	t_3 = sqrt(Float64(1.0 + y))
	tmp = 0.0
	if (t_2 <= 0.9999996)
		tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + t_2);
	else
		tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 - sqrt(y))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(Float64(1.0 + Float64(z * 0.5)) - 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 + x));
	t_2 = sqrt((1.0 + z)) - sqrt(z);
	t_3 = sqrt((1.0 + y));
	tmp = 0.0;
	if (t_2 <= 0.9999996)
		tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + t_2;
	else
		tmp = ((t_1 - sqrt(x)) + (t_3 - sqrt(y))) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((1.0 + (z * 0.5)) - 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 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.9999996], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(z * 0.5), $MachinePrecision]), $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 + x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;t_2 \leq 0.9999996:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.99999959999999999

    1. Initial program 87.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. associate-+l+87.9%

        \[\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-65.5%

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

        \[\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) \]
      4. sub-neg87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.99999959999999999 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))

    1. Initial program 98.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+98.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-77.6%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-98.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) \]
      4. sub-neg98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \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
 (+
  (+
   (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
   (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
  (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
}
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 = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)))
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
Derivation
  1. Initial program 92.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+92.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-70.6%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    3. associate-+l-92.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) \]
    4. sub-neg92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 97.9% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 29000000000000:\\ \;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\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 (<= t 29000000000000.0)
   (+ 2.0 (+ (sqrt (+ 1.0 t)) (- 1.0 (sqrt t))))
   (+
    (+
     (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
     (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
    (- (sqrt (+ 1.0 z)) (sqrt z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 29000000000000.0) {
		tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
	} else {
		tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - 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) :: tmp
    if (t <= 29000000000000.0d0) then
        tmp = 2.0d0 + (sqrt((1.0d0 + t)) + (1.0d0 - sqrt(t)))
    else
        tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + (sqrt((1.0d0 + z)) - 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 tmp;
	if (t <= 29000000000000.0) {
		tmp = 2.0 + (Math.sqrt((1.0 + t)) + (1.0 - Math.sqrt(t)));
	} else {
		tmp = ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if t <= 29000000000000.0:
		tmp = 2.0 + (math.sqrt((1.0 + t)) + (1.0 - math.sqrt(t)))
	else:
		tmp = ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (math.sqrt((1.0 + z)) - math.sqrt(z))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (t <= 29000000000000.0)
		tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(1.0 - sqrt(t))));
	else
		tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)));
	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 (t <= 29000000000000.0)
		tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
	else
		tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - 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_] := If[LessEqual[t, 29000000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 29000000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\

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


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

    1. Initial program 96.8%

      \[\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. Simplified19.4%

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

      \[\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} + \sqrt{z}\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+35.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 + \left(\sqrt{1 + t} + \sqrt{1 + z}\right)\right) - \left(\sqrt{t} + \sqrt{z}\right)} \]
    7. Step-by-step derivation
      1. associate--l+46.8%

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

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

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

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

    if 2.9e13 < t

    1. Initial program 87.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+87.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-65.8%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-87.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) \]
      4. sub-neg87.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 29000000000000:\\ \;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \end{array} \]

Alternative 7: 96.0% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq 29000000000000:\\ \;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \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
 (if (<= t 29000000000000.0)
   (+ 2.0 (+ (sqrt (+ 1.0 t)) (- 1.0 (sqrt t))))
   (+
    (- (sqrt (+ 1.0 z)) (sqrt z))
    (+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (- (sqrt (+ 1.0 y)) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 29000000000000.0) {
		tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
	} else {
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (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) :: tmp
    if (t <= 29000000000000.0d0) then
        tmp = 2.0d0 + (sqrt((1.0d0 + t)) + (1.0d0 - sqrt(t)))
    else
        tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (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 tmp;
	if (t <= 29000000000000.0) {
		tmp = 2.0 + (Math.sqrt((1.0 + t)) + (1.0 - Math.sqrt(t)));
	} else {
		tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (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):
	tmp = 0
	if t <= 29000000000000.0:
		tmp = 2.0 + (math.sqrt((1.0 + t)) + (1.0 - math.sqrt(t)))
	else:
		tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (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)
	tmp = 0.0
	if (t <= 29000000000000.0)
		tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(1.0 - sqrt(t))));
	else
		tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + 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)
	tmp = 0.0;
	if (t <= 29000000000000.0)
		tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
	else
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (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_] := If[LessEqual[t, 29000000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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}
\mathbf{if}\;t \leq 29000000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\

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


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

    1. Initial program 96.8%

      \[\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. Simplified19.4%

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

      \[\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} + \sqrt{z}\right)\right)} \]
    4. Step-by-step derivation
      1. associate--l+35.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 + \left(\sqrt{1 + t} + \sqrt{1 + z}\right)\right) - \left(\sqrt{t} + \sqrt{z}\right)} \]
    7. Step-by-step derivation
      1. associate--l+46.8%

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

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

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

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

    if 2.9e13 < t

    1. Initial program 87.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+87.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-65.8%

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      3. associate-+l-87.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) \]
      4. sub-neg87.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 29000000000000:\\ \;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \end{array} \]

Alternative 8: 90.6% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 4.7 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{1 + y} + \left(\left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \sqrt{z}\right)\right)\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_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
 (let* ((t_1 (sqrt (+ 1.0 x))))
   (if (<= y 4.7e+17)
     (+
      (sqrt (+ 1.0 y))
      (- (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (sqrt z)))) (sqrt y)))
     (/ 1.0 (+ t_1 (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + x));
	double tmp;
	if (y <= 4.7e+17) {
		tmp = sqrt((1.0 + y)) + ((t_1 + (sqrt((1.0 + z)) - (sqrt(x) + sqrt(z)))) - sqrt(y));
	} else {
		tmp = 1.0 / (t_1 + 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) :: tmp
    t_1 = sqrt((1.0d0 + x))
    if (y <= 4.7d+17) then
        tmp = sqrt((1.0d0 + y)) + ((t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + sqrt(z)))) - sqrt(y))
    else
        tmp = 1.0d0 / (t_1 + 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 = Math.sqrt((1.0 + x));
	double tmp;
	if (y <= 4.7e+17) {
		tmp = Math.sqrt((1.0 + y)) + ((t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + Math.sqrt(z)))) - Math.sqrt(y));
	} else {
		tmp = 1.0 / (t_1 + Math.sqrt(x));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + x))
	tmp = 0
	if y <= 4.7e+17:
		tmp = math.sqrt((1.0 + y)) + ((t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + math.sqrt(z)))) - math.sqrt(y))
	else:
		tmp = 1.0 / (t_1 + math.sqrt(x))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + x))
	tmp = 0.0
	if (y <= 4.7e+17)
		tmp = Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + sqrt(z)))) - sqrt(y)));
	else
		tmp = Float64(1.0 / Float64(t_1 + 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 = sqrt((1.0 + x));
	tmp = 0.0;
	if (y <= 4.7e+17)
		tmp = sqrt((1.0 + y)) + ((t_1 + (sqrt((1.0 + z)) - (sqrt(x) + sqrt(z)))) - sqrt(y));
	else
		tmp = 1.0 / (t_1 + 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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.7e+17], N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 4.7 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{1 + y} + \left(\left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \sqrt{z}\right)\right)\right) - \sqrt{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\


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

    1. Initial program 96.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. Simplified37.1%

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

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

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

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

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

    if 4.7e17 < y

    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. Simplified3.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 3.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.4%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    8. Step-by-step derivation
      1. flip--22.4%

        \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. div-inv22.4%

        \[\leadsto \color{blue}{\left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
      3. add-sqr-sqrt22.6%

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

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

      \[\leadsto \color{blue}{\left(\left(1 + x\right) - x\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. associate-*r/22.8%

        \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot 1}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. *-rgt-identity22.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right) - x}}{\sqrt{1 + x} + \sqrt{x}} \]
      3. associate--l+26.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\sqrt{1 + x} + \sqrt{x}} \]
      4. +-inverses26.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} \]
      5. metadata-eval26.6%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} \]
      6. +-commutative26.6%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}} \]
    11. Simplified26.6%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{+17}:\\ \;\;\;\;\sqrt{1 + y} + \left(\left(\sqrt{1 + x} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \sqrt{z}\right)\right)\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\ \end{array} \]

Alternative 9: 90.0% accurate, 2.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;y \leq 8.6 \cdot 10^{-24}:\\ \;\;\;\;1 + \left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+17}:\\ \;\;\;\;\left(1 + x \cdot 0.5\right) + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \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
 (let* ((t_1 (sqrt (+ 1.0 y))))
   (if (<= y 8.6e-24)
     (+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (sqrt z)))))
     (if (<= y 3.2e+17)
       (+ (+ 1.0 (* x 0.5)) (- t_1 (+ (sqrt x) (sqrt y))))
       (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))))
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 (y <= 8.6e-24) {
		tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
	} else if (y <= 3.2e+17) {
		tmp = (1.0 + (x * 0.5)) + (t_1 - (sqrt(x) + sqrt(y)));
	} else {
		tmp = 1.0 / (sqrt((1.0 + x)) + 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) :: tmp
    t_1 = sqrt((1.0d0 + y))
    if (y <= 8.6d-24) then
        tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(y) + sqrt(z))))
    else if (y <= 3.2d+17) then
        tmp = (1.0d0 + (x * 0.5d0)) + (t_1 - (sqrt(x) + sqrt(y)))
    else
        tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 = Math.sqrt((1.0 + y));
	double tmp;
	if (y <= 8.6e-24) {
		tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + Math.sqrt(z))));
	} else if (y <= 3.2e+17) {
		tmp = (1.0 + (x * 0.5)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
	} else {
		tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
	}
	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 y <= 8.6e-24:
		tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + math.sqrt(z))))
	elif y <= 3.2e+17:
		tmp = (1.0 + (x * 0.5)) + (t_1 - (math.sqrt(x) + math.sqrt(y)))
	else:
		tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))
	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 (y <= 8.6e-24)
		tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + sqrt(z)))));
	elseif (y <= 3.2e+17)
		tmp = Float64(Float64(1.0 + Float64(x * 0.5)) + Float64(t_1 - Float64(sqrt(x) + sqrt(y))));
	else
		tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 = sqrt((1.0 + y));
	tmp = 0.0;
	if (y <= 8.6e-24)
		tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
	elseif (y <= 3.2e+17)
		tmp = (1.0 + (x * 0.5)) + (t_1 - (sqrt(x) + sqrt(y)));
	else
		tmp = 1.0 / (sqrt((1.0 + x)) + 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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 8.6e-24], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+17], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $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}\;y \leq 8.6 \cdot 10^{-24}:\\
\;\;\;\;1 + \left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\

\mathbf{elif}\;y \leq 3.2 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 8.6000000000000006e-24

    1. Initial program 97.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. Simplified38.1%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.2%

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

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

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

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

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

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

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

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

    if 8.6000000000000006e-24 < y < 3.2e17

    1. Initial program 92.8%

      \[\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. Simplified29.4%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 15.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.3%

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

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

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

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

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

        \[\leadsto \left(1 + \color{blue}{x \cdot 0.5}\right) - \sqrt{x} \]
    9. Simplified12.3%

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

    if 3.2e17 < y

    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. Simplified3.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 3.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.4%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    8. Step-by-step derivation
      1. flip--22.4%

        \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. div-inv22.4%

        \[\leadsto \color{blue}{\left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
      3. add-sqr-sqrt22.6%

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

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

      \[\leadsto \color{blue}{\left(\left(1 + x\right) - x\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. associate-*r/22.8%

        \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot 1}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. *-rgt-identity22.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right) - x}}{\sqrt{1 + x} + \sqrt{x}} \]
      3. associate--l+26.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\sqrt{1 + x} + \sqrt{x}} \]
      4. +-inverses26.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} \]
      5. metadata-eval26.6%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} \]
      6. +-commutative26.6%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}} \]
    11. Simplified26.6%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification40.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8.6 \cdot 10^{-24}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+17}:\\ \;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\ \end{array} \]

Alternative 10: 90.0% accurate, 2.6× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.04 \cdot 10^{-22}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+17}:\\ \;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \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 1.04e-22)
   (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
   (if (<= y 3.5e+17)
     (+ (+ 1.0 (* x 0.5)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
     (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 1.04e-22) {
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
	} else if (y <= 3.5e+17) {
		tmp = (1.0 + (x * 0.5)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
	} else {
		tmp = 1.0 / (sqrt((1.0 + x)) + 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 <= 1.04d-22) then
        tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
    else if (y <= 3.5d+17) then
        tmp = (1.0d0 + (x * 0.5d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
    else
        tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 <= 1.04e-22) {
		tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
	} else if (y <= 3.5e+17) {
		tmp = (1.0 + (x * 0.5)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
	} else {
		tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= 1.04e-22:
		tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0
	elif y <= 3.5e+17:
		tmp = (1.0 + (x * 0.5)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))
	else:
		tmp = 1.0 / (math.sqrt((1.0 + x)) + 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 <= 1.04e-22)
		tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0);
	elseif (y <= 3.5e+17)
		tmp = Float64(Float64(1.0 + Float64(x * 0.5)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))));
	else
		tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 <= 1.04e-22)
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
	elseif (y <= 3.5e+17)
		tmp = (1.0 + (x * 0.5)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
	else
		tmp = 1.0 / (sqrt((1.0 + x)) + 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, 1.04e-22], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 3.5e+17], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.04 \cdot 10^{-22}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.04e-22

    1. Initial program 97.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. Simplified37.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 15.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(2 + \sqrt{1 + z}\right) - \sqrt{z}} \]
    8. Step-by-step derivation
      1. associate--l+57.3%

        \[\leadsto \color{blue}{2 + \left(\sqrt{1 + z} - \sqrt{z}\right)} \]
    9. Simplified57.3%

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

    if 1.04e-22 < y < 3.5e17

    1. Initial program 92.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. Simplified30.2%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 16.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.5%

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot x\right)} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right) \]
    8. Step-by-step derivation
      1. *-commutative11.2%

        \[\leadsto \left(1 + \color{blue}{x \cdot 0.5}\right) - \sqrt{x} \]
    9. Simplified11.8%

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

    if 3.5e17 < y

    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. Simplified3.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 3.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.4%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    8. Step-by-step derivation
      1. flip--22.4%

        \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. div-inv22.4%

        \[\leadsto \color{blue}{\left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
      3. add-sqr-sqrt22.6%

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

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

      \[\leadsto \color{blue}{\left(\left(1 + x\right) - x\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. associate-*r/22.8%

        \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot 1}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. *-rgt-identity22.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right) - x}}{\sqrt{1 + x} + \sqrt{x}} \]
      3. associate--l+26.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\sqrt{1 + x} + \sqrt{x}} \]
      4. +-inverses26.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} \]
      5. metadata-eval26.6%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} \]
      6. +-commutative26.6%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}} \]
    11. Simplified26.6%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification40.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.04 \cdot 10^{-22}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+17}:\\ \;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\ \end{array} \]

Alternative 11: 89.8% accurate, 3.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.05 \cdot 10^{-22}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+17}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \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 2.05e-22)
   (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
   (if (<= y 4e+17)
     (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
     (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= 2.05e-22) {
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
	} else if (y <= 4e+17) {
		tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
	} else {
		tmp = 1.0 / (sqrt((1.0 + x)) + 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 <= 2.05d-22) then
        tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
    else if (y <= 4d+17) then
        tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
    else
        tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 <= 2.05e-22) {
		tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
	} else if (y <= 4e+17) {
		tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
	} else {
		tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= 2.05e-22:
		tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0
	elif y <= 4e+17:
		tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
	else:
		tmp = 1.0 / (math.sqrt((1.0 + x)) + 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 <= 2.05e-22)
		tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0);
	elseif (y <= 4e+17)
		tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)));
	else
		tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 <= 2.05e-22)
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
	elseif (y <= 4e+17)
		tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
	else
		tmp = 1.0 / (sqrt((1.0 + x)) + 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, 2.05e-22], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 4e+17], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.05 \cdot 10^{-22}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\

\mathbf{elif}\;y \leq 4 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 2.05e-22

    1. Initial program 97.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. Simplified37.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 15.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.2%

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

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

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

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

      \[\leadsto \color{blue}{\left(2 + \sqrt{1 + z}\right) - \sqrt{z}} \]
    8. Step-by-step derivation
      1. associate--l+57.3%

        \[\leadsto \color{blue}{2 + \left(\sqrt{1 + z} - \sqrt{z}\right)} \]
    9. Simplified57.3%

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

    if 2.05e-22 < y < 4e17

    1. Initial program 92.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. Simplified30.2%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 16.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.5%

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

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

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

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

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

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

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

    if 4e17 < y

    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. Simplified3.9%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 3.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.4%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    8. Step-by-step derivation
      1. flip--22.4%

        \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. div-inv22.4%

        \[\leadsto \color{blue}{\left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
      3. add-sqr-sqrt22.6%

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

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

      \[\leadsto \color{blue}{\left(\left(1 + x\right) - x\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
    10. Step-by-step derivation
      1. associate-*r/22.8%

        \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot 1}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. *-rgt-identity22.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right) - x}}{\sqrt{1 + x} + \sqrt{x}} \]
      3. associate--l+26.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\sqrt{1 + x} + \sqrt{x}} \]
      4. +-inverses26.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} \]
      5. metadata-eval26.6%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} \]
      6. +-commutative26.6%

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}} \]
    11. Simplified26.6%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.05 \cdot 10^{-22}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+17}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\ \end{array} \]

Alternative 12: 84.5% accurate, 3.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 1.2 \cdot 10^{+15}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \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
 (if (<= z 1.2e+15)
   (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
   (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 1.2e+15) {
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
	} else {
		tmp = 1.0 + (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) :: tmp
    if (z <= 1.2d+15) then
        tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
    else
        tmp = 1.0d0 + (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 tmp;
	if (z <= 1.2e+15) {
		tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
	} else {
		tmp = 1.0 + (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):
	tmp = 0
	if z <= 1.2e+15:
		tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0
	else:
		tmp = 1.0 + (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)
	tmp = 0.0
	if (z <= 1.2e+15)
		tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0);
	else
		tmp = Float64(1.0 + 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)
	tmp = 0.0;
	if (z <= 1.2e+15)
		tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
	else
		tmp = 1.0 + (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_] := If[LessEqual[z, 1.2e+15], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{+15}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\

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


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

    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. Simplified30.5%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 16.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.5%

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

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

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

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

      \[\leadsto \color{blue}{\left(2 + \sqrt{1 + z}\right) - \sqrt{z}} \]
    8. Step-by-step derivation
      1. associate--l+43.9%

        \[\leadsto \color{blue}{2 + \left(\sqrt{1 + z} - \sqrt{z}\right)} \]
    9. Simplified43.9%

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

    if 1.2e15 < z

    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. Simplified15.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
    3. Taylor expanded in t around inf 4.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)} \]
    4. Step-by-step derivation
      1. associate--l+20.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. +-commutative20.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.2 \cdot 10^{+15}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]

Alternative 13: 64.5% accurate, 4.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 + \left(\sqrt{1 + y} - \sqrt{y}\right) \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 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0 + (sqrt((1.0 + y)) - 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 = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 + (sqrt((1.0 + y)) - 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[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Derivation
  1. Initial program 92.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. Simplified22.4%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
  3. Taylor expanded in t around inf 10.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)} \]
  4. Step-by-step derivation
    1. associate--l+20.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. +-commutative20.3%

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

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

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

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

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

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

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

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

Alternative 14: 35.3% accurate, 4.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \sqrt{1 + x} - \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 (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return sqrt((1.0 + x)) - 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((1.0d0 + x)) - 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((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(sqrt(Float64(1.0 + x)) - sqrt(x))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = sqrt((1.0 + x)) - 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[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Derivation
  1. Initial program 92.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. Simplified22.4%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
  3. Taylor expanded in t around inf 10.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)} \]
  4. Step-by-step derivation
    1. associate--l+20.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. +-commutative20.3%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
  8. Final simplification15.5%

    \[\leadsto \sqrt{1 + x} - \sqrt{x} \]

Alternative 15: 34.6% accurate, 7.7× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \left(1 + x \cdot 0.5\right) - \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 (- (+ 1.0 (* x 0.5)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return (1.0 + (x * 0.5)) - 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 = (1.0d0 + (x * 0.5d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return (1.0 + (x * 0.5)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return (1.0 + (x * 0.5)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = (1.0 + (x * 0.5)) - 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[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 + x \cdot 0.5\right) - \sqrt{x}
\end{array}
Derivation
  1. Initial program 92.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. Simplified22.4%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
  3. Taylor expanded in t around inf 10.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)} \]
  4. Step-by-step derivation
    1. associate--l+20.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. +-commutative20.3%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
  8. Taylor expanded in x around 0 15.5%

    \[\leadsto \color{blue}{\left(1 + 0.5 \cdot x\right)} - \sqrt{x} \]
  9. Step-by-step derivation
    1. *-commutative15.5%

      \[\leadsto \left(1 + \color{blue}{x \cdot 0.5}\right) - \sqrt{x} \]
  10. Simplified15.5%

    \[\leadsto \color{blue}{\left(1 + x \cdot 0.5\right)} - \sqrt{x} \]
  11. Final simplification15.5%

    \[\leadsto \left(1 + x \cdot 0.5\right) - \sqrt{x} \]

Alternative 16: 34.0% accurate, 823.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 \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 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0;
}
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 = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return 1.0
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Derivation
  1. Initial program 92.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. Simplified22.4%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\left(\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right) - \sqrt{1 + z}\right)\right) - \sqrt{z}\right) - \sqrt{y}\right)} \]
  3. Taylor expanded in t around inf 10.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)} \]
  4. Step-by-step derivation
    1. associate--l+20.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. +-commutative20.3%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
  8. Taylor expanded in x around 0 32.5%

    \[\leadsto \color{blue}{1} \]
  9. Final simplification32.5%

    \[\leadsto 1 \]

Developer target: 99.5% 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 2023318 
(FPCore (x y z t)
  :name "Main:z from "
  :precision binary64

  :herbie-target
  (+ (+ (+ (/ 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))))