Main:z from

Percentage Accurate: 92.0% → 96.8%
Time: 30.9s
Alternatives: 18
Speedup: 1.1×

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

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

Initial Program: 92.0% accurate, 1.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \left(t\_2 + \left(t\_3 - \sqrt{y}\right)\right)\right) + \left(t\_4 - \sqrt{t}\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)) < 2e-3

    1. Initial program 81.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+81.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+81.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. +-commutative81.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. +-commutative81.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-62.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. +-commutative62.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. +-commutative62.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. Simplified62.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. Step-by-step derivation
      1. flip--62.6%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 97.2%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification85.5%

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

Alternative 2: 96.4% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(t\_2 + \left(t\_3 + \left(t\_1 - \sqrt{y}\right)\right)\right) + \left(t\_4 - \sqrt{t}\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.0

    1. Initial program 81.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+81.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+81.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. +-commutative81.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. +-commutative81.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-62.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. +-commutative62.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. +-commutative62.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. Simplified62.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. Step-by-step derivation
      1. flip--62.9%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 96.6%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification85.5%

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

Alternative 3: 93.5% accurate, 1.1× speedup?

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

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


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

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

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

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

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

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

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

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

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

    if 3e15 < z

    1. Initial program 82.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+82.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+82.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. +-commutative82.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. +-commutative82.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-82.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. +-commutative82.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. +-commutative82.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. Simplified82.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. Step-by-step derivation
      1. flip--82.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 90.7% accurate, 1.3× speedup?

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

\mathbf{elif}\;y \leq 7.2 \cdot 10^{+30}:\\
\;\;\;\;\left(t\_3 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y} + t\_2} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.04999999999999997e-10 < y < 7.2000000000000004e30

    1. Initial program 83.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+83.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+83.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. +-commutative83.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. +-commutative83.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-69.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. +-commutative69.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. +-commutative69.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. Simplified69.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. Step-by-step derivation
      1. flip--70.5%

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

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

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

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

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

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

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

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

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

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

    if 7.2000000000000004e30 < y

    1. Initial program 81.6%

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

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

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

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

        \[\leadsto \left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)}\right) \]
      5. associate-+l-64.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. +-commutative64.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. +-commutative64.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. Simplified64.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. Step-by-step derivation
      1. flip--64.0%

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - x}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} + \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) \]
    6. Applied egg-rr64.0%

      \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\sqrt{1 + x} + \sqrt{x}}} + \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) \]
    7. Step-by-step derivation
      1. associate--l+69.5%

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

      \[\leadsto \color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}} + \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) \]
    9. Taylor expanded in t around inf 25.8%

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

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

