Main:z from

Percentage Accurate: 91.1% → 99.3%
Time: 1.5min
Alternatives: 26
Speedup: 1.6×

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

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

Initial Program: 91.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.9× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right) + \left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\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.999998000000000054

    1. Initial program 86.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+86.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. +-commutative86.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) \]
      3. +-commutative86.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) \]
      4. +-commutative86.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. Simplified86.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--86.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. add-sqr-sqrt56.6%

        \[\leadsto \left(\frac{\color{blue}{\left(x + 1\right)} - \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) \]
      3. +-commutative56.6%

        \[\leadsto \left(\frac{\color{blue}{\left(1 + x\right)} - \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) \]
      4. add-sqr-sqrt86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+97.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. +-commutative97.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) \]
      3. +-commutative97.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) \]
      4. +-commutative97.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. Simplified97.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. Taylor expanded in x around 0 97.4%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Step-by-step derivation
      1. flip--97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 97.5%

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

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

        \[\leadsto \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) \]
      3. +-commutative97.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) \]
      4. +-commutative97.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. Simplified97.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 x around 0 46.2%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Taylor expanded in y around 0 27.0%

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

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

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

    if 1.04e-10 < z

    1. Initial program 84.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+84.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. +-commutative84.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) \]
      3. +-commutative84.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) \]
      4. +-commutative84.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. Simplified84.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--85.0%

        \[\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. add-sqr-sqrt71.3%

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

        \[\leadsto \left(\frac{\color{blue}{\left(1 + x\right)} - \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) \]
      4. add-sqr-sqrt85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 1.3× speedup?

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

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


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

    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. +-commutative96.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) \]
      3. +-commutative96.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) \]
      4. +-commutative96.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. Simplified96.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 x around 0 47.7%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Taylor expanded in z around 0 25.0%

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

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

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

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

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

    if 4e15 < t

    1. Initial program 85.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+85.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. +-commutative85.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) \]
      3. +-commutative85.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) \]
      4. +-commutative85.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. Simplified85.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--85.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. add-sqr-sqrt71.6%

        \[\leadsto \left(\frac{\color{blue}{\left(x + 1\right)} - \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) \]
      3. +-commutative71.6%

        \[\leadsto \left(\frac{\color{blue}{\left(1 + x\right)} - \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) \]
      4. add-sqr-sqrt85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    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. +-commutative96.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) \]
      3. +-commutative96.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) \]
      4. +-commutative96.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. Simplified96.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 x around 0 47.7%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Taylor expanded in z around 0 25.0%

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

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

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

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

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

    if 4e15 < t

    1. Initial program 85.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+85.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. +-commutative85.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) \]
      3. +-commutative85.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) \]
      4. +-commutative85.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. Simplified85.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--85.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. add-sqr-sqrt71.6%

        \[\leadsto \left(\frac{\color{blue}{\left(x + 1\right)} - \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) \]
      3. +-commutative71.6%

        \[\leadsto \left(\frac{\color{blue}{\left(1 + x\right)} - \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) \]
      4. add-sqr-sqrt85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 95.8% accurate, 1.3× speedup?

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

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


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

    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. +-commutative96.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) \]
      3. +-commutative96.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) \]
      4. +-commutative96.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. Simplified96.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 x around 0 47.7%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Taylor expanded in z around 0 25.0%

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

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

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

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

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

    if 4e15 < t

    1. Initial program 85.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+85.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. +-commutative85.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) \]
      3. +-commutative85.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) \]
      4. +-commutative85.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. Simplified85.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--85.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. add-sqr-sqrt71.6%

        \[\leadsto \left(\frac{\color{blue}{\left(x + 1\right)} - \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) \]
      3. +-commutative71.6%

        \[\leadsto \left(\frac{\color{blue}{\left(1 + x\right)} - \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) \]
      4. add-sqr-sqrt85.5%

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

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

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

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

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

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

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

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

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

Alternative 6: 92.7% accurate, 1.6× speedup?

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

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


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

    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. +-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) \]
      3. +-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) \]
      4. +-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 x around 0 51.7%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Step-by-step derivation
      1. flip--51.7%

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

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

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

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

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

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

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

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

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

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

    if 1.1e9 < y

    1. Initial program 84.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+84.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. +-commutative84.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) \]
      3. +-commutative84.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) \]
      4. +-commutative84.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. Simplified84.9%

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

        \[\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. add-sqr-sqrt69.6%

        \[\leadsto \left(\frac{\color{blue}{\left(x + 1\right)} - \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) \]
      3. +-commutative69.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 92.5% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+97.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. +-commutative97.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) \]
      3. +-commutative97.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) \]
      4. +-commutative97.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. Simplified97.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. Taylor expanded in x around 0 97.4%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Step-by-step derivation
      1. flip--97.4%

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999939e-12 < x

    1. Initial program 86.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+86.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. +-commutative86.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) \]
      3. +-commutative86.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) \]
      4. +-commutative86.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. Simplified86.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--86.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. add-sqr-sqrt56.6%

        \[\leadsto \left(\frac{\color{blue}{\left(x + 1\right)} - \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) \]
      3. +-commutative56.6%

        \[\leadsto \left(\frac{\color{blue}{\left(1 + x\right)} - \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) \]
      4. add-sqr-sqrt86.8%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 91.4% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+97.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. +-commutative97.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) \]
      3. +-commutative97.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) \]
      4. +-commutative97.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. Simplified97.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. Taylor expanded in x around 0 97.4%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Step-by-step derivation
      1. flip--97.4%

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

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

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

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

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

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

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

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

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

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

    if 9.19999999999999957e-12 < x

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 7.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+9.0%

        \[\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)} \]
      2. +-commutative9.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr5.3%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt11.0%

        \[\leadsto \frac{1 + \left(x - \color{blue}{x}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      5. sub-neg11.0%

        \[\leadsto \frac{1 + \left(x - x\right)}{\color{blue}{\sqrt{1 + x} + \left(-\left(-\sqrt{x}\right)\right)}} \]
      6. remove-double-neg11.0%

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

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

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

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

Alternative 9: 90.3% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. associate-+l+97.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. +-commutative97.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) \]
      3. +-commutative97.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) \]
      4. +-commutative97.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. Simplified97.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. Taylor expanded in x around 0 97.4%

      \[\leadsto \left(\color{blue}{\left(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) \]
    6. Taylor expanded in t around inf 54.5%

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

    if 9.99999999999999939e-12 < x

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 7.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+9.0%

        \[\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)} \]
      2. +-commutative9.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr5.3%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt11.0%

        \[\leadsto \frac{1 + \left(x - \color{blue}{x}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      5. sub-neg11.0%

        \[\leadsto \frac{1 + \left(x - x\right)}{\color{blue}{\sqrt{1 + x} + \left(-\left(-\sqrt{x}\right)\right)}} \]
      6. remove-double-neg11.0%

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

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

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

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

Alternative 10: 89.9% accurate, 1.9× speedup?

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

\mathbf{elif}\;y \leq 8 \cdot 10^{+14}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(0.5 \cdot \sqrt{\frac{1}{z}} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\

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


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

    1. Initial program 97.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 24.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+28.4%

        \[\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)} \]
      2. +-commutative28.4%

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

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

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

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

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

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

      \[\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. Taylor expanded in y around 0 19.3%

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

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

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

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

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

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

    if 7.99999999999999968e-23 < y < 8e14

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8e14 < y

    1. Initial program 84.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. +-commutative84.9%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 3.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+18.7%

        \[\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)} \]
      2. +-commutative18.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr18.6%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt23.4%

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

        \[\leadsto \frac{1 + \left(x - x\right)}{\color{blue}{\sqrt{1 + x} + \left(-\left(-\sqrt{x}\right)\right)}} \]
      6. remove-double-neg23.4%

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

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

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

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

Alternative 11: 85.1% accurate, 2.0× speedup?

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

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.3%

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

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

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

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

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

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

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

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

    if 5.5e5 < z

    1. Initial program 84.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative20.7%

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

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

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

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

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

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

      \[\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. Taylor expanded in z around inf 15.7%

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

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

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

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

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

Alternative 12: 82.1% accurate, 2.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\sqrt{x + 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 < 0.209999999999999992

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(3 + \color{blue}{z \cdot 0.5}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
    12. Simplified16.2%

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

    if 0.209999999999999992 < z

    1. Initial program 84.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. +-commutative84.5%

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative21.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 0.21:\\ \;\;\;\;\left(3 + 0.5 \cdot z\right) - \left(\sqrt{x} + \left(\sqrt{z} + \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 13: 84.0% accurate, 2.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 6200000000:\\ \;\;\;\;\sqrt{1 + z} + \left(2 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 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
 (if (<= z 6200000000.0)
   (+ (sqrt (+ 1.0 z)) (- 2.0 (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
   (+ (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) {
	double tmp;
	if (z <= 6200000000.0) {
		tmp = sqrt((1.0 + z)) + (2.0 - (sqrt(y) + (sqrt(x) + sqrt(z))));
	} else {
		tmp = sqrt((x + 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) :: tmp
    if (z <= 6200000000.0d0) then
        tmp = sqrt((1.0d0 + z)) + (2.0d0 - (sqrt(y) + (sqrt(x) + sqrt(z))))
    else
        tmp = sqrt((x + 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 tmp;
	if (z <= 6200000000.0) {
		tmp = Math.sqrt((1.0 + z)) + (2.0 - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
	} else {
		tmp = Math.sqrt((x + 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):
	tmp = 0
	if z <= 6200000000.0:
		tmp = math.sqrt((1.0 + z)) + (2.0 - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))))
	else:
		tmp = math.sqrt((x + 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)
	tmp = 0.0
	if (z <= 6200000000.0)
		tmp = Float64(sqrt(Float64(1.0 + z)) + Float64(2.0 - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))));
	else
		tmp = Float64(sqrt(Float64(x + 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)
	tmp = 0.0;
	if (z <= 6200000000.0)
		tmp = sqrt((1.0 + z)) + (2.0 - (sqrt(y) + (sqrt(x) + sqrt(z))));
	else
		tmp = sqrt((x + 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_] := If[LessEqual[z, 6200000000.0], N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6200000000:\\
\;\;\;\;\sqrt{1 + z} + \left(2 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x + 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 < 6.2e9

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.2e9 < z

    1. Initial program 84.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative20.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 6200000000:\\ \;\;\;\;\sqrt{1 + z} + \left(2 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\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 14: 84.0% accurate, 2.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 5000000000:\\ \;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 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
 (if (<= z 5000000000.0)
   (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt z) (sqrt y))))
   (+ (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) {
	double tmp;
	if (z <= 5000000000.0) {
		tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(z) + sqrt(y)));
	} else {
		tmp = sqrt((x + 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) :: tmp
    if (z <= 5000000000.0d0) then
        tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(z) + sqrt(y)))
    else
        tmp = sqrt((x + 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 tmp;
	if (z <= 5000000000.0) {
		tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(z) + Math.sqrt(y)));
	} else {
		tmp = Math.sqrt((x + 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):
	tmp = 0
	if z <= 5000000000.0:
		tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(z) + math.sqrt(y)))
	else:
		tmp = math.sqrt((x + 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)
	tmp = 0.0
	if (z <= 5000000000.0)
		tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(z) + sqrt(y))));
	else
		tmp = Float64(sqrt(Float64(x + 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)
	tmp = 0.0;
	if (z <= 5000000000.0)
		tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(z) + sqrt(y)));
	else
		tmp = sqrt((x + 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_] := If[LessEqual[z, 5000000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5000000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x + 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 < 5e9

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.3%

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

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

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

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

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

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

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

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

    if 5e9 < z

    1. Initial program 84.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative20.7%

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

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

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

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

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

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

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

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

\mathbf{elif}\;z \leq 10^{+143}:\\
\;\;\;\;t\_1 + \left(1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.0%

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

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

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

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

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

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

      \[\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. Taylor expanded in z around 0 17.3%

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

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

    if 3.0499999999999998 < z < 1e143

    1. Initial program 81.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 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+22.8%

        \[\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)} \]
      2. +-commutative22.8%

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

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

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

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

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

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

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

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

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

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

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

    if 1e143 < z

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative20.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr20.5%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt26.2%

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

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

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

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

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

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

Alternative 16: 71.5% accurate, 2.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.8:\\ \;\;\;\;\left(2 + \left(t\_1 + 0.5 \cdot z\right)\right) - \sqrt{z}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+143}:\\ \;\;\;\;\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 y))))
   (if (<= z 2.8)
     (- (+ 2.0 (+ t_1 (* 0.5 z))) (sqrt z))
     (if (<= z 1.55e+143)
       (- (+ 1.0 t_1) (+ (sqrt x) (sqrt y)))
       (/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ x 1.0))))))))
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.8) {
		tmp = (2.0 + (t_1 + (0.5 * z))) - sqrt(z);
	} else if (z <= 1.55e+143) {
		tmp = (1.0 + t_1) - (sqrt(x) + sqrt(y));
	} else {
		tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((x + 1.0)));
	}
	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.8d0) then
        tmp = (2.0d0 + (t_1 + (0.5d0 * z))) - sqrt(z)
    else if (z <= 1.55d+143) then
        tmp = (1.0d0 + t_1) - (sqrt(x) + sqrt(y))
    else
        tmp = (1.0d0 + (x - x)) / (sqrt(x) + sqrt((x + 1.0d0)))
    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.8) {
		tmp = (2.0 + (t_1 + (0.5 * z))) - Math.sqrt(z);
	} else if (z <= 1.55e+143) {
		tmp = (1.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y));
	} else {
		tmp = (1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
	}
	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.8:
		tmp = (2.0 + (t_1 + (0.5 * z))) - math.sqrt(z)
	elif z <= 1.55e+143:
		tmp = (1.0 + t_1) - (math.sqrt(x) + math.sqrt(y))
	else:
		tmp = (1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((x + 1.0)))
	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.8)
		tmp = Float64(Float64(2.0 + Float64(t_1 + Float64(0.5 * z))) - sqrt(z));
	elseif (z <= 1.55e+143)
		tmp = Float64(Float64(1.0 + t_1) - Float64(sqrt(x) + sqrt(y)));
	else
		tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(x + 1.0))));
	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.8)
		tmp = (2.0 + (t_1 + (0.5 * z))) - sqrt(z);
	elseif (z <= 1.55e+143)
		tmp = (1.0 + t_1) - (sqrt(x) + sqrt(y));
	else
		tmp = (1.0 + (x - x)) / (sqrt(x) + sqrt((x + 1.0)));
	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.8], N[(N[(2.0 + N[(t$95$1 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e+143], N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $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.8:\\
\;\;\;\;\left(2 + \left(t\_1 + 0.5 \cdot z\right)\right) - \sqrt{z}\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{+143}:\\
\;\;\;\;\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.0%

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

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

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

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

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

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

      \[\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. Taylor expanded in z around 0 17.3%

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

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

    if 2.7999999999999998 < z < 1.54999999999999995e143

    1. Initial program 81.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 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+22.8%

        \[\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)} \]
      2. +-commutative22.8%

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

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

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

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

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

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

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

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

    if 1.54999999999999995e143 < z

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative20.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr20.5%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt26.2%

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

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

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

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

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

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

Alternative 17: 71.5% accurate, 2.6× speedup?

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

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

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


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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(3 + \color{blue}{z \cdot 0.5}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right) \]
    12. Simplified16.2%

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

    if 1.5 < z < 1.2600000000000001e143

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+22.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)} \]
      2. +-commutative22.9%

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

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

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

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

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

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

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

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

    if 1.2600000000000001e143 < z

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative20.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr20.5%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt26.2%

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

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

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

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

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

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

Alternative 18: 54.2% accurate, 3.8× speedup?

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

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.0%

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

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

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

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

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

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

      \[\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. Taylor expanded in z around 0 17.3%

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

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

    if 2.7999999999999998 < z

    1. Initial program 84.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. +-commutative84.5%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 4.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.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)} \]
      2. +-commutative21.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    12. Applied egg-rr20.1%

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

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

