Main:z from

Percentage Accurate: 91.4% → 99.3%
Time: 29.7s
Alternatives: 19
Speedup: 2.0×

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 19 alternatives:

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

Initial Program: 91.4% 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.3% 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 := \sqrt{1 + z}\\ \mathbf{if}\;t_2 - \sqrt{x} \leq 0.2:\\ \;\;\;\;\left(t_3 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(t_1 + \frac{1 + \left(x - x\right)}{\sqrt{x} + t_2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_2 + \left(t_1 - \sqrt{x}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1 + \left(z - z\right)}{\sqrt{z} + t_3}\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 (sqrt (+ 1.0 z))))
   (if (<= (- t_2 (sqrt x)) 0.2)
     (+
      (- t_3 (sqrt z))
      (expm1 (log1p (+ t_1 (/ (+ 1.0 (- x x)) (+ (sqrt x) t_2))))))
     (+
      (+ t_2 (- t_1 (sqrt x)))
      (+
       (- (sqrt (+ 1.0 t)) (sqrt t))
       (/ (+ 1.0 (- z z)) (+ (sqrt z) t_3)))))))
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 = sqrt((1.0 + z));
	double tmp;
	if ((t_2 - sqrt(x)) <= 0.2) {
		tmp = (t_3 - sqrt(z)) + expm1(log1p((t_1 + ((1.0 + (x - x)) / (sqrt(x) + t_2)))));
	} else {
		tmp = (t_2 + (t_1 - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + ((1.0 + (z - z)) / (sqrt(z) + t_3)));
	}
	return tmp;
}
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 = Math.sqrt((1.0 + z));
	double tmp;
	if ((t_2 - Math.sqrt(x)) <= 0.2) {
		tmp = (t_3 - Math.sqrt(z)) + Math.expm1(Math.log1p((t_1 + ((1.0 + (x - x)) / (Math.sqrt(x) + t_2)))));
	} else {
		tmp = (t_2 + (t_1 - Math.sqrt(x))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + ((1.0 + (z - z)) / (Math.sqrt(z) + t_3)));
	}
	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 = math.sqrt((1.0 + z))
	tmp = 0
	if (t_2 - math.sqrt(x)) <= 0.2:
		tmp = (t_3 - math.sqrt(z)) + math.expm1(math.log1p((t_1 + ((1.0 + (x - x)) / (math.sqrt(x) + t_2)))))
	else:
		tmp = (t_2 + (t_1 - math.sqrt(x))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + ((1.0 + (z - z)) / (math.sqrt(z) + t_3)))
	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 = sqrt(Float64(1.0 + z))
	tmp = 0.0
	if (Float64(t_2 - sqrt(x)) <= 0.2)
		tmp = Float64(Float64(t_3 - sqrt(z)) + expm1(log1p(Float64(t_1 + Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_2))))));
	else
		tmp = Float64(Float64(t_2 + Float64(t_1 - sqrt(x))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(1.0 + Float64(z - z)) / Float64(sqrt(z) + t_3))));
	end
	return 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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.2], N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + N[(t$95$1 + N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(z - z), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $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 := \sqrt{1 + z}\\
\mathbf{if}\;t_2 - \sqrt{x} \leq 0.2:\\
\;\;\;\;\left(t_3 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(t_1 + \frac{1 + \left(x - x\right)}{\sqrt{x} + t_2}\right)\right)\\

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


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

    1. Initial program 88.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+88.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-47.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. +-commutative47.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    6. Step-by-step derivation
      1. flip--88.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt73.5%

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    11. Applied egg-rr92.6%

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1 + \left(y - y\right)}}{\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.5%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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.5%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    13. Simplified94.5%

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

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

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

    1. Initial program 98.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+98.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-98.0%

        \[\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. +-commutative98.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{1 + y} - \sqrt{y}\right)\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.4%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt79.5%

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\left(1 + y\right) - \color{blue}{y}}{\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-rr98.2%

      \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \color{blue}{\frac{\left(1 + y\right) - y}{\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+97.7%

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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-eval97.7%

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

      \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \color{blue}{\frac{1}{\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--98.9%

        \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \frac{1}{\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.1%

        \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \frac{1}{\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. +-commutative75.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 0.4× 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 + y}\\ t_3 := \sqrt{1 + z}\\ t_4 := \left(\left(t_2 - \sqrt{y}\right) - \left(\sqrt{x} - t_1\right)\right) - \left(\sqrt{z} - t_3\right)\\ \mathbf{if}\;t_4 \leq 0.2:\\ \;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\\ \mathbf{elif}\;t_4 \leq 2.05:\\ \;\;\;\;t_1 + \left(\frac{1}{t_2 + \sqrt{y}} + \left(\frac{z - \left(z + -1\right)}{\sqrt{z} + t_3} - \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(1 + t_2\right) - \sqrt{y}\right) + \left(\left(t_3 - \sqrt{z}\right) + \frac{\left(1 + t\right) - t}{\sqrt{t} + \sqrt{1 + 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 x)))
        (t_2 (sqrt (+ 1.0 y)))
        (t_3 (sqrt (+ 1.0 z)))
        (t_4 (- (- (- t_2 (sqrt y)) (- (sqrt x) t_1)) (- (sqrt z) t_3))))
   (if (<= t_4 0.2)
     (/ (+ 1.0 (- x x)) (+ (sqrt x) t_1))
     (if (<= t_4 2.05)
       (+
        t_1
        (+
         (/ 1.0 (+ t_2 (sqrt y)))
         (- (/ (- z (+ z -1.0)) (+ (sqrt z) t_3)) (sqrt x))))
       (+
        (- (+ 1.0 t_2) (sqrt y))
        (+
         (- t_3 (sqrt z))
         (/ (- (+ 1.0 t) t) (+ (sqrt t) (sqrt (+ 1.0 t))))))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + x));
	double t_2 = sqrt((1.0 + y));
	double t_3 = sqrt((1.0 + z));
	double t_4 = ((t_2 - sqrt(y)) - (sqrt(x) - t_1)) - (sqrt(z) - t_3);
	double tmp;
	if (t_4 <= 0.2) {
		tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
	} else if (t_4 <= 2.05) {
		tmp = t_1 + ((1.0 / (t_2 + sqrt(y))) + (((z - (z + -1.0)) / (sqrt(z) + t_3)) - sqrt(x)));
	} else {
		tmp = ((1.0 + t_2) - sqrt(y)) + ((t_3 - sqrt(z)) + (((1.0 + t) - t) / (sqrt(t) + sqrt((1.0 + t)))));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + x))
    t_2 = sqrt((1.0d0 + y))
    t_3 = sqrt((1.0d0 + z))
    t_4 = ((t_2 - sqrt(y)) - (sqrt(x) - t_1)) - (sqrt(z) - t_3)
    if (t_4 <= 0.2d0) then
        tmp = (1.0d0 + (x - x)) / (sqrt(x) + t_1)
    else if (t_4 <= 2.05d0) then
        tmp = t_1 + ((1.0d0 / (t_2 + sqrt(y))) + (((z - (z + (-1.0d0))) / (sqrt(z) + t_3)) - sqrt(x)))
    else
        tmp = ((1.0d0 + t_2) - sqrt(y)) + ((t_3 - sqrt(z)) + (((1.0d0 + t) - t) / (sqrt(t) + sqrt((1.0d0 + t)))))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 + x));
	double t_2 = Math.sqrt((1.0 + y));
	double t_3 = Math.sqrt((1.0 + z));
	double t_4 = ((t_2 - Math.sqrt(y)) - (Math.sqrt(x) - t_1)) - (Math.sqrt(z) - t_3);
	double tmp;
	if (t_4 <= 0.2) {
		tmp = (1.0 + (x - x)) / (Math.sqrt(x) + t_1);
	} else if (t_4 <= 2.05) {
		tmp = t_1 + ((1.0 / (t_2 + Math.sqrt(y))) + (((z - (z + -1.0)) / (Math.sqrt(z) + t_3)) - Math.sqrt(x)));
	} else {
		tmp = ((1.0 + t_2) - Math.sqrt(y)) + ((t_3 - Math.sqrt(z)) + (((1.0 + t) - t) / (Math.sqrt(t) + Math.sqrt((1.0 + t)))));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + x))
	t_2 = math.sqrt((1.0 + y))
	t_3 = math.sqrt((1.0 + z))
	t_4 = ((t_2 - math.sqrt(y)) - (math.sqrt(x) - t_1)) - (math.sqrt(z) - t_3)
	tmp = 0
	if t_4 <= 0.2:
		tmp = (1.0 + (x - x)) / (math.sqrt(x) + t_1)
	elif t_4 <= 2.05:
		tmp = t_1 + ((1.0 / (t_2 + math.sqrt(y))) + (((z - (z + -1.0)) / (math.sqrt(z) + t_3)) - math.sqrt(x)))
	else:
		tmp = ((1.0 + t_2) - math.sqrt(y)) + ((t_3 - math.sqrt(z)) + (((1.0 + t) - t) / (math.sqrt(t) + math.sqrt((1.0 + t)))))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + x))
	t_2 = sqrt(Float64(1.0 + y))
	t_3 = sqrt(Float64(1.0 + z))
	t_4 = Float64(Float64(Float64(t_2 - sqrt(y)) - Float64(sqrt(x) - t_1)) - Float64(sqrt(z) - t_3))
	tmp = 0.0
	if (t_4 <= 0.2)
		tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_1));
	elseif (t_4 <= 2.05)
		tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(Float64(Float64(z - Float64(z + -1.0)) / Float64(sqrt(z) + t_3)) - sqrt(x))));
	else
		tmp = Float64(Float64(Float64(1.0 + t_2) - sqrt(y)) + Float64(Float64(t_3 - sqrt(z)) + Float64(Float64(Float64(1.0 + t) - t) / Float64(sqrt(t) + sqrt(Float64(1.0 + t))))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((1.0 + x));
	t_2 = sqrt((1.0 + y));
	t_3 = sqrt((1.0 + z));
	t_4 = ((t_2 - sqrt(y)) - (sqrt(x) - t_1)) - (sqrt(z) - t_3);
	tmp = 0.0;
	if (t_4 <= 0.2)
		tmp = (1.0 + (x - x)) / (sqrt(x) + t_1);
	elseif (t_4 <= 2.05)
		tmp = t_1 + ((1.0 / (t_2 + sqrt(y))) + (((z - (z + -1.0)) / (sqrt(z) + t_3)) - sqrt(x)));
	else
		tmp = ((1.0 + t_2) - sqrt(y)) + ((t_3 - sqrt(z)) + (((1.0 + t) - t) / (sqrt(t) + sqrt((1.0 + t)))));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 0.2], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2.05], N[(t$95$1 + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z - N[(z + -1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t), $MachinePrecision] - t), $MachinePrecision] / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + z}\\