Alternative 5: 88.3% accurate, 1.3× speedup?

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

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


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

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. associate--l+20.4%

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

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

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

    if 8.4e15 < z

    1. Initial program 82.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+82.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+82.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. +-commutative82.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. +-commutative82.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-82.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. +-commutative82.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. +-commutative82.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. Simplified82.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. Step-by-step derivation
      1. flip--82.8%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 86.8% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{+18}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - x \cdot \mathsf{fma}\left(-1, \frac{\mathsf{hypot}\left(1, \sqrt{y}\right) - \sqrt{y}}{x}, \sqrt{\frac{1}{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
 (if (<= z 2.1e+18)
   (+
    1.0
    (+
     (sqrt (+ 1.0 y))
     (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
   (-
    (sqrt (+ x 1.0))
    (*
     x
     (fma -1.0 (/ (- (hypot 1.0 (sqrt y)) (sqrt y)) 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 (z <= 2.1e+18) {
		tmp = 1.0 + (sqrt((1.0 + y)) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
	} else {
		tmp = sqrt((x + 1.0)) - (x * fma(-1.0, ((hypot(1.0, sqrt(y)) - sqrt(y)) / x), 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 (z <= 2.1e+18)
		tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))));
	else
		tmp = Float64(sqrt(Float64(x + 1.0)) - Float64(x * fma(-1.0, Float64(Float64(hypot(1.0, sqrt(y)) - sqrt(y)) / x), sqrt(Float64(1.0 / x)))));
	end
	return tmp
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[z, 2.1e+18], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[(x * N[(-1.0 * N[(N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\

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


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

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. associate--l+20.7%

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

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

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

    if 2.1e18 < z

    1. Initial program 83.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. +-commutative83.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{\sqrt{1 + y} - \sqrt{y}}{x} - \sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg0.0%

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

        \[\leadsto \sqrt{1 + x} + \left(-\color{blue}{\left(-1 \cdot \frac{\sqrt{1 + y} - \sqrt{y}}{x} - \sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot x}\right) \]
      3. distribute-rgt-neg-in0.0%

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

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

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

Alternative 7: 87.1% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. associate--l+22.4%

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

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

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

    if 2.25e-41 < y < 64000

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 64000 < y

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.5% accurate, 1.6× speedup?

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

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


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

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. associate--l+20.7%

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

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

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

    if 4e18 < z

    1. Initial program 83.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. +-commutative83.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 83.4% accurate, 2.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;z \leq 1.1:\\ \;\;\;\;\left(\left(t\_1 + 2\right) + 0.5 \cdot z\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ x 1.0))))
   (if (<= z 1.1)
     (- (+ (+ t_1 2.0) (* 0.5 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
     (+ t_1 (- (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 t_1 = sqrt((x + 1.0));
	double tmp;
	if (z <= 1.1) {
		tmp = ((t_1 + 2.0) + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
	} else {
		tmp = t_1 + (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) :: t_1
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0))
    if (z <= 1.1d0) then
        tmp = ((t_1 + 2.0d0) + (0.5d0 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
    else
        tmp = t_1 + (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 t_1 = Math.sqrt((x + 1.0));
	double tmp;
	if (z <= 1.1) {
		tmp = ((t_1 + 2.0) + (0.5 * z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
	} else {
		tmp = t_1 + (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):
	t_1 = math.sqrt((x + 1.0))
	tmp = 0
	if z <= 1.1:
		tmp = ((t_1 + 2.0) + (0.5 * z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))
	else:
		tmp = t_1 + (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)
	t_1 = sqrt(Float64(x + 1.0))
	tmp = 0.0
	if (z <= 1.1)
		tmp = Float64(Float64(Float64(t_1 + 2.0) + Float64(0.5 * z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))));
	else
		tmp = Float64(t_1 + 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)
	t_1 = sqrt((x + 1.0));
	tmp = 0.0;
	if (z <= 1.1)
		tmp = ((t_1 + 2.0) + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
	else
		tmp = t_1 + (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_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.1], N[(N[(N[(t$95$1 + 2.0), $MachinePrecision] + N[(0.5 * z), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + 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}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 1.1:\\
\;\;\;\;\left(\left(t\_1 + 2\right) + 0.5 \cdot z\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\

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


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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1000000000000001 < z

    1. Initial program 82.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Taylor expanded in z around inf 19.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+29.7%

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

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

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

Alternative 10: 83.4% accurate, 2.0× speedup?

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

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


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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1200000000000001 < z

    1. Initial program 82.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Taylor expanded in z around inf 19.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+29.7%

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

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

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

Alternative 11: 67.4% accurate, 2.0× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + \color{blue}{\mathsf{hypot}\left(1, \sqrt{y}\right)}\right) - \left(\sqrt{x} + \sqrt{y}\right) \]
    11. Simplified21.3%

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

    if 1.9e7 < y

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 65.2% accurate, 2.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
  6. Taylor expanded in z around inf 14.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+21.3%

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

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

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

Alternative 13: 67.4% accurate, 2.6× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.2e7 < y

    1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 65.0% accurate, 2.7× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
  6. Taylor expanded in z around inf 14.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+21.3%

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

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

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

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

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

Alternative 15: 62.6% accurate, 3.9× speedup?

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

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


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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Taylor expanded in z around inf 23.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+23.8%

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(\sqrt{1 + x} - \sqrt{x}\right)} \]
    12. Simplified38.1%

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

    if 0.849999999999999978 < y

    1. Initial program 81.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. +-commutative81.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 36.3% accurate, 4.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
  6. Taylor expanded in z around inf 14.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+21.3%

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

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

    \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
  10. Final simplification14.9%

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

Alternative 17: 15.1% accurate, 8.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
  6. Taylor expanded in z around inf 14.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+21.3%

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

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

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

    \[\leadsto \color{blue}{\sqrt{1 + y}} \]
  11. Add Preprocessing

Alternative 18: 7.6% accurate, 8.1× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
  6. Taylor expanded in z around inf 14.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+21.3%

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

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

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

    \[\leadsto \color{blue}{\sqrt{y}} \]
  11. Add Preprocessing

Developer Target 1: 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 2024181 
(FPCore (x y z t)
  :name "Main:z from "
  :precision binary64

  :alt
  (! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (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))))