Main:z from

Percentage Accurate: 91.9% → 98.2%
Time: 46.6s
Alternatives: 17
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 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.9% 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: 98.2% accurate, 1.1× 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}\;z \leq 3400000:\\ \;\;\;\;\left(\left(t\_2 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right) + \left(t\_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{x} + t\_2} + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right) + 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 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 x))))
   (if (<= z 3400000.0)
     (+
      (+ (- t_2 (sqrt x)) (- 1.0 (sqrt y)))
      (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
     (+
      (+ (/ 1.0 (+ (sqrt x) t_2)) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y)))))
      t_1))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + z)) - sqrt(z);
	double t_2 = sqrt((1.0 + x));
	double tmp;
	if (z <= 3400000.0) {
		tmp = ((t_2 - sqrt(x)) + (1.0 - sqrt(y))) + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
	} else {
		tmp = ((1.0 / (sqrt(x) + t_2)) + (1.0 / (sqrt(y) + sqrt((1.0 + y))))) + t_1;
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + z)) - sqrt(z)
    t_2 = sqrt((1.0d0 + x))
    if (z <= 3400000.0d0) then
        tmp = ((t_2 - sqrt(x)) + (1.0d0 - sqrt(y))) + (t_1 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
    else
        tmp = ((1.0d0 / (sqrt(x) + t_2)) + (1.0d0 / (sqrt(y) + sqrt((1.0d0 + y))))) + t_1
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
	double t_2 = Math.sqrt((1.0 + x));
	double tmp;
	if (z <= 3400000.0) {
		tmp = ((t_2 - Math.sqrt(x)) + (1.0 - Math.sqrt(y))) + (t_1 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
	} else {
		tmp = ((1.0 / (Math.sqrt(x) + t_2)) + (1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y))))) + t_1;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = math.sqrt((1.0 + z)) - math.sqrt(z)
	t_2 = math.sqrt((1.0 + x))
	tmp = 0
	if z <= 3400000.0:
		tmp = ((t_2 - math.sqrt(x)) + (1.0 - math.sqrt(y))) + (t_1 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))))
	else:
		tmp = ((1.0 / (math.sqrt(x) + t_2)) + (1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))))) + t_1
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z))
	t_2 = sqrt(Float64(1.0 + x))
	tmp = 0.0
	if (z <= 3400000.0)
		tmp = Float64(Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 - sqrt(y))) + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))));
	else
		tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y))))) + t_1);
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((1.0 + z)) - sqrt(z);
	t_2 = sqrt((1.0 + x));
	tmp = 0.0;
	if (z <= 3400000.0)
		tmp = ((t_2 - sqrt(x)) + (1.0 - sqrt(y))) + (t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
	else
		tmp = ((1.0 / (sqrt(x) + t_2)) + (1.0 / (sqrt(y) + sqrt((1.0 + y))))) + t_1;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[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[z, 3400000.0], N[(N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $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}\;z \leq 3400000:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right) + \left(t\_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\

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


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

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4e6 < z

    1. Initial program 85.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+85.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-69.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. associate-+l-85.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(1 + \color{blue}{0}\right) \cdot \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. metadata-eval87.9%

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \color{blue}{1} \cdot \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. *-lft-identity87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999955e-7 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(1 + \color{blue}{0}\right) \cdot \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. metadata-eval93.9%

      \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \color{blue}{1} \cdot \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. *-lft-identity93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999955e-7 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x))

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

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

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

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

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

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

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

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

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

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

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

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


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

    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-82.3%

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

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

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

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

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

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

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

    if 1.35e-16 < z

    1. Initial program 85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 90.4% accurate, 1.1× speedup?

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

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


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

    1. Initial program 86.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+86.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+86.9%

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

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

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

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

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

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

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

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

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

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

    if 0.10000000000000001 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (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} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative98.0%

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

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

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

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

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

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

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

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

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

Alternative 7: 92.4% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(1 + \color{blue}{0}\right) \cdot \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. metadata-eval93.9%

      \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \color{blue}{1} \cdot \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. *-lft-identity93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right) \]
  15. Add Preprocessing

