Main:z from

Percentage Accurate: 91.8% → 97.9%
Time: 29.0s
Alternatives: 25
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 25 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.8% 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: 97.9% accurate, 0.7× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(t\_1 + e^{-\log \left(\sqrt{1 + y} + \sqrt{y}\right)}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \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)) < 9.9999999999999995e-8

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      4. +-inverses98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      5. metadata-eval98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
    8. Simplified98.5%

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + e^{\color{blue}{-\log \left(\sqrt{1 + y} + \sqrt{y}\right)}}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    10. Applied egg-rr98.5%

      \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \color{blue}{e^{-\log \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. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      4. +-inverses98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      5. metadata-eval98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
    8. Simplified98.5%

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

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

Alternative 3: 97.1% accurate, 0.9× speedup?

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

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


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

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      4. +-inverses98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      5. metadata-eval98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
    8. Simplified98.5%

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

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

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

Alternative 4: 96.0% accurate, 0.9× speedup?

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

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


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

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

      \[\leadsto \left(\color{blue}{\left(\left(1 + 0.5 \cdot x\right) - \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. associate--l+95.1%

        \[\leadsto \left(\color{blue}{\left(1 + \left(0.5 \cdot x - \sqrt{x}\right)\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) \]
      2. *-commutative95.1%

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

      \[\leadsto \left(\color{blue}{\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.2%

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

Alternative 5: 96.4% accurate, 0.9× speedup?

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

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


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

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.6% accurate, 0.9× speedup?

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

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


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

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.3% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\ \;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\ \end{array} \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 (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
   (* 0.5 (+ (+ (fabs (pow x -0.5)) (sqrt (/ 1.0 y))) (sqrt (/ 1.0 z))))
   (+
    (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
    (+ 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 ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
		tmp = 0.5 * ((fabs(pow(x, -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
	} else {
		tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (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 ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
        tmp = 0.5d0 * ((abs((x ** (-0.5d0))) + sqrt((1.0d0 / y))) + sqrt((1.0d0 / z)))
    else
        tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (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 ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
		tmp = 0.5 * ((Math.abs(Math.pow(x, -0.5)) + Math.sqrt((1.0 / y))) + Math.sqrt((1.0 / z)));
	} else {
		tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (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 (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7:
		tmp = 0.5 * ((math.fabs(math.pow(x, -0.5)) + math.sqrt((1.0 / y))) + math.sqrt((1.0 / z)))
	else:
		tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (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 (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7)
		tmp = Float64(0.5 * Float64(Float64(abs((x ^ -0.5)) + sqrt(Float64(1.0 / y))) + sqrt(Float64(1.0 / z))));
	else
		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
		tmp = 0.5 * ((abs((x ^ -0.5)) + sqrt((1.0 / y))) + sqrt((1.0 / z)));
	else
		tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (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[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(0.5 * N[(N[(N[Abs[N[Power[x, -0.5], $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \left(\left(\left|{x}^{-0.5}\right| + \sqrt{\frac{1}{y}}\right) + \sqrt{\frac{1}{z}}\right)\\

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


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

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-8 < (-.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. sub-neg97.4%

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

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

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

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

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

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

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

Alternative 8: 93.3% accurate, 1.3× speedup?

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

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


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

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.05e-32 < z

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      4. +-inverses87.7%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      5. metadata-eval87.7%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
    8. Simplified87.7%

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

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

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

Alternative 9: 92.7% accurate, 1.3× speedup?

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

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


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

    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. sub-neg97.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      4. +-inverses98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      5. metadata-eval98.5%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
    8. Simplified98.5%

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

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

    if 6.4e13 < x

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 92.2% accurate, 1.6× speedup?

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

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


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

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      4. +-inverses98.8%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
      5. metadata-eval98.8%

        \[\leadsto \left(\left(\sqrt{x + 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) \]
    8. Simplified98.8%

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

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

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

    if 102 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 86.3% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.6%

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative97.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. Simplified97.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 t around inf 17.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.1%

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

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 16.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. Step-by-step derivation
      1. associate-+r+16.8%

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

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

    if 1e7 < z

    1. Initial program 83.3%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 86.1% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.6%

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative97.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. Simplified97.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 t around inf 17.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.1%

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

      \[\leadsto \color{blue}{\sqrt{1 + x} + \left(\left(\sqrt{1 + y} + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)} \]
    8. Taylor expanded in x around 0 16.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. Step-by-step derivation
      1. associate-+r+16.8%

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

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

    if 1e7 < z

    1. Initial program 83.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 86.1% accurate, 1.6× speedup?

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

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


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

    1. Initial program 97.6%

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative97.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. Simplified97.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 t around inf 17.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.1%

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

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

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

    if 3.05e7 < z

    1. Initial program 83.3%

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

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

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

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

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

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

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

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

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

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

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

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


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

    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. sub-neg97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \left(\left(\left(\sqrt{1 + y} + \sqrt{1 + x}\right) + z \cdot \left(0.5 + \color{blue}{z \cdot -0.125}\right)\right) - \left(\left(\sqrt{x} + \sqrt{y}\right) + \sqrt{z}\right)\right) \]
      6. associate-+r+40.3%

        \[\leadsto 1 + \left(\left(\left(\sqrt{1 + y} + \sqrt{1 + x}\right) + z \cdot \left(0.5 + z \cdot -0.125\right)\right) - \color{blue}{\left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)}\right) \]
    10. Simplified40.3%

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

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

    if 0.94999999999999996 < z

    1. Initial program 83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 69.4% accurate, 2.0× speedup?

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

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


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

    1. Initial program 97.6%

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative97.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. Simplified97.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 t around inf 21.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+43.6%

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

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

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

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

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

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

    if 2.1e9 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+4.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)} \]
    7. Simplified4.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)} \]
    8. Taylor expanded in z around inf 5.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 69.4% accurate, 2.0× speedup?

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

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


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

    1. Initial program 97.6%

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative97.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. Simplified97.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 t around inf 21.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+43.6%

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

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

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

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

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

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

    if 1.15e9 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+4.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)} \]
    7. Simplified4.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)} \]
    8. Taylor expanded in z around inf 5.4%

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

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

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

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

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

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

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

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

Alternative 17: 40.4% accurate, 2.6× speedup?

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


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

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 110 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 110:\\ \;\;\;\;\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 \left(\sqrt{\frac{1}{x}} + \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 39.7% accurate, 3.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5} \cdot -0.125 + \sqrt{x} \cdot 0.5}{x}\\


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

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.44999999999999996 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. neg-mul-13.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. Taylor expanded in x around inf 7.8%

      \[\leadsto \color{blue}{\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{x}}{x}} \]
    12. Step-by-step derivation
      1. pow17.8%

        \[\leadsto \frac{\color{blue}{{\left(-0.125 \cdot \sqrt{\frac{1}{x}}\right)}^{1}} + 0.5 \cdot \sqrt{x}}{x} \]
      2. pow1/27.8%

        \[\leadsto \frac{{\left(-0.125 \cdot \color{blue}{{\left(\frac{1}{x}\right)}^{0.5}}\right)}^{1} + 0.5 \cdot \sqrt{x}}{x} \]
      3. inv-pow7.8%

        \[\leadsto \frac{{\left(-0.125 \cdot {\color{blue}{\left({x}^{-1}\right)}}^{0.5}\right)}^{1} + 0.5 \cdot \sqrt{x}}{x} \]
      4. pow-pow7.8%

        \[\leadsto \frac{{\left(-0.125 \cdot \color{blue}{{x}^{\left(-1 \cdot 0.5\right)}}\right)}^{1} + 0.5 \cdot \sqrt{x}}{x} \]
      5. metadata-eval7.8%

        \[\leadsto \frac{{\left(-0.125 \cdot {x}^{\color{blue}{-0.5}}\right)}^{1} + 0.5 \cdot \sqrt{x}}{x} \]
    13. Applied egg-rr7.8%

      \[\leadsto \frac{\color{blue}{{\left(-0.125 \cdot {x}^{-0.5}\right)}^{1}} + 0.5 \cdot \sqrt{x}}{x} \]
    14. Step-by-step derivation
      1. unpow17.8%

        \[\leadsto \frac{\color{blue}{-0.125 \cdot {x}^{-0.5}} + 0.5 \cdot \sqrt{x}}{x} \]
    15. Simplified7.8%

      \[\leadsto \frac{\color{blue}{-0.125 \cdot {x}^{-0.5}} + 0.5 \cdot \sqrt{x}}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification18.4%

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

Alternative 19: 39.6% accurate, 3.9× speedup?

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


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

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 4.20000000000000018 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. neg-mul-13.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. Taylor expanded in x around inf 7.8%

      \[\leadsto \color{blue}{\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{x}}{x}} \]
    12. Taylor expanded in x around inf 7.8%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
    13. Step-by-step derivation
      1. unpow-17.8%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1}}} \]
      2. metadata-eval7.8%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -0.5\right)}}} \]
      3. pow-sqr7.8%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-0.5} \cdot {x}^{-0.5}}} \]
      4. rem-sqrt-square7.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-0.5}\right|} \]
    14. Simplified7.8%

      \[\leadsto \color{blue}{0.5 \cdot \left|{x}^{-0.5}\right|} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification18.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.2:\\ \;\;\;\;\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 \left|{x}^{-0.5}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 39.6% accurate, 6.9× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 3.8:\\ \;\;\;\;\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 3.8)
   (- (+ 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 <= 3.8) {
		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 <= 3.8d0) 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 <= 3.8) {
		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 <= 3.8:
		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 <= 3.8)
		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 <= 3.8)
		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, 3.8], 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 3.8:\\
\;\;\;\;\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 < 3.7999999999999998

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 3.7999999999999998 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. neg-mul-13.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. Taylor expanded in x around inf 7.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.8:\\ \;\;\;\;\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 21: 39.5% 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.95:\\ \;\;\;\;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.95)
   (+ 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.95) {
		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.95d0) 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.95) {
		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.95:
		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.95)
		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.95)
		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.95], 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.95:\\
