?

Average Error: 5.2 → 1.6
Time: 27.7s
Precision: binary64
Cost: 79300

?

\[ \begin{array}{c}[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \end{array} \]
\[\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) \]
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{y} - \sqrt{1 + y}\\ \mathbf{if}\;\left(t_1 - \sqrt{x}\right) - t_2 \leq 0:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 - \left(\sqrt{x} + t_2\right)\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \frac{1}{\sqrt{1 + t} + \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))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (+ x 1.0))) (t_2 (- (sqrt y) (sqrt (+ 1.0 y)))))
   (if (<= (- (- t_1 (sqrt x)) t_2) 0.0)
     (/ 1.0 (+ t_1 (sqrt x)))
     (+
      (- t_1 (+ (sqrt x) t_2))
      (+
       (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
       (/ 1.0 (+ (sqrt (+ 1.0 t)) (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));
}
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((x + 1.0));
	double t_2 = sqrt(y) - sqrt((1.0 + y));
	double tmp;
	if (((t_1 - sqrt(x)) - t_2) <= 0.0) {
		tmp = 1.0 / (t_1 + sqrt(x));
	} else {
		tmp = (t_1 - (sqrt(x) + t_2)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
	}
	return tmp;
}
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
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((x + 1.0d0))
    t_2 = sqrt(y) - sqrt((1.0d0 + y))
    if (((t_1 - sqrt(x)) - t_2) <= 0.0d0) then
        tmp = 1.0d0 / (t_1 + sqrt(x))
    else
        tmp = (t_1 - (sqrt(x) + t_2)) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
    end if
    code = tmp
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));
}
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((x + 1.0));
	double t_2 = Math.sqrt(y) - Math.sqrt((1.0 + y));
	double tmp;
	if (((t_1 - Math.sqrt(x)) - t_2) <= 0.0) {
		tmp = 1.0 / (t_1 + Math.sqrt(x));
	} else {
		tmp = (t_1 - (Math.sqrt(x) + t_2)) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
	}
	return tmp;
}
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))
def code(x, y, z, t):
	t_1 = math.sqrt((x + 1.0))
	t_2 = math.sqrt(y) - math.sqrt((1.0 + y))
	tmp = 0
	if ((t_1 - math.sqrt(x)) - t_2) <= 0.0:
		tmp = 1.0 / (t_1 + math.sqrt(x))
	else:
		tmp = (t_1 - (math.sqrt(x) + t_2)) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))))
	return tmp
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 code(x, y, z, t)
	t_1 = sqrt(Float64(x + 1.0))
	t_2 = Float64(sqrt(y) - sqrt(Float64(1.0 + y)))
	tmp = 0.0
	if (Float64(Float64(t_1 - sqrt(x)) - t_2) <= 0.0)
		tmp = Float64(1.0 / Float64(t_1 + sqrt(x)));
	else
		tmp = Float64(Float64(t_1 - Float64(sqrt(x) + t_2)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))));
	end
	return tmp
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
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((x + 1.0));
	t_2 = sqrt(y) - sqrt((1.0 + y));
	tmp = 0.0;
	if (((t_1 - sqrt(x)) - t_2) <= 0.0)
		tmp = 1.0 / (t_1 + sqrt(x));
	else
		tmp = (t_1 - (sqrt(x) + t_2)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
	end
	tmp_2 = tmp;
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]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], 0.0], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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)
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{y} - \sqrt{1 + y}\\
\mathbf{if}\;\left(t_1 - \sqrt{x}\right) - t_2 \leq 0:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.2
Target0.4
Herbie1.6
\[\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) \]