Alternative 19: 59.0% accurate, 3.8× speedup?

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

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


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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative25.0%

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

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

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

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

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

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

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

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

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

    if 1.94999999999999996 < z

    1. Initial program 84.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. +-commutative84.5%

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

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

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

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

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

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

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

        \[\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)} \]
      2. +-commutative21.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + x\right) - \color{blue}{{\left(-\sqrt{x}\right)}^{2}}}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
    12. Applied egg-rr20.3%

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

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

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

        \[\leadsto \frac{1 + \left(x - \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)}{\sqrt{1 + x} - \left(-\sqrt{x}\right)} \]
      4. rem-square-sqrt25.1%

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

        \[\leadsto \frac{1 + \left(x - x\right)}{\color{blue}{\sqrt{1 + x} + \left(-\left(-\sqrt{x}\right)\right)}} \]
      6. remove-double-neg25.1%

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

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

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

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

Alternative 20: 40.4% accurate, 3.9× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    12. Applied egg-rr26.7%

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

    if 6e7 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(1 + x\right)}^{0.5}} + \left(-\sqrt{x}\right) \]
      2. pow-to-exp4.9%

        \[\leadsto \color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
      3. log1p-define4.9%

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5} + \left(-\sqrt{x}\right) \]
    12. Applied egg-rr4.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
    13. Taylor expanded in x around inf 9.9%

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

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