Alternative 8: 90.5% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (+
  (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))
  (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (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(x) + sqrt((1.0 + x)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (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(x) + sqrt((1.0d0 + x)))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (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(x) + Math.sqrt((1.0 + x)))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (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(x) + math.sqrt((1.0 + x)))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (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(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 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(x) + sqrt((1.0 + x)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (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[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)
\end{array}
Derivation
  1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) \]
  11. Add Preprocessing

Alternative 9: 84.4% accurate, 1.6× speedup?

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

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


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

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4e6 < z

    1. Initial program 85.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+85.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+85.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{1 + x} + \left(\sqrt{1 + \color{blue}{\sqrt{y} \cdot \sqrt{y}}} - \left(\sqrt{y} + \sqrt{x}\right)\right) \]
      2. hypot-1-def32.4%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\mathsf{hypot}\left(1, \sqrt{y}\right)} - \left(\sqrt{y} + \sqrt{x}\right)\right) \]
    10. Applied egg-rr32.4%

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

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

Alternative 10: 84.4% accurate, 2.0× speedup?

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

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


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

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4e6 < z

    1. Initial program 85.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+85.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+85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 69.6% accurate, 2.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.8e-9

    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} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

    if 4.8e-9 < x

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \]
      2. add-sqr-sqrt5.0%

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}} \]
    11. Applied egg-rr4.1%

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

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

        \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} \]
      3. metadata-eval10.2%

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

        \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}} \]
    13. Simplified10.2%

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

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

Alternative 12: 39.5% accurate, 3.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 60000000:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{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 (<= x 60000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 60000000.0) {
		tmp = sqrt((1.0 + x)) - sqrt(x);
	} else {
		tmp = 0.5 * 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 (x <= 60000000.0d0) then
        tmp = sqrt((1.0d0 + x)) - sqrt(x)
    else
        tmp = 0.5d0 * 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 (x <= 60000000.0) {
		tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
	} else {
		tmp = 0.5 * 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 x <= 60000000.0:
		tmp = math.sqrt((1.0 + x)) - math.sqrt(x)
	else:
		tmp = 0.5 * 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 (x <= 60000000.0)
		tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x));
	else
		tmp = Float64(0.5 * 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 (x <= 60000000.0)
		tmp = sqrt((1.0 + x)) - sqrt(x);
	else
		tmp = 0.5 * 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[x, 60000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 60000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6e7 < x

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    10. Taylor expanded in x around inf 9.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 60000000:\\ \;\;\;\;\sqrt{1 + x} - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 39.6% accurate, 4.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \frac{1}{\sqrt{x} + \sqrt{1 + x}} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 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 = 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 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 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(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 = 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[(1.0 / 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])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}}
\end{array}
Derivation
  1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \]
    2. add-sqr-sqrt14.1%

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

      \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}} \]
  11. Applied egg-rr13.7%

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

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

      \[\leadsto \frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}} \]
    3. metadata-eval16.7%

      \[\leadsto \frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}} \]
    4. +-commutative16.7%

      \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}} \]
  13. Simplified16.7%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}} \]
  14. Final simplification16.7%

    \[\leadsto \frac{1}{\sqrt{x} + \sqrt{1 + x}} \]
  15. Add Preprocessing

Alternative 14: 39.1% accurate, 7.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.225000000000000006

    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} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.225000000000000006 < x

    1. Initial program 86.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+86.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+86.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    10. Taylor expanded in x around inf 9.9%

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

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

Alternative 15: 38.9% accurate, 7.5× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 0.029:\\ \;\;\;\;1 - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{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 (<= x 0.029) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 0.029) {
		tmp = 1.0 - sqrt(x);
	} else {
		tmp = 0.5 * 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 (x <= 0.029d0) then
        tmp = 1.0d0 - sqrt(x)
    else
        tmp = 0.5d0 * 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 (x <= 0.029) {
		tmp = 1.0 - Math.sqrt(x);
	} else {
		tmp = 0.5 * 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 x <= 0.029:
		tmp = 1.0 - math.sqrt(x)
	else:
		tmp = 0.5 * 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 (x <= 0.029)
		tmp = Float64(1.0 - sqrt(x));
	else
		tmp = Float64(0.5 * 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 (x <= 0.029)
		tmp = 1.0 - sqrt(x);
	else
		tmp = 0.5 * 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[x, 0.029], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.029:\\
\;\;\;\;1 - \sqrt{x}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.0290000000000000015

    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} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      3. +-commutative98.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1 - \sqrt{x}} \]

    if 0.0290000000000000015 < x

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    10. Taylor expanded in x around inf 10.1%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.029:\\ \;\;\;\;1 - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 34.3% accurate, 8.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 - \sqrt{x} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(1.0 - sqrt(x))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Derivation
  1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1 - \sqrt{x}} \]
  11. Final simplification12.6%

    \[\leadsto 1 - \sqrt{x} \]
  12. Add Preprocessing

Alternative 17: 1.9% accurate, 8.1× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ -\sqrt{x} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(-sqrt(x))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = -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[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Derivation
  1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\sqrt{x}} \]
  9. Simplified1.6%

    \[\leadsto \color{blue}{-\sqrt{x}} \]
  10. Final simplification1.6%

    \[\leadsto -\sqrt{x} \]
  11. Add Preprocessing

Developer target: 99.4% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024075 
(FPCore (x y z t)
  :name "Main:z from "
  :precision binary64

  :alt
  (+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))

  (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))