t_4 := \left(\left(t_2 - \sqrt{y}\right) - \left(\sqrt{x} - t_1\right)\right) - \left(\sqrt{z} - t_3\right)\\
\mathbf{if}\;t_4 \leq 0.2:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\\

\mathbf{elif}\;t_4 \leq 2.05:\\
\;\;\;\;t_1 + \left(\frac{1}{t_2 + \sqrt{y}} + \left(\frac{z - \left(z + -1\right)}{\sqrt{z} + t_3} - \sqrt{x}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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))) < 0.20000000000000001

    1. Initial program 56.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+56.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. +-commutative56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative58.5%

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\color{blue}{\sqrt{x} + \sqrt{x + 1}}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
      4. +-commutative67.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{\color{blue}{1 + x}}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    14. Simplified19.8%

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

    if 0.20000000000000001 < (+.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.0499999999999998

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative30.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt77.5%

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr32.0%

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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-eval98.3%

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

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

    if 2.0499999999999998 < (+.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.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+99.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-99.9%

        \[\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. +-commutative99.9%

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

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

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

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

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

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

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

        \[\leadsto \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\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-sqrt68.0%

        \[\leadsto \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\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. +-commutative68.0%

        \[\leadsto \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\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-sqrt92.5%

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

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

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

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

Alternative 3: 98.4% 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}\\ \mathbf{if}\;\left(t_3 - \sqrt{y}\right) - \left(\sqrt{x} - t_1\right) \leq 1.999985:\\ \;\;\;\;\left(t_2 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t_3 + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 - \left(\sqrt{x} + \left(\sqrt{y} - t_3\right)\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{\sqrt{z} + t_2}\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))) (t_3 (sqrt (+ 1.0 y))))
   (if (<= (- (- t_3 (sqrt y)) (- (sqrt x) t_1)) 1.999985)
     (+
      (- t_2 (sqrt z))
      (expm1
       (log1p
        (+ (/ 1.0 (+ t_3 (sqrt y))) (/ (+ 1.0 (- x x)) (+ (sqrt x) t_1))))))
     (+
      (- t_1 (+ (sqrt x) (- (sqrt y) t_3)))
      (+
       (- (sqrt (+ 1.0 t)) (sqrt t))
       (/ (- (+ 1.0 z) z) (+ (sqrt z) t_2)))))))
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 tmp;
	if (((t_3 - sqrt(y)) - (sqrt(x) - t_1)) <= 1.999985) {
		tmp = (t_2 - sqrt(z)) + expm1(log1p(((1.0 / (t_3 + sqrt(y))) + ((1.0 + (x - x)) / (sqrt(x) + t_1)))));
	} else {
		tmp = (t_1 - (sqrt(x) + (sqrt(y) - t_3))) + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt(z) + t_2)));
	}
	return tmp;
}
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 tmp;
	if (((t_3 - Math.sqrt(y)) - (Math.sqrt(x) - t_1)) <= 1.999985) {
		tmp = (t_2 - Math.sqrt(z)) + Math.expm1(Math.log1p(((1.0 / (t_3 + Math.sqrt(y))) + ((1.0 + (x - x)) / (Math.sqrt(x) + t_1)))));
	} else {
		tmp = (t_1 - (Math.sqrt(x) + (Math.sqrt(y) - t_3))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (Math.sqrt(z) + t_2)));
	}
	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))
	tmp = 0
	if ((t_3 - math.sqrt(y)) - (math.sqrt(x) - t_1)) <= 1.999985:
		tmp = (t_2 - math.sqrt(z)) + math.expm1(math.log1p(((1.0 / (t_3 + math.sqrt(y))) + ((1.0 + (x - x)) / (math.sqrt(x) + t_1)))))
	else:
		tmp = (t_1 - (math.sqrt(x) + (math.sqrt(y) - t_3))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (math.sqrt(z) + t_2)))
	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))
	tmp = 0.0
	if (Float64(Float64(t_3 - sqrt(y)) - Float64(sqrt(x) - t_1)) <= 1.999985)
		tmp = Float64(Float64(t_2 - sqrt(z)) + expm1(log1p(Float64(Float64(1.0 / Float64(t_3 + sqrt(y))) + Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + t_1))))));
	else
		tmp = Float64(Float64(t_1 - Float64(sqrt(x) + Float64(sqrt(y) - t_3))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(sqrt(z) + t_2))));
	end
	return 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]}, If[LessEqual[N[(N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], 1.999985], N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $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}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;\left(t_3 - \sqrt{y}\right) - \left(\sqrt{x} - t_1\right) \leq 1.999985:\\
\;\;\;\;\left(t_2 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t_3 + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + t_1}\right)\right)\\

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