Alternative 21: 40.1% accurate, 6.9× speedup?

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

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


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

    1. Initial program 97.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 21.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+39.4%

        \[\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)} \]
      2. +-commutative39.4%

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

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified39.4%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg26.2%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Taylor expanded in x around 0 26.2%

      \[\leadsto \color{blue}{\left(1 + x \cdot \left(0.5 + x \cdot \left(0.0625 \cdot x - 0.125\right)\right)\right) - \sqrt{x}} \]

    if 1.30000000000000004 < x

    1. Initial program 85.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.9%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-84.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-61.9%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-46.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 7.2%

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+9.0%

        \[\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)} \]
      2. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified9.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Step-by-step derivation
      1. pow1/24.6%

        \[\leadsto \color{blue}{{\left(1 + x\right)}^{0.5}} + \left(-\sqrt{x}\right) \]
      2. pow-to-exp6.0%

        \[\leadsto \color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
      3. log1p-define6.0%

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5} + \left(-\sqrt{x}\right) \]
    12. Applied egg-rr6.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
    13. Taylor expanded in x around inf 10.4%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification17.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.3:\\ \;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 40.1% accurate, 7.1× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 0.9:\\ \;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= x 0.9)
   (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x)))
   (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 0.9) {
		tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
	} else {
		tmp = 0.5 * sqrt((1.0 / x));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= 0.9d0) then
        tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
    else
        tmp = 0.5d0 * sqrt((1.0d0 / x))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 0.9) {
		tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
	} else {
		tmp = 0.5 * Math.sqrt((1.0 / x));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if x <= 0.9:
		tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x))
	else:
		tmp = 0.5 * math.sqrt((1.0 / x))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (x <= 0.9)
		tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x)));
	else
		tmp = Float64(0.5 * sqrt(Float64(1.0 / x)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= 0.9)
		tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
	else
		tmp = 0.5 * sqrt((1.0 / x));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[x, 0.9], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.9:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.900000000000000022

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative97.4%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+97.4%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-64.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-62.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-58.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified37.7%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 21.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+39.4%

        \[\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)} \]
      2. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified39.4%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg26.2%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Taylor expanded in x around 0 26.2%

      \[\leadsto \color{blue}{\left(1 + x \cdot \left(0.5 + -0.125 \cdot x\right)\right) - \sqrt{x}} \]
    12. Step-by-step derivation
      1. associate--l+26.2%

        \[\leadsto \color{blue}{1 + \left(x \cdot \left(0.5 + -0.125 \cdot x\right) - \sqrt{x}\right)} \]
      2. *-commutative26.2%

        \[\leadsto 1 + \left(x \cdot \left(0.5 + \color{blue}{x \cdot -0.125}\right) - \sqrt{x}\right) \]
    13. Simplified26.2%

      \[\leadsto \color{blue}{1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)} \]

    if 0.900000000000000022 < x

    1. Initial program 85.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.9%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-84.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-61.9%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-46.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 7.2%

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+9.0%

        \[\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)} \]
      2. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified9.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Step-by-step derivation
      1. pow1/24.6%

        \[\leadsto \color{blue}{{\left(1 + x\right)}^{0.5}} + \left(-\sqrt{x}\right) \]
      2. pow-to-exp6.0%

        \[\leadsto \color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
      3. log1p-define6.0%

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5} + \left(-\sqrt{x}\right) \]
    12. Applied egg-rr6.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
    13. Taylor expanded in x around inf 10.4%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification17.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.9:\\ \;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 40.0% accurate, 7.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= x 1.0) (+ 1.0 (- (* x 0.5) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 1.0) {
		tmp = 1.0 + ((x * 0.5) - sqrt(x));
	} else {
		tmp = 0.5 * sqrt((1.0 / x));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= 1.0d0) then
        tmp = 1.0d0 + ((x * 0.5d0) - sqrt(x))
    else
        tmp = 0.5d0 * sqrt((1.0d0 / x))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 1.0) {
		tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
	} else {
		tmp = 0.5 * Math.sqrt((1.0 / x));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if x <= 1.0:
		tmp = 1.0 + ((x * 0.5) - math.sqrt(x))
	else:
		tmp = 0.5 * math.sqrt((1.0 / x))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (x <= 1.0)
		tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x)));
	else
		tmp = Float64(0.5 * sqrt(Float64(1.0 / x)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= 1.0)
		tmp = 1.0 + ((x * 0.5) - sqrt(x));
	else
		tmp = 0.5 * sqrt((1.0 / x));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[x, 1.0], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative97.4%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+97.4%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-64.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-62.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-58.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified37.7%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 21.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+39.4%

        \[\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)} \]
      2. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified39.4%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg26.2%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Taylor expanded in x around 0 26.2%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot x\right) - \sqrt{x}} \]
    12. Step-by-step derivation
      1. associate--l+26.2%

        \[\leadsto \color{blue}{1 + \left(0.5 \cdot x - \sqrt{x}\right)} \]
      2. *-commutative26.2%

        \[\leadsto 1 + \left(\color{blue}{x \cdot 0.5} - \sqrt{x}\right) \]
    13. Simplified26.2%

      \[\leadsto \color{blue}{1 + \left(x \cdot 0.5 - \sqrt{x}\right)} \]

    if 1 < x

    1. Initial program 85.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.9%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-84.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-61.9%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-46.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 7.2%

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+9.0%

        \[\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)} \]
      2. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified9.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Step-by-step derivation
      1. pow1/24.6%

        \[\leadsto \color{blue}{{\left(1 + x\right)}^{0.5}} + \left(-\sqrt{x}\right) \]
      2. pow-to-exp6.0%

        \[\leadsto \color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
      3. log1p-define6.0%

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5} + \left(-\sqrt{x}\right) \]
    12. Applied egg-rr6.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
    13. Taylor expanded in x around inf 10.4%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification17.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 39.7% accurate, 7.5× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 0.27:\\ \;\;\;\;1 - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= x 0.27) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 0.27) {
		tmp = 1.0 - sqrt(x);
	} else {
		tmp = 0.5 * sqrt((1.0 / x));
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= 0.27d0) then
        tmp = 1.0d0 - sqrt(x)
    else
        tmp = 0.5d0 * sqrt((1.0d0 / x))
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 0.27) {
		tmp = 1.0 - Math.sqrt(x);
	} else {
		tmp = 0.5 * Math.sqrt((1.0 / x));
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if x <= 0.27:
		tmp = 1.0 - math.sqrt(x)
	else:
		tmp = 0.5 * math.sqrt((1.0 / x))
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (x <= 0.27)
		tmp = Float64(1.0 - sqrt(x));
	else
		tmp = Float64(0.5 * sqrt(Float64(1.0 / x)));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= 0.27)
		tmp = 1.0 - sqrt(x);
	else
		tmp = 0.5 * sqrt((1.0 / x));
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[x, 0.27], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.27:\\
\;\;\;\;1 - \sqrt{x}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.27000000000000002

    1. Initial program 97.4%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative97.4%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+97.4%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-64.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-62.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-58.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified37.7%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 21.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+39.4%

        \[\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)} \]
      2. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative39.4%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified39.4%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg26.2%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified26.2%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Taylor expanded in x around 0 26.2%

      \[\leadsto \color{blue}{1 - \sqrt{x}} \]

    if 0.27000000000000002 < x

    1. Initial program 85.9%

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. +-commutative85.9%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
      2. associate-+r+85.9%

        \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
      3. associate-+r-84.3%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      4. associate-+l-61.9%

        \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
      5. associate-+r-46.6%

        \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. Simplified47.0%

      \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 7.2%

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+9.0%

        \[\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)} \]
      2. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
      3. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
      4. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
      5. associate-+l+9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
      6. +-commutative9.0%

        \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
    7. Simplified9.0%

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
    8. Taylor expanded in x around inf 4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. mul-1-neg4.6%

        \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    10. Simplified4.6%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
    11. Step-by-step derivation
      1. pow1/24.6%

        \[\leadsto \color{blue}{{\left(1 + x\right)}^{0.5}} + \left(-\sqrt{x}\right) \]
      2. pow-to-exp6.0%

        \[\leadsto \color{blue}{e^{\log \left(1 + x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
      3. log1p-define6.0%

        \[\leadsto e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5} + \left(-\sqrt{x}\right) \]
    12. Applied egg-rr6.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot 0.5}} + \left(-\sqrt{x}\right) \]
    13. Taylor expanded in x around inf 10.4%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification17.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.27:\\ \;\;\;\;1 - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 25: 34.5% accurate, 8.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ 1 - \sqrt{x} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(1.0 - sqrt(x))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Derivation
  1. Initial program 91.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. +-commutative91.3%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. associate-+r+91.3%

      \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. associate-+r-74.9%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-62.1%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. associate-+r-52.4%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
  3. Simplified42.7%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 13.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+23.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)} \]
    2. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
    3. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
    4. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
    5. associate-+l+23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
    6. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
  7. Simplified23.2%

    \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
  8. Taylor expanded in x around inf 14.7%

    \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
  9. Step-by-step derivation
    1. mul-1-neg14.7%

      \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
  10. Simplified14.7%

    \[\leadsto \sqrt{1 + x} + \color{blue}{\left(-\sqrt{x}\right)} \]
  11. Taylor expanded in x around 0 13.0%

    \[\leadsto \color{blue}{1 - \sqrt{x}} \]
  12. Final simplification13.0%

    \[\leadsto 1 - \sqrt{x} \]
  13. Add Preprocessing