Derivation?

  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 0.0

    1. Initial program 61.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. Simplified61.1

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

      [Start]61.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) \]

      associate-+l+ [=>]61.8

      \[ \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)} \]

      +-commutative [=>]61.8

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

      associate-+r- [=>]61.8

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

      associate-+l- [=>]61.8

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

      +-commutative [=>]61.8

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

      associate--l+ [=>]61.8

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

      +-commutative [=>]61.8

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

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

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

      [Start]59.8

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

      +-commutative [=>]59.8

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

      associate--l+ [=>]61.8

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

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

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

      [Start]60.1

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

      +-commutative [=>]60.1

      \[ \sqrt{x + 1} + \left(\sqrt{1 + y} - \color{blue}{\left(\sqrt{y} + \sqrt{x}\right)}\right) \]
    7. Taylor expanded in y around inf 61.8

      \[\leadsto \color{blue}{\sqrt{1 + x} - \sqrt{x}} \]
    8. Applied egg-rr9.5

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]
      Proof

      [Start]9.5

      \[ \left(1 + \left(x - x\right)\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}} \]

      +-commutative [=>]9.5

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

      +-inverses [=>]9.5

      \[ \left(\color{blue}{0} + 1\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}} \]

      metadata-eval [=>]9.5

      \[ \color{blue}{1} \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}} \]

      *-lft-identity [=>]9.5

      \[ \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} \]

    if 0.0 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)))

    1. Initial program 2.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. Simplified2.3

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

      [Start]2.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) \]

      associate-+l+ [=>]2.3

      \[ \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)} \]

      associate-+l- [=>]2.3

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

      associate--r- [=>]3.2

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

      remove-double-neg [<=]3.2

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

      associate-+l- [=>]2.3

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

      +-commutative [=>]2.3

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

      remove-double-neg [=>]2.3

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

      sub-neg [=>]2.3

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

      sub-neg [<=]2.3

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

      +-commutative [=>]2.3

      \[ \left(\sqrt{x + 1} - \left(\sqrt{x} - \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) + \left(\left(\sqrt{\color{blue}{1 + z}} - \sqrt{z}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) \]
    3. Applied egg-rr1.5

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

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

      [Start]1.5

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

      +-commutative [=>]1.5

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

      +-inverses [=>]1.5

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

      metadata-eval [=>]1.5

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

      *-lft-identity [=>]1.5

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

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

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

      [Start]1.4

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

      *-commutative [=>]1.4

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

      associate--l+ [=>]1.2

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

      distribute-rgt-in [=>]1.2

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

      +-inverses [=>]1.2

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

      +-inverses [<=]1.2

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

      distribute-rgt-out [=>]1.2

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

      +-commutative [=>]1.2

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

      +-inverses [=>]1.2

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

      metadata-eval [=>]1.2

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

      *-rgt-identity [=>]1.2

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

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

Alternatives

Alternative 1
Error1.5
Cost79428
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + z}\\ t_3 := \sqrt{x + 1}\\ \mathbf{if}\;\left(\left(t_3 - \sqrt{x}\right) - \left(\sqrt{y} - t_1\right)\right) + \left(t_2 - \sqrt{z}\right) \leq 1:\\ \;\;\;\;\frac{1}{t_3 + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{1}{\sqrt{y} + t_1}\right) + \left(\frac{1}{t_2 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\ \end{array} \]
Alternative 2
Error1.8
Cost39880
\[\begin{array}{l} t_1 := \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\ t_2 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 8 \cdot 10^{-46}:\\ \;\;\;\;\left(t_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+15}:\\ \;\;\;\;t_2 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(t_1 - \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_2 + \sqrt{x}}\\ \end{array} \]
Alternative 3
Error2.0
Cost39876
\[\begin{array}{l} \mathbf{if}\;x \leq 10^{-16}:\\ \;\;\;\;\left(1 + \frac{1}{\sqrt{y} + \sqrt{1 + y}}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \left(\sqrt{z} - \sqrt{1 + z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 4
Error1.9
Cost39752
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 2.5 \cdot 10^{-18}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+25}:\\ \;\;\;\;t_1 + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(y - y\right)}{\sqrt{y} + \sqrt{1 + y}} - \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 5
Error1.9
Cost39752
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 6 \cdot 10^{-32}:\\ \;\;\;\;\left(\frac{1}{t_2 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+16}:\\ \;\;\;\;t_1 - \left(\left(\sqrt{x} + \left(\sqrt{z} - t_2\right)\right) + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 6
Error2.7
Cost39748
\[\begin{array}{l} \mathbf{if}\;y \leq 230000000000:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \left(\sqrt{z} - \sqrt{1 + z}\right)\right) + \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 7
Error2.1
Cost33032
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 6 \cdot 10^{-32}:\\ \;\;\;\;\left(\frac{1}{t_1 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 230000000000:\\ \;\;\;\;\left(t_1 - \sqrt{z}\right) + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) + \left(1 - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 8
Error2.5
Cost32904
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 2.2 \cdot 10^{-18}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;t_1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 9
Error2.5
Cost26692
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 2.4 \cdot 10^{-18}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\left(t_1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 10
Error6.7
Cost26568
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 2.7 \cdot 10^{-18}:\\ \;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+15}:\\ \;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 11
Error6.7
Cost26568
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 5.2 \cdot 10^{-18}:\\ \;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\left(t_1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 12
Error3.1
Cost26568
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 2.9 \cdot 10^{-18}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \left(\sqrt{z} - \sqrt{1 + z}\right)\right) + 2\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+15}:\\ \;\;\;\;\left(t_1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 13
Error6.8
Cost20296
\[\begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-18}:\\ \;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) + x \cdot 0.5\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 14
Error6.9
Cost20040
\[\begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-18}:\\ \;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\ \mathbf{elif}\;y \leq 230000000000:\\ \;\;\;\;\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 15
Error6.9
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq 2.7 \cdot 10^{-18}:\\ \;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\ \mathbf{elif}\;y \leq 230000000000:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 16
Error10.1
Cost13380
\[\begin{array}{l} \mathbf{if}\;z \leq 3.1 \cdot 10^{+21}:\\ \;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]
Alternative 17
Error23.1
Cost13248
\[1 + \left(\sqrt{1 + y} - \sqrt{y}\right) \]
Alternative 18
Error41.1
Cost13120
\[\sqrt{x + 1} - \sqrt{x} \]
Alternative 19
Error41.8
Cost64
\[1 \]

Error

Reproduce?

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

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

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