\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.9999849999999999

    1. Initial program 91.6%

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

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

        \[\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. +-commutative63.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    6. Step-by-step derivation
      1. flip--91.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt69.7%

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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-eval95.7%

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

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

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

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

    1. Initial program 98.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. Step-by-step derivation
      1. associate-+l+98.8%

        \[\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.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. +-commutative98.8%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{1 + y} - \sqrt{y}\right)\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.2%

        \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \frac{1}{\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-sqrt78.9%

        \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \frac{1}{\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. +-commutative78.9%

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

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

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

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

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

Alternative 4: 97.8% accurate, 0.7× 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{x} + \sqrt{1 + x}\\ \frac{\frac{t_1 + \left(\sqrt{y} + t_2\right)}{t_2}}{t_1 + \sqrt{y}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (+ (sqrt x) (sqrt (+ 1.0 x)))))
   (+
    (/ (/ (+ t_1 (+ (sqrt y) t_2)) t_2) (+ t_1 (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) {
	double t_1 = sqrt((1.0 + y));
	double t_2 = sqrt(x) + sqrt((1.0 + x));
	return (((t_1 + (sqrt(y) + t_2)) / t_2) / (t_1 + 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
    real(8) :: t_1
    real(8) :: t_2
    t_1 = sqrt((1.0d0 + y))
    t_2 = sqrt(x) + sqrt((1.0d0 + x))
    code = (((t_1 + (sqrt(y) + t_2)) / t_2) / (t_1 + 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) {
	double t_1 = Math.sqrt((1.0 + y));
	double t_2 = Math.sqrt(x) + Math.sqrt((1.0 + x));
	return (((t_1 + (Math.sqrt(y) + t_2)) / t_2) / (t_1 + 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):
	t_1 = math.sqrt((1.0 + y))
	t_2 = math.sqrt(x) + math.sqrt((1.0 + x))
	return (((t_1 + (math.sqrt(y) + t_2)) / t_2) / (t_1 + 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)
	t_1 = sqrt(Float64(1.0 + y))
	t_2 = Float64(sqrt(x) + sqrt(Float64(1.0 + x)))
	return Float64(Float64(Float64(Float64(t_1 + Float64(sqrt(y) + t_2)) / t_2) / Float64(t_1 + 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)
	t_1 = sqrt((1.0 + y));
	t_2 = sqrt(x) + sqrt((1.0 + x));
	tmp = (((t_1 + (sqrt(y) + t_2)) / t_2) / (t_1 + 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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(t$95$1 + N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$1 + N[Sqrt[y], $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])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x} + \sqrt{1 + x}\\
\frac{\frac{t_1 + \left(\sqrt{y} + t_2\right)}{t_2}}{t_1 + \sqrt{y}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 93.4%

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

      \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    2. associate-+l-72.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. +-commutative72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt76.4%

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  11. Applied egg-rr95.0%

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

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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-eval96.1%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  13. Simplified96.1%

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{1}{\sqrt{1 + y} + \sqrt{y}}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  14. Step-by-step derivation
    1. expm1-log1p-u96.4%

      \[\leadsto \color{blue}{\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + 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) \]
    2. frac-add96.4%

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

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

      \[\leadsto \frac{\color{blue}{1} \cdot \left(\sqrt{1 + y} + \sqrt{y}\right) + \left(\sqrt{x} + \sqrt{1 + x}\right) \cdot 1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \left(\sqrt{1 + y} + \sqrt{y}\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    5. *-un-lft-identity96.4%

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

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

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

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

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

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

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

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

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

Alternative 5: 97.8% accurate, 0.7× 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{x} + \sqrt{1 + x}\\ \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \frac{t_1 + \left(\sqrt{y} + t_2\right)}{t_2 \cdot \left(t_1 + \sqrt{y}\right)} \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (+ (sqrt x) (sqrt (+ 1.0 x)))))
   (+
    (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
    (/ (+ t_1 (+ (sqrt y) t_2)) (* t_2 (+ t_1 (sqrt y)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + y));
	double t_2 = sqrt(x) + sqrt((1.0 + x));
	return ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 + (sqrt(y) + t_2)) / (t_2 * (t_1 + 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
    real(8) :: t_1
    real(8) :: t_2
    t_1 = sqrt((1.0d0 + y))
    t_2 = sqrt(x) + sqrt((1.0d0 + x))
    code = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((t_1 + (sqrt(y) + t_2)) / (t_2 * (t_1 + sqrt(y))))
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(x) + Math.sqrt((1.0 + x));
	return ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((t_1 + (Math.sqrt(y) + t_2)) / (t_2 * (t_1 + Math.sqrt(y))));
}
[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(x) + math.sqrt((1.0 + x))
	return ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((t_1 + (math.sqrt(y) + t_2)) / (t_2 * (t_1 + math.sqrt(y))))
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(x) + sqrt(Float64(1.0 + x)))
	return Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(t_1 + Float64(sqrt(y) + t_2)) / Float64(t_2 * Float64(t_1 + sqrt(y)))))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	t_1 = sqrt((1.0 + y));
	t_2 = sqrt(x) + sqrt((1.0 + x));
	tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 + (sqrt(y) + t_2)) / (t_2 * (t_1 + sqrt(y))));
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[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(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] + N[(N[(t$95$1 + N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(t$95$1 + N[Sqrt[y], $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{x} + \sqrt{1 + x}\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \frac{t_1 + \left(\sqrt{y} + t_2\right)}{t_2 \cdot \left(t_1 + \sqrt{y}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 93.4%

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

      \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    2. associate-+l-72.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. +-commutative72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt76.4%

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  11. Applied egg-rr95.0%

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

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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-eval96.1%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  13. Simplified96.1%

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{1}{\sqrt{1 + y} + \sqrt{y}}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  14. Step-by-step derivation
    1. expm1-log1p-u96.4%

      \[\leadsto \color{blue}{\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + 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) \]
    2. frac-add96.4%

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

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

      \[\leadsto \frac{\color{blue}{1} \cdot \left(\sqrt{1 + y} + \sqrt{y}\right) + \left(\sqrt{x} + \sqrt{1 + x}\right) \cdot 1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \left(\sqrt{1 + y} + \sqrt{y}\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    5. *-un-lft-identity96.4%

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

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

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

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

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

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

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

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

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

Alternative 6: 98.4% accurate, 0.8× 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}\\ \mathbf{if}\;t_1 - \sqrt{y} \leq 0.9999995:\\ \;\;\;\;\left(t_2 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t_1 + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{\sqrt{z} + t_2}\right) + \left(\left(1 + t_1\right) - \sqrt{y}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 z))))
   (if (<= (- t_1 (sqrt y)) 0.9999995)
     (+
      (- t_2 (sqrt z))
      (expm1
       (log1p
        (+
         (/ 1.0 (+ t_1 (sqrt y)))
         (/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))))))
     (+
      (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (- (+ 1.0 z) z) (+ (sqrt z) t_2)))
      (- (+ 1.0 t_1) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + y));
	double t_2 = sqrt((1.0 + z));
	double tmp;
	if ((t_1 - sqrt(y)) <= 0.9999995) {
		tmp = (t_2 - sqrt(z)) + expm1(log1p(((1.0 / (t_1 + sqrt(y))) + ((1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)))))));
	} else {
		tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt(z) + t_2))) + ((1.0 + t_1) - sqrt(y));
	}
	return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 + y));
	double t_2 = Math.sqrt((1.0 + z));
	double tmp;
	if ((t_1 - Math.sqrt(y)) <= 0.9999995) {
		tmp = (t_2 - Math.sqrt(z)) + Math.expm1(Math.log1p(((1.0 / (t_1 + Math.sqrt(y))) + ((1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)))))));
	} else {
		tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (Math.sqrt(z) + t_2))) + ((1.0 + t_1) - Math.sqrt(y));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + y))
	t_2 = math.sqrt((1.0 + z))
	tmp = 0
	if (t_1 - math.sqrt(y)) <= 0.9999995:
		tmp = (t_2 - math.sqrt(z)) + math.expm1(math.log1p(((1.0 / (t_1 + math.sqrt(y))) + ((1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x)))))))
	else:
		tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (math.sqrt(z) + t_2))) + ((1.0 + t_1) - math.sqrt(y))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + y))
	t_2 = sqrt(Float64(1.0 + z))
	tmp = 0.0
	if (Float64(t_1 - sqrt(y)) <= 0.9999995)
		tmp = Float64(Float64(t_2 - sqrt(z)) + expm1(log1p(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x))))))));
	else
		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(sqrt(z) + t_2))) + Float64(Float64(1.0 + t_1) - sqrt(y)));
	end
	return tmp
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 0.9999995], N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(Exp[N[Log[1 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;t_1 - \sqrt{y} \leq 0.9999995:\\
\;\;\;\;\left(t_2 - \sqrt{z}\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{t_1 + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\right)\right)\\

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


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

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

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

        \[\leadsto \color{blue}{\left(\sqrt{x + 1} - \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. +-commutative85.6%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\color{blue}{1 + x}} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    5. Applied egg-rr87.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    6. Step-by-step derivation
      1. flip--87.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt51.5%

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1 + \left(y - y\right)}}{\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.4%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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.4%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    13. Simplified93.4%

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

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

    if 0.999999500000000041 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \frac{1}{\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-sqrt49.1%

        \[\leadsto \left(\sqrt{x + 1} - \left(\sqrt{x} - \frac{1}{\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. +-commutative49.1%

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

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

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

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

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

Alternative 7: 97.6% accurate, 0.8× speedup?

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    2. associate-+l-72.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. +-commutative72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{\sqrt{1 + y} \cdot \sqrt{1 + y} - \sqrt{y} \cdot \sqrt{y}}{\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-sqrt76.4%

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\left(1 + y\right) - \color{blue}{y}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  11. Applied egg-rr95.0%

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

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

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1 + \color{blue}{0}}{\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-eval96.1%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{\color{blue}{1}}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  13. Simplified96.1%

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \color{blue}{\frac{1}{\sqrt{1 + y} + \sqrt{y}}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  14. Step-by-step derivation
    1. expm1-log1p-u96.4%

      \[\leadsto \color{blue}{\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + 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) \]
    2. add-exp-log96.3%

      \[\leadsto \color{blue}{e^{\log \left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + 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) \]
    3. +-commutative96.3%

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

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

      \[\leadsto e^{\log \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{\color{blue}{1}}{\sqrt{x} + \sqrt{1 + x}}\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  15. Applied egg-rr96.3%

    \[\leadsto \color{blue}{e^{\log \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right)}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
  16. Final simplification96.3%

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

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

\mathbf{elif}\;y \leq 3.3 \cdot 10^{+28}:\\
\;\;\;\;t_1 - \left(\left(\sqrt{x} + \frac{-1}{\sqrt{z} + t_2}\right) + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\

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


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

    1. Initial program 98.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+98.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-59.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. +-commutative59.8%

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

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

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

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

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

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

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

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

    if 4.5000000000000002e-27 < y < 3.3e28

    1. Initial program 88.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+88.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. +-commutative88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.3e28 < y

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative34.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.4%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{\color{blue}{1 + x}}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    14. Simplified21.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{-27}:\\ \;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+28}:\\ \;\;\;\;\sqrt{1 + x} - \left(\left(\sqrt{x} + \frac{-1}{\sqrt{z} + \sqrt{1 + z}}\right) + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\ \end{array} \]

Alternative 9: 95.8% accurate, 1.3× speedup?

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

\mathbf{elif}\;y \leq 3.3 \cdot 10^{+28}:\\
\;\;\;\;t_2 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(t_1 - \sqrt{x}\right)\right)\\

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


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

    1. Initial program 98.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+98.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-59.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. +-commutative59.8%

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

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

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

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

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

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

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

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

    if 4.5000000000000002e-27 < y < 3.3e28

    1. Initial program 88.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+88.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. +-commutative88.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.3e28 < y

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative34.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.4%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{\color{blue}{1 + x}}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    14. Simplified21.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{-27}:\\ \;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{+28}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\\ \end{array} \]

Alternative 10: 95.6% accurate, 1.3× speedup?

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

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


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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(1 + \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. Simplified55.0%

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

    if 3.3e28 < y

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative34.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.4%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{\color{blue}{1 + x}}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    14. Simplified21.9%

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

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

Alternative 11: 90.1% accurate, 2.0× speedup?

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

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


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

    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. +-commutative97.5%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative34.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    11. Applied egg-rr52.4%

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

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

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

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

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

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

    if 3.3e28 < y

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative34.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.4%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{\color{blue}{1 + x}}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    14. Simplified21.9%

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

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

Alternative 12: 95.1% accurate, 2.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

    if 7.50000000000000007e-24 < y < 2e21

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e21 < y

    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. +-commutative87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.3%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

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

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

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

Alternative 13: 89.7% accurate, 2.6× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.5000000000000002e-24 < y < 2e21

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e21 < y

    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. +-commutative87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.3%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

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

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

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

Alternative 14: 89.7% accurate, 2.6× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.9999999999999993e-24 < y < 2e21

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e21 < y

    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. +-commutative87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.3%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

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

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

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

Alternative 15: 89.5% accurate, 3.8× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.6000000000000002e-24 < y < 1e22

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e22 < y

    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. +-commutative87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(x + 1\right) - x}{\sqrt{\color{blue}{x + 1}} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Applied egg-rr18.3%

      \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    13. Step-by-step derivation
      1. +-commutative88.4%

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

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

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

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

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

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

Alternative 16: 61.6% accurate, 3.9× speedup?

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

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


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

    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. +-commutative98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1499999999999999 < y

    1. Initial program 87.3%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+87.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. +-commutative87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.0%

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

Alternative 17: 84.0% accurate, 3.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.6 \cdot 10^{-24}:\\ \;\;\;\;\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 (<= y 4.6e-24)
   (+ (- (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 (y <= 4.6e-24) {
		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 (y <= 4.6d-24) 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 (y <= 4.6e-24) {
		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 y <= 4.6e-24:
		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 (y <= 4.6e-24)
		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 (y <= 4.6e-24)
		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[y, 4.6e-24], 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}\;y \leq 4.6 \cdot 10^{-24}:\\
\;\;\;\;\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 y < 4.6000000000000002e-24

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.6000000000000002e-24 < y

    1. Initial program 87.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. Step-by-step derivation
      1. associate-+l+87.8%

        \[\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. +-commutative87.8%

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

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

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

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

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

        \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\right) \]
    3. Simplified38.9%

      \[\leadsto \color{blue}{\sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\left(\sqrt{x} - \sqrt{1 + z}\right) + \left(\sqrt{t} + \left(\sqrt{z} - \sqrt{1 + t}\right)\right)\right)\right)} \]
    4. Taylor expanded in t around inf 34.2%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
    5. Step-by-step derivation
      1. +-commutative34.2%

        \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\color{blue}{\left(\sqrt{x} + \sqrt{z}\right)} - \sqrt{1 + z}\right)\right) \]
      2. +-commutative34.2%

        \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\left(\sqrt{x} + \sqrt{z}\right) - \sqrt{\color{blue}{z + 1}}\right)\right) \]
      3. associate--l+34.8%

        \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)}\right) \]
    6. Simplified34.8%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)}\right) \]
    7. Taylor expanded in z around inf 19.2%

      \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
    8. Step-by-step derivation
      1. +-commutative19.2%

        \[\leadsto \sqrt{x + 1} + \left(\sqrt{1 + y} - \color{blue}{\left(\sqrt{y} + \sqrt{x}\right)}\right) \]
    9. Simplified19.2%

      \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)} \]
    10. Taylor expanded in x around 0 9.0%

      \[\leadsto \color{blue}{\left(1 + \sqrt{1 + y}\right) - \sqrt{y}} \]
    11. Step-by-step derivation
      1. associate--l+43.6%

        \[\leadsto \color{blue}{1 + \left(\sqrt{1 + y} - \sqrt{y}\right)} \]
    12. Simplified43.6%

      \[\leadsto \color{blue}{1 + \left(\sqrt{1 + y} - \sqrt{y}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.6 \cdot 10^{-24}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]

Alternative 18: 64.3% 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 93.4%

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Step-by-step derivation
    1. associate-+l+93.4%

      \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    2. +-commutative93.4%

      \[\leadsto \color{blue}{\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{x + 1} - \sqrt{x}\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    3. associate-+r-72.2%

      \[\leadsto \color{blue}{\left(\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \sqrt{x + 1}\right) - \sqrt{x}\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-54.7%

      \[\leadsto \color{blue}{\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \sqrt{x + 1}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. +-commutative54.7%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)} - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
    6. associate--l+54.7%

      \[\leadsto \color{blue}{\sqrt{x + 1} + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\right)} \]
    7. +-commutative54.7%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\right) \]
  3. Simplified39.9%

    \[\leadsto \color{blue}{\sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\left(\sqrt{x} - \sqrt{1 + z}\right) + \left(\sqrt{t} + \left(\sqrt{z} - \sqrt{1 + t}\right)\right)\right)\right)} \]
  4. Taylor expanded in t around inf 34.0%

    \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
  5. Step-by-step derivation
    1. +-commutative34.0%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\color{blue}{\left(\sqrt{x} + \sqrt{z}\right)} - \sqrt{1 + z}\right)\right) \]
    2. +-commutative34.0%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\left(\sqrt{x} + \sqrt{z}\right) - \sqrt{\color{blue}{z + 1}}\right)\right) \]
    3. associate--l+35.3%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)}\right) \]
  6. Simplified35.3%

    \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)}\right) \]
  7. Taylor expanded in z around inf 19.6%

    \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
  8. Step-by-step derivation
    1. +-commutative19.6%

      \[\leadsto \sqrt{x + 1} + \left(\sqrt{1 + y} - \color{blue}{\left(\sqrt{y} + \sqrt{x}\right)}\right) \]
  9. Simplified19.6%

    \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)} \]
  10. Taylor expanded in x around 0 26.6%

    \[\leadsto \color{blue}{\left(1 + \sqrt{1 + y}\right) - \sqrt{y}} \]
  11. Step-by-step derivation
    1. associate--l+43.0%

      \[\leadsto \color{blue}{1 + \left(\sqrt{1 + y} - \sqrt{y}\right)} \]
  12. Simplified43.0%

    \[\leadsto \color{blue}{1 + \left(\sqrt{1 + y} - \sqrt{y}\right)} \]
  13. Final simplification43.0%

    \[\leadsto 1 + \left(\sqrt{1 + y} - \sqrt{y}\right) \]

