Main:z from

Percentage Accurate: 91.4% → 99.3%
Time: 35.4s
Alternatives: 27
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 27 alternatives:

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

Initial Program: 91.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 0.5× speedup?

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

\mathbf{elif}\;t\_2 \leq 1.005:\\
\;\;\;\;\left(\left(\frac{\left(1 + x\right) - x}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot t\_3\right) + t\_4\right) + t\_1\\

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


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

    1. Initial program 82.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. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 94.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. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

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

    1. Initial program 98.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.1% accurate, 0.4× speedup?

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

\mathbf{elif}\;t\_1 \leq 1.005:\\
\;\;\;\;t\_4 + \left(0.5 \cdot t\_3 - \sqrt{x}\right)\\

\mathbf{elif}\;t\_1 \leq 1.99999998:\\
\;\;\;\;t\_4 + \left(\left(\sqrt{1 + y} + t\_2\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\

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


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

    1. Initial program 80.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 5.00000000000000024e-5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.0049999999999999

    1. Initial program 95.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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

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

    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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 98.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.1% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 80.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 5.00000000000000024e-5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.0049999999999999

    1. Initial program 95.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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 98.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 98.2% accurate, 0.5× speedup?

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

\mathbf{elif}\;t\_1 \leq 1.998:\\
\;\;\;\;\left(t\_1 + t\_2\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\\

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


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

    1. Initial program 80.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 5.00000000000000024e-5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.998

    1. Initial program 95.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 98.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 97.7% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 80.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 5.00000000000000024e-5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.19999999999999996

    1. Initial program 95.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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 98.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. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 98.2% accurate, 0.7× speedup?

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

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


\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)) < 5.0000000000000001e-4

    1. Initial program 88.1%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 97.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 98.2% accurate, 0.8× speedup?

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

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


\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)) < 5.0000000000000001e-4

    1. Initial program 88.1%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 97.0%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 91.5% accurate, 1.0× speedup?

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

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


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

    1. Initial program 88.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 95.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. Add Preprocessing
    3. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 91.2% accurate, 1.0× speedup?

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

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


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

    1. Initial program 88.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

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

    1. Initial program 95.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. Add Preprocessing
    3. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 91.0% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;\sqrt{z + 1} - \sqrt{z} \leq 0.999995:\\ \;\;\;\;1 + \left(\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + t\_1\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(2 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right) - \sqrt{z}\right) + \left(\sqrt{t + 1} - \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))))
   (if (<= (- (sqrt (+ z 1.0)) (sqrt z)) 0.999995)
     (+
      1.0
      (- (+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) t_1) (+ (sqrt y) (sqrt x))))
     (+
      (- (- (+ 2.0 t_1) (+ (sqrt x) (sqrt y))) (sqrt z))
      (- (sqrt (+ t 1.0)) (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 ((sqrt((z + 1.0)) - sqrt(z)) <= 0.999995) {
		tmp = 1.0 + (((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + t_1) - (sqrt(y) + sqrt(x)));
	} else {
		tmp = (((2.0 + t_1) - (sqrt(x) + sqrt(y))) - sqrt(z)) + (sqrt((t + 1.0)) - 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 ((sqrt((z + 1.0d0)) - sqrt(z)) <= 0.999995d0) then
        tmp = 1.0d0 + (((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + t_1) - (sqrt(y) + sqrt(x)))
    else
        tmp = (((2.0d0 + t_1) - (sqrt(x) + sqrt(y))) - sqrt(z)) + (sqrt((t + 1.0d0)) - 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 ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) <= 0.999995) {
		tmp = 1.0 + (((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + t_1) - (Math.sqrt(y) + Math.sqrt(x)));
	} else {
		tmp = (((2.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y))) - Math.sqrt(z)) + (Math.sqrt((t + 1.0)) - 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 (math.sqrt((z + 1.0)) - math.sqrt(z)) <= 0.999995:
		tmp = 1.0 + (((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + t_1) - (math.sqrt(y) + math.sqrt(x)))
	else:
		tmp = (((2.0 + t_1) - (math.sqrt(x) + math.sqrt(y))) - math.sqrt(z)) + (math.sqrt((t + 1.0)) - 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 (Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) <= 0.999995)
		tmp = Float64(1.0 + Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + t_1) - Float64(sqrt(y) + sqrt(x))));
	else
		tmp = Float64(Float64(Float64(Float64(2.0 + t_1) - Float64(sqrt(x) + sqrt(y))) - sqrt(z)) + Float64(sqrt(Float64(t + 1.0)) - 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 ((sqrt((z + 1.0)) - sqrt(z)) <= 0.999995)
		tmp = 1.0 + (((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + t_1) - (sqrt(y) + sqrt(x)));
	else
		tmp = (((2.0 + t_1) - (sqrt(x) + sqrt(y))) - sqrt(z)) + (sqrt((t + 1.0)) - 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[N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.999995], N[(1.0 + N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(2.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - 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}\\
\mathbf{if}\;\sqrt{z + 1} - \sqrt{z} \leq 0.999995:\\
\;\;\;\;1 + \left(\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + t\_1\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\

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


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

    1. Initial program 87.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. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 0.99999499999999997 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))

    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. Add Preprocessing
    3. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in z around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 91.0% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;\sqrt{z + 1} - \sqrt{z} \leq 0.999995:\\ \;\;\;\;1 + \left(\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + t\_1\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(2 + \left(t\_1 - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right) + \left(\sqrt{t + 1} - \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))))
   (if (<= (- (sqrt (+ z 1.0)) (sqrt z)) 0.999995)
     (+
      1.0
      (- (+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) t_1) (+ (sqrt y) (sqrt x))))
     (+
      (+ 2.0 (- t_1 (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
      (- (sqrt (+ t 1.0)) (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 ((sqrt((z + 1.0)) - sqrt(z)) <= 0.999995) {
		tmp = 1.0 + (((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + t_1) - (sqrt(y) + sqrt(x)));
	} else {
		tmp = (2.0 + (t_1 - (sqrt(x) + (sqrt(y) + sqrt(z))))) + (sqrt((t + 1.0)) - 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 ((sqrt((z + 1.0d0)) - sqrt(z)) <= 0.999995d0) then
        tmp = 1.0d0 + (((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + t_1) - (sqrt(y) + sqrt(x)))
    else
        tmp = (2.0d0 + (t_1 - (sqrt(x) + (sqrt(y) + sqrt(z))))) + (sqrt((t + 1.0d0)) - 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 ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) <= 0.999995) {
		tmp = 1.0 + (((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + t_1) - (Math.sqrt(y) + Math.sqrt(x)));
	} else {
		tmp = (2.0 + (t_1 - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))))) + (Math.sqrt((t + 1.0)) - 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 (math.sqrt((z + 1.0)) - math.sqrt(z)) <= 0.999995:
		tmp = 1.0 + (((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + t_1) - (math.sqrt(y) + math.sqrt(x)))
	else:
		tmp = (2.0 + (t_1 - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) + (math.sqrt((t + 1.0)) - 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 (Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) <= 0.999995)
		tmp = Float64(1.0 + Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + t_1) - Float64(sqrt(y) + sqrt(x))));
	else
		tmp = Float64(Float64(2.0 + Float64(t_1 - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))) + Float64(sqrt(Float64(t + 1.0)) - 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 ((sqrt((z + 1.0)) - sqrt(z)) <= 0.999995)
		tmp = 1.0 + (((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + t_1) - (sqrt(y) + sqrt(x)));
	else
		tmp = (2.0 + (t_1 - (sqrt(x) + (sqrt(y) + sqrt(z))))) + (sqrt((t + 1.0)) - 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[N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.999995], N[(1.0 + N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - 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}\\
\mathbf{if}\;\sqrt{z + 1} - \sqrt{z} \leq 0.999995:\\
\;\;\;\;1 + \left(\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + t\_1\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\

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


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

    1. Initial program 87.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. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 0.99999499999999997 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))

    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. Add Preprocessing
    3. Taylor expanded in z around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 94.1% accurate, 1.3× speedup?

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

\mathbf{elif}\;y \leq 31000000000:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{1 + y} + t\_2\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\

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


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

    1. Initial program 97.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 6.20000000000000025e-22 < y < 3.1e10

    1. Initial program 96.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 3.1e10 < y

    1. Initial program 87.3%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 88.1% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.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. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Applied egg-rr0

      \[\leadsto expr\]
    5. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 1.1e10 < y

    1. Initial program 87.3%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 84.9% 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 8.8 \cdot 10^{+14}:\\ \;\;\;\;\left(\left(\left(\left(1 + t\_1\right) + \sqrt{1 + z}\right) - \sqrt{z}\right) - \sqrt{y}\right) - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(t\_1 - \sqrt{x}\right) - \sqrt{y}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y))))
   (if (<= z 8.8e+14)
     (- (- (- (+ (+ 1.0 t_1) (sqrt (+ 1.0 z))) (sqrt z)) (sqrt y)) (sqrt x))
     (+ (sqrt (+ 1.0 x)) (- (- 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 <= 8.8e+14) {
		tmp = ((((1.0 + t_1) + sqrt((1.0 + z))) - sqrt(z)) - sqrt(y)) - sqrt(x);
	} else {
		tmp = sqrt((1.0 + x)) + ((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 <= 8.8d+14) then
        tmp = ((((1.0d0 + t_1) + sqrt((1.0d0 + z))) - sqrt(z)) - sqrt(y)) - sqrt(x)
    else
        tmp = sqrt((1.0d0 + x)) + ((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 <= 8.8e+14) {
		tmp = ((((1.0 + t_1) + Math.sqrt((1.0 + z))) - Math.sqrt(z)) - Math.sqrt(y)) - Math.sqrt(x);
	} else {
		tmp = Math.sqrt((1.0 + x)) + ((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 <= 8.8e+14:
		tmp = ((((1.0 + t_1) + math.sqrt((1.0 + z))) - math.sqrt(z)) - math.sqrt(y)) - math.sqrt(x)
	else:
		tmp = math.sqrt((1.0 + x)) + ((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 <= 8.8e+14)
		tmp = Float64(Float64(Float64(Float64(Float64(1.0 + t_1) + sqrt(Float64(1.0 + z))) - sqrt(z)) - sqrt(y)) - sqrt(x));
	else
		tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(t_1 - 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 <= 8.8e+14)
		tmp = ((((1.0 + t_1) + sqrt((1.0 + z))) - sqrt(z)) - sqrt(y)) - sqrt(x);
	else
		tmp = sqrt((1.0 + x)) + ((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, 8.8e+14], N[(N[(N[(N[(N[(1.0 + t$95$1), $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 8.8 \cdot 10^{+14}:\\
\;\;\;\;\left(\left(\left(\left(1 + t\_1\right) + \sqrt{1 + z}\right) - \sqrt{z}\right) - \sqrt{y}\right) - \sqrt{x}\\

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


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

    1. Initial program 96.5%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 8.8e14 < z

    1. Initial program 86.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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

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

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


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

    1. Initial program 96.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. Add Preprocessing
    3. Taylor expanded in z around 0 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 1.05000000000000004 < z

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 66.5% accurate, 2.0× speedup?

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

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Applied egg-rr0

      \[\leadsto expr\]

    if 2.9e7 < y

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 17: 66.5% accurate, 2.0× speedup?

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

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 7e7 < y

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 18: 66.5% accurate, 2.5× speedup?

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

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 2.8e7 < y

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 66.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 68000000:\\ \;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot -0.125\right)\right) + \left(\left(\sqrt{1 + y} - \sqrt{x}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \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
 (if (<= y 68000000.0)
   (+
    (+ 1.0 (* x (+ 0.5 (* x -0.125))))
    (- (- (sqrt (+ 1.0 y)) (sqrt x)) (sqrt y)))
   (+ (sqrt (+ 1.0 x)) (- (* 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 <= 68000000.0) {
		tmp = (1.0 + (x * (0.5 + (x * -0.125)))) + ((sqrt((1.0 + y)) - sqrt(x)) - sqrt(y));
	} else {
		tmp = sqrt((1.0 + x)) + ((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 <= 68000000.0d0) then
        tmp = (1.0d0 + (x * (0.5d0 + (x * (-0.125d0))))) + ((sqrt((1.0d0 + y)) - sqrt(x)) - sqrt(y))
    else
        tmp = sqrt((1.0d0 + x)) + ((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 <= 68000000.0) {
		tmp = (1.0 + (x * (0.5 + (x * -0.125)))) + ((Math.sqrt((1.0 + y)) - Math.sqrt(x)) - Math.sqrt(y));
	} else {
		tmp = Math.sqrt((1.0 + x)) + ((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 <= 68000000.0:
		tmp = (1.0 + (x * (0.5 + (x * -0.125)))) + ((math.sqrt((1.0 + y)) - math.sqrt(x)) - math.sqrt(y))
	else:
		tmp = math.sqrt((1.0 + x)) + ((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 <= 68000000.0)
		tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * -0.125)))) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(x)) - sqrt(y)));
	else
		tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(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 <= 68000000.0)
		tmp = (1.0 + (x * (0.5 + (x * -0.125)))) + ((sqrt((1.0 + y)) - sqrt(x)) - sqrt(y));
	else
		tmp = sqrt((1.0 + x)) + ((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, 68000000.0], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $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}
\mathbf{if}\;y \leq 68000000:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot -0.125\right)\right) + \left(\left(\sqrt{1 + y} - \sqrt{x}\right) - \sqrt{y}\right)\\

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 6.8e7 < y

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 66.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 38000000:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) + x \cdot 0.5\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \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
 (if (<= y 38000000.0)
   (- (+ (+ 1.0 (sqrt (+ 1.0 y))) (* x 0.5)) (+ (sqrt x) (sqrt y)))
   (+ (sqrt (+ 1.0 x)) (- (* 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 <= 38000000.0) {
		tmp = ((1.0 + sqrt((1.0 + y))) + (x * 0.5)) - (sqrt(x) + sqrt(y));
	} else {
		tmp = sqrt((1.0 + x)) + ((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 <= 38000000.0d0) then
        tmp = ((1.0d0 + sqrt((1.0d0 + y))) + (x * 0.5d0)) - (sqrt(x) + sqrt(y))
    else
        tmp = sqrt((1.0d0 + x)) + ((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 <= 38000000.0) {
		tmp = ((1.0 + Math.sqrt((1.0 + y))) + (x * 0.5)) - (Math.sqrt(x) + Math.sqrt(y));
	} else {
		tmp = Math.sqrt((1.0 + x)) + ((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 <= 38000000.0:
		tmp = ((1.0 + math.sqrt((1.0 + y))) + (x * 0.5)) - (math.sqrt(x) + math.sqrt(y))
	else:
		tmp = math.sqrt((1.0 + x)) + ((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 <= 38000000.0)
		tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) + Float64(x * 0.5)) - Float64(sqrt(x) + sqrt(y)));
	else
		tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(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 <= 38000000.0)
		tmp = ((1.0 + sqrt((1.0 + y))) + (x * 0.5)) - (sqrt(x) + sqrt(y));
	else
		tmp = sqrt((1.0 + x)) + ((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, 38000000.0], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $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}
\mathbf{if}\;y \leq 38000000:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) + x \cdot 0.5\right) - \left(\sqrt{x} + \sqrt{y}\right)\\

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 3.8e7 < y

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 66.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 55000000:\\ \;\;\;\;1 + \left(\left(\sqrt{1 + y} - \sqrt{x}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \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
 (if (<= y 55000000.0)
   (+ 1.0 (- (- (sqrt (+ 1.0 y)) (sqrt x)) (sqrt y)))
   (+ (sqrt (+ 1.0 x)) (- (* 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 <= 55000000.0) {
		tmp = 1.0 + ((sqrt((1.0 + y)) - sqrt(x)) - sqrt(y));
	} else {
		tmp = sqrt((1.0 + x)) + ((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 <= 55000000.0d0) then
        tmp = 1.0d0 + ((sqrt((1.0d0 + y)) - sqrt(x)) - sqrt(y))
    else
        tmp = sqrt((1.0d0 + x)) + ((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 <= 55000000.0) {
		tmp = 1.0 + ((Math.sqrt((1.0 + y)) - Math.sqrt(x)) - Math.sqrt(y));
	} else {
		tmp = Math.sqrt((1.0 + x)) + ((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 <= 55000000.0:
		tmp = 1.0 + ((math.sqrt((1.0 + y)) - math.sqrt(x)) - math.sqrt(y))
	else:
		tmp = math.sqrt((1.0 + x)) + ((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 <= 55000000.0)
		tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(x)) - sqrt(y)));
	else
		tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(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 <= 55000000.0)
		tmp = 1.0 + ((sqrt((1.0 + y)) - sqrt(x)) - sqrt(y));
	else
		tmp = sqrt((1.0 + x)) + ((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, 55000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $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}
\mathbf{if}\;y \leq 55000000:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + y} - \sqrt{x}\right) - \sqrt{y}\right)\\

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 5.5e7 < y

    1. Initial program 87.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. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 22: 64.0% accurate, 2.7× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in z around inf 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in t around inf 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Taylor expanded in x around 0 0

    \[\leadsto expr\]
  8. Simplified0

    \[\leadsto expr\]
  9. Add Preprocessing

Alternative 23: 35.4% accurate, 4.0× speedup?

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

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in t around inf 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Taylor expanded in y around inf 0

    \[\leadsto expr\]
  8. Simplified0

    \[\leadsto expr\]
  9. Add Preprocessing

Alternative 24: 34.3% accurate, 7.8× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Taylor expanded in x around 0 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Taylor expanded in x around inf 0

    \[\leadsto expr\]
  8. Simplified0

    \[\leadsto expr\]
  9. Add Preprocessing

Alternative 25: 7.9% accurate, 7.8× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in y around 0 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Add Preprocessing

Alternative 26: 1.9% accurate, 8.0× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Taylor expanded in x around 0 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Taylor expanded in x around inf 0

    \[\leadsto expr\]
  8. Simplified0

    \[\leadsto expr\]
  9. Add Preprocessing

Alternative 27: 1.5% accurate, 8.1× speedup?

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

    \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in z around inf 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Applied egg-rr0

    \[\leadsto expr\]
  8. Add Preprocessing

Developer target: 99.4% accurate, 1.0× speedup?

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

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

Reproduce

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

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

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