Alternative 26: 1.9% accurate, 8.1× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ -\sqrt{x} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(-sqrt(x))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Derivation
  1. Initial program 91.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. +-commutative91.3%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. associate-+r+91.3%

      \[\leadsto \color{blue}{\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
    3. associate-+r-74.9%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \sqrt{y}\right)} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    4. associate-+l-62.1%

      \[\leadsto \left(\sqrt{z + 1} - \sqrt{z}\right) + \color{blue}{\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)} \]
    5. associate-+r-52.4%

      \[\leadsto \color{blue}{\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \sqrt{y + 1}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)} \]
  3. Simplified42.7%

    \[\leadsto \color{blue}{\sqrt{1 + y} + \left(\left(\sqrt{1 + z} + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in t around inf 13.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+23.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)} \]
    2. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\color{blue}{\left(\sqrt{1 + z} + \sqrt{1 + y}\right)} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right) \]
    3. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)}\right) \]
    4. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\color{blue}{\left(\sqrt{z} + \sqrt{y}\right)} + \sqrt{x}\right)\right) \]
    5. associate-+l+23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \color{blue}{\left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)}\right) \]
    6. +-commutative23.2%

      \[\leadsto \sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \color{blue}{\left(\sqrt{x} + \sqrt{y}\right)}\right)\right) \]
  7. Simplified23.2%

    \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + z} + \sqrt{1 + y}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)} \]
  8. Taylor expanded in x around 0 10.9%

    \[\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. Taylor expanded in x around inf 1.6%

    \[\leadsto \color{blue}{-1 \cdot \sqrt{x}} \]
  10. Step-by-step derivation
    1. neg-mul-11.6%

      \[\leadsto \color{blue}{-\sqrt{x}} \]
  11. Simplified1.6%

    \[\leadsto \color{blue}{-\sqrt{x}} \]
  12. Final simplification1.6%

    \[\leadsto -\sqrt{x} \]
  13. Add Preprocessing

Developer target: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+
  (+
   (+
    (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
    (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
   (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
  (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
	return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
	return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t):
	return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t)))
end
function tmp = code(x, y, z, t)
	tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}

Reproduce

?
herbie shell --seed 2024076 
(FPCore (x y z t)
  :name "Main:z from "
  :precision binary64

  :alt
  (+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))

  (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))