\;\;\;\;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.94999999999999996

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(x \cdot \left(0.5 + -0.125 \cdot x\right) - \sqrt{x}\right)} \]
      2. *-commutative30.6%

        \[\leadsto 1 + \left(x \cdot \left(0.5 + \color{blue}{x \cdot -0.125}\right) - \sqrt{x}\right) \]
    13. Simplified30.6%

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

    if 0.94999999999999996 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. neg-mul-13.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. Taylor expanded in x around inf 7.8%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 22: 39.4% accurate, 7.3× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 9.5:\\ \;\;\;\;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 9.5) (+ 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 <= 9.5) {
		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 <= 9.5d0) 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 <= 9.5) {
		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 <= 9.5:
		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 <= 9.5)
		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 <= 9.5)
		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, 9.5], 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 9.5:\\
\;\;\;\;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 < 9.5

    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. associate-+l+97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 + \left(0.5 \cdot x - \sqrt{x}\right)} \]
      2. *-commutative30.6%

        \[\leadsto 1 + \left(\color{blue}{x \cdot 0.5} - \sqrt{x}\right) \]
    13. Simplified30.6%

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

    if 9.5 < x

    1. Initial program 85.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+85.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. sub-neg85.4%

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative85.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. Simplified85.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 t around inf 3.3%

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

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

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

      \[\leadsto \sqrt{1 + x} + \color{blue}{-1 \cdot \sqrt{x}} \]
    9. Step-by-step derivation
      1. neg-mul-13.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. Taylor expanded in x around inf 7.8%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 23: 39.2% 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.048:\\ \;\;\;\;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.048) (- 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.048) {
		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.048d0) 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.048) {
		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.048:
		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.048)
		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.048)
		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.048], 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.048:\\
\;\;\;\;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.048000000000000001

    1. Initial program 97.6%

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

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

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

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

        \[\leadsto \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
      6. +-commutative97.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. Simplified97.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 t around inf 21.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+44.1%

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

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

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

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

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

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

    if 0.048000000000000001 < x

    1. Initial program 85.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+85.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. sub-neg85.5%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{1 + x} + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)} \]
    6. Step-by-step derivation
      1. associate--l+5.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)} \]
    7. Simplified5.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)} \]
    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. neg-mul-13.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. Taylor expanded in x around inf 7.9%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 24: 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.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 25: 7.6% accurate, 8.1× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)} \]
  4. Add Preprocessing
  5. 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+23.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)} \]
  7. Simplified23.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)} \]
  8. Step-by-step derivation
    1. flip-+20.8%

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

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

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

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

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

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

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

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

Reproduce

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

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

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