Main:z from

Percentage Accurate: 92.1% → 99.3%
Time: 33.0s
Alternatives: 22
Speedup: 0.8×

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

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

Initial Program: 92.1% 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.4× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + z}\\ t_3 := \sqrt{1 + t}\\ t_4 := \sqrt{x + 1}\\ t_5 := t\_2 - \sqrt{z}\\ t_6 := t\_5 + \left(\left(t\_4 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\ t_7 := \sqrt{x} + \sqrt{y}\\ \mathbf{if}\;t\_6 \leq 1.0002:\\ \;\;\;\;\left(t\_5 + \left(t\_3 - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_4}\right)\\ \mathbf{elif}\;t\_6 \leq 2.01:\\ \;\;\;\;\left(t\_4 + \left(t\_1 + \left(-0.125 \cdot \sqrt{\frac{1}{{z}^{3}}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right)\right) - t\_7\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\left(\left(t\_2 + t\_4\right) + \mathsf{fma}\left(0.5, y, \frac{1}{t\_3 + \sqrt{t}}\right)\right) - \left(\sqrt{z} + t\_7\right)\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y)))
        (t_2 (sqrt (+ 1.0 z)))
        (t_3 (sqrt (+ 1.0 t)))
        (t_4 (sqrt (+ x 1.0)))
        (t_5 (- t_2 (sqrt z)))
        (t_6 (+ t_5 (+ (- t_4 (sqrt x)) (- t_1 (sqrt y)))))
        (t_7 (+ (sqrt x) (sqrt y))))
   (if (<= t_6 1.0002)
     (+
      (+ t_5 (- t_3 (sqrt t)))
      (+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt x) t_4))))
     (if (<= t_6 2.01)
       (-
        (+
         t_4
         (+
          t_1
          (+ (* -0.125 (sqrt (/ 1.0 (pow z 3.0)))) (* 0.5 (sqrt (/ 1.0 z))))))
        t_7)
       (+
        1.0
        (-
         (+ (+ t_2 t_4) (fma 0.5 y (/ 1.0 (+ t_3 (sqrt t)))))
         (+ (sqrt z) t_7)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + y));
	double t_2 = sqrt((1.0 + z));
	double t_3 = sqrt((1.0 + t));
	double t_4 = sqrt((x + 1.0));
	double t_5 = t_2 - sqrt(z);
	double t_6 = t_5 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)));
	double t_7 = sqrt(x) + sqrt(y);
	double tmp;
	if (t_6 <= 1.0002) {
		tmp = (t_5 + (t_3 - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt(x) + t_4)));
	} else if (t_6 <= 2.01) {
		tmp = (t_4 + (t_1 + ((-0.125 * sqrt((1.0 / pow(z, 3.0)))) + (0.5 * sqrt((1.0 / z)))))) - t_7;
	} else {
		tmp = 1.0 + (((t_2 + t_4) + fma(0.5, y, (1.0 / (t_3 + sqrt(t))))) - (sqrt(z) + t_7));
	}
	return tmp;
}
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = sqrt(Float64(1.0 + y))
	t_2 = sqrt(Float64(1.0 + z))
	t_3 = sqrt(Float64(1.0 + t))
	t_4 = sqrt(Float64(x + 1.0))
	t_5 = Float64(t_2 - sqrt(z))
	t_6 = Float64(t_5 + Float64(Float64(t_4 - sqrt(x)) + Float64(t_1 - sqrt(y))))
	t_7 = Float64(sqrt(x) + sqrt(y))
	tmp = 0.0
	if (t_6 <= 1.0002)
		tmp = Float64(Float64(t_5 + Float64(t_3 - sqrt(t))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(x) + t_4))));
	elseif (t_6 <= 2.01)
		tmp = Float64(Float64(t_4 + Float64(t_1 + Float64(Float64(-0.125 * sqrt(Float64(1.0 / (z ^ 3.0)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))))) - t_7);
	else
		tmp = Float64(1.0 + Float64(Float64(Float64(t_2 + t_4) + fma(0.5, y, Float64(1.0 / Float64(t_3 + sqrt(t))))) - Float64(sqrt(z) + t_7)));
	end
	return tmp
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[(N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 1.0002], N[(N[(t$95$5 + N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.01], N[(N[(t$95$4 + N[(t$95$1 + N[(N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[z, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$7), $MachinePrecision], N[(1.0 + N[(N[(N[(t$95$2 + t$95$4), $MachinePrecision] + N[(0.5 * y + N[(1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t}\\
t_4 := \sqrt{x + 1}\\
t_5 := t\_2 - \sqrt{z}\\
t_6 := t\_5 + \left(\left(t\_4 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
t_7 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;t\_6 \leq 1.0002:\\
\;\;\;\;\left(t\_5 + \left(t\_3 - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{x} + t\_4}\right)\\

\mathbf{elif}\;t\_6 \leq 2.01:\\
\;\;\;\;\left(t\_4 + \left(t\_1 + \left(-0.125 \cdot \sqrt{\frac{1}{{z}^{3}}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right)\right) - t\_7\\

\mathbf{else}:\\
\;\;\;\;1 + \left(\left(\left(t\_2 + t\_4\right) + \mathsf{fma}\left(0.5, y, \frac{1}{t\_3 + \sqrt{t}}\right)\right) - \left(\sqrt{z} + t\_7\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0002 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.0099999999999998

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0099999999999998 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \left(\left(\left(\sqrt{1 + z} + \sqrt{1 + x}\right) + \mathsf{fma}\left(0.5, y, \frac{1}{\color{blue}{\sqrt{1 + t} + \sqrt{t}}}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      6. associate-+r+99.9%

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

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

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

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

Alternative 2: 99.3% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \sqrt{1 + t} - \sqrt{t}\\ t_2 := \sqrt{1 + y}\\ t_3 := \sqrt{1 + z}\\ t_4 := t\_3 - \sqrt{z}\\ t_5 := \sqrt{y} + t\_2\\ t_6 := \sqrt{x + 1}\\ t_7 := \sqrt{x} + t\_6\\ \mathbf{if}\;t\_4 + \left(\left(t\_6 - \sqrt{x}\right) + \left(t\_2 - \sqrt{y}\right)\right) \leq 0:\\ \;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_4 + t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x + \left(1 - x\right), t\_5, t\_7 \cdot \left(1 + \left(y - y\right)\right)\right)}{t\_5 \cdot t\_7} + \left(t\_1 + \frac{1}{\sqrt{z} + t\_3}\right)\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
        (t_2 (sqrt (+ 1.0 y)))
        (t_3 (sqrt (+ 1.0 z)))
        (t_4 (- t_3 (sqrt z)))
        (t_5 (+ (sqrt y) t_2))
        (t_6 (sqrt (+ x 1.0)))
        (t_7 (+ (sqrt x) t_6)))
   (if (<= (+ t_4 (+ (- t_6 (sqrt x)) (- t_2 (sqrt y)))) 0.0)
     (+ (* 0.5 (+ (sqrt (/ 1.0 x)) (sqrt (/ 1.0 y)))) (+ t_4 t_1))
     (+
      (/ (fma (+ x (- 1.0 x)) t_5 (* t_7 (+ 1.0 (- y y)))) (* t_5 t_7))
      (+ t_1 (/ 1.0 (+ (sqrt z) t_3)))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((1.0 + t)) - sqrt(t);
	double t_2 = sqrt((1.0 + y));
	double t_3 = sqrt((1.0 + z));
	double t_4 = t_3 - sqrt(z);
	double t_5 = sqrt(y) + t_2;
	double t_6 = sqrt((x + 1.0));
	double t_7 = sqrt(x) + t_6;
	double tmp;
	if ((t_4 + ((t_6 - sqrt(x)) + (t_2 - sqrt(y)))) <= 0.0) {
		tmp = (0.5 * (sqrt((1.0 / x)) + sqrt((1.0 / y)))) + (t_4 + t_1);
	} else {
		tmp = (fma((x + (1.0 - x)), t_5, (t_7 * (1.0 + (y - y)))) / (t_5 * t_7)) + (t_1 + (1.0 / (sqrt(z) + t_3)));
	}
	return tmp;
}
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t))
	t_2 = sqrt(Float64(1.0 + y))
	t_3 = sqrt(Float64(1.0 + z))
	t_4 = Float64(t_3 - sqrt(z))
	t_5 = Float64(sqrt(y) + t_2)
	t_6 = sqrt(Float64(x + 1.0))
	t_7 = Float64(sqrt(x) + t_6)
	tmp = 0.0
	if (Float64(t_4 + Float64(Float64(t_6 - sqrt(x)) + Float64(t_2 - sqrt(y)))) <= 0.0)
		tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / x)) + sqrt(Float64(1.0 / y)))) + Float64(t_4 + t_1));
	else
		tmp = Float64(Float64(fma(Float64(x + Float64(1.0 - x)), t_5, Float64(t_7 * Float64(1.0 + Float64(y - y)))) / Float64(t_5 * t_7)) + Float64(t_1 + Float64(1.0 / Float64(sqrt(z) + t_3))));
	end
	return tmp
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$7 = N[(N[Sqrt[x], $MachinePrecision] + t$95$6), $MachinePrecision]}, If[LessEqual[N[(t$95$4 + N[(N[(t$95$6 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] * t$95$5 + N[(t$95$7 * N[(1.0 + N[(y - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$5 * t$95$7), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
t_3 := \sqrt{1 + z}\\
t_4 := t\_3 - \sqrt{z}\\
t_5 := \sqrt{y} + t\_2\\
t_6 := \sqrt{x + 1}\\
t_7 := \sqrt{x} + t\_6\\
\mathbf{if}\;t\_4 + \left(\left(t\_6 - \sqrt{x}\right) + \left(t\_2 - \sqrt{y}\right)\right) \leq 0:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{x}} + \sqrt{\frac{1}{y}}\right) + \left(t\_4 + t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x + \left(1 - x\right), t\_5, t\_7 \cdot \left(1 + \left(y - y\right)\right)\right)}{t\_5 \cdot t\_7} + \left(t\_1 + \frac{1}{\sqrt{z} + t\_3}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0

    1. Initial program 51.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 0.4× speedup?

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

\mathbf{elif}\;t\_6 \leq 2.01:\\
\;\;\;\;\left(t\_4 + \left(t\_1 + \left(-0.125 \cdot \sqrt{\frac{1}{{z}^{3}}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\right)\right) - t\_7\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0002 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.0099999999999998

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0099999999999998 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.0% accurate, 0.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.998999999999999999

    1. Initial program 59.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.998999999999999999 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(x + \left(1 - x\right), \sqrt{1 + y} + \sqrt{y}, \left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \left(1 + \left(y - y\right)\right)\right)}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \left(\sqrt{1 + y} + \sqrt{y}\right)} + \left(\color{blue}{\frac{1}{\sqrt{1 + z} + \sqrt{z}}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    13. Taylor expanded in x around 0 96.7%

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_2 + t\_4\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.002

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x + \left(1 - x\right), \sqrt{1 + y} + \sqrt{y}, \left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \left(1 + \left(y - y\right)\right)\right)}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \left(\sqrt{1 + y} + \sqrt{y}\right)} + \left(\frac{\color{blue}{1}}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    12. Simplified95.4%

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

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

    if 1.002 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.1% accurate, 0.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(t\_3 + \frac{1}{\sqrt{z} + t\_1}\right) + t\_5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.002

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.002 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.3% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 1.0002

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0002 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)))

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 99.0% accurate, 0.8× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 41.7% accurate, 0.9× speedup?

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

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


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

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 90.5% accurate, 1.0× speedup?

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

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


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

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < (-.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. Step-by-step derivation
      1. associate-+l+97.0%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 92.0% accurate, 1.3× speedup?

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

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


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

    1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.14999999999999992e28 < t

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 86.4% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 85.0% accurate, 1.6× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9e15 < z

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3e15 < z

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 85.1% accurate, 1.6× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.9e15 < z

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 85.1% accurate, 1.6× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e15 < z

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 80.9% accurate, 2.0× speedup?

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.340000000000000024 < z

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 19: 65.0% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 20: 36.8% accurate, 4.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 21: 7.7% 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 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 91.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{z}} \]
  10. Add Preprocessing

Alternative 22: 7.6% accurate, 8.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Developer Target 1: 99.4% accurate, 1.0× speedup?

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

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

Reproduce

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

  :alt
  (! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (sqrt t))))

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