Alternative 19: 36.1% 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 93.4%

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Step-by-step derivation
    1. associate-+l+93.4%

      \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    2. +-commutative93.4%

      \[\leadsto \color{blue}{\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{x + 1} - \sqrt{x}\right)\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    3. associate-+r-72.2%

      \[\leadsto \color{blue}{\left(\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \sqrt{x + 1}\right) - \sqrt{x}\right)} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-54.7%

      \[\leadsto \color{blue}{\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \sqrt{x + 1}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. +-commutative54.7%

      \[\leadsto \color{blue}{\left(\sqrt{x + 1} + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)} - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right) \]
    6. associate--l+54.7%

      \[\leadsto \color{blue}{\sqrt{x + 1} + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\right)} \]
    7. +-commutative54.7%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{\color{blue}{1 + y}} - \sqrt{y}\right) - \left(\sqrt{x} - \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\right) \]
  3. Simplified39.9%

    \[\leadsto \color{blue}{\sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\left(\sqrt{x} - \sqrt{1 + z}\right) + \left(\sqrt{t} + \left(\sqrt{z} - \sqrt{1 + t}\right)\right)\right)\right)} \]
  4. Taylor expanded in t around inf 34.0%

    \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\left(\sqrt{z} + \sqrt{x}\right) - \sqrt{1 + z}\right)}\right) \]
  5. Step-by-step derivation
    1. +-commutative34.0%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\color{blue}{\left(\sqrt{x} + \sqrt{z}\right)} - \sqrt{1 + z}\right)\right) \]
    2. +-commutative34.0%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\left(\sqrt{x} + \sqrt{z}\right) - \sqrt{\color{blue}{z + 1}}\right)\right) \]
    3. associate--l+35.3%

      \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)}\right) \]
  6. Simplified35.3%

    \[\leadsto \sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)}\right) \]
  7. Taylor expanded in z around inf 19.6%

    \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
  8. Step-by-step derivation
    1. +-commutative19.6%

      \[\leadsto \sqrt{x + 1} + \left(\sqrt{1 + y} - \color{blue}{\left(\sqrt{y} + \sqrt{x}\right)}\right) \]
  9. Simplified19.6%

    \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)} \]
  10. Taylor expanded in y around inf 14.2%

    \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
  11. Final simplification14.2%

    \[\leadsto \sqrt{1 + x} - \sqrt{x} \]

Developer target: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+
  (+
   (+
    (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
    (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
   (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
  (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
	return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
	return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t):
	return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t)))
end
function tmp = code(x, y, z, t)
	tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}

Reproduce

?
herbie shell --seed 2023199 
(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))))