?

Average Error: 8.87% → 1.06%
Time: 27.8s
Precision: binary64
Cost: 66244

?

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original8.87%
Target0.69%
Herbie1.06%
\[\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 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.40000000000000002

    1. Initial program 87.29

      \[\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. Simplified95.14

      \[\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]87.29

      \[ \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+ [=>]87.29

      \[ \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 [=>]87.29

      \[ \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- [=>]87.29

      \[ \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- [=>]87.29

      \[ \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 [=>]87.29

      \[ \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+ [=>]87.29

      \[ \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 [=>]87.29

      \[ \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 92.39

      \[\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. Simplified87.29

      \[\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]92.39

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

      +-commutative [=>]92.39

      \[ \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+ [=>]87.29

      \[ \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 92.48

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

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

      [Start]92.48

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

      +-commutative [=>]92.48

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

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

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

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

      [Start]14.78

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

      +-commutative [=>]14.78

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

      +-inverses [=>]14.78

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

      metadata-eval [=>]14.78

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

      *-lft-identity [=>]14.78

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

    if 0.40000000000000002 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x))

    1. Initial program 3.32

      \[\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. Simplified3.32

      \[\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]3.32

      \[ \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+ [=>]3.32

      \[ \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- [=>]3.32

      \[ \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- [=>]4.18

      \[ \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 [<=]4.18

      \[ \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- [=>]3.32

      \[ \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 [=>]3.32

      \[ \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 [=>]3.32

      \[ \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 [=>]3.32

      \[ \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 [<=]3.32

      \[ \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 [=>]3.32

      \[ \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-rr2

      \[\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. Simplified2

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

      \[ \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 [=>]2

      \[ \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 [=>]2

      \[ \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 [=>]2

      \[ \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 [=>]2

      \[ \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.75

      \[\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.42

      \[\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.75

      \[ \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.75

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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.42

      \[ \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) \]
    7. Applied egg-rr0.74

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

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

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

Alternatives

Alternative 1
Error2.3%
Cost66116
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;t_1 - \sqrt{x} \leq 0.4:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(t_1 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 2
Error2.49%
Cost53060
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;t_1 - \sqrt{y} \leq 0:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(1 + t_1\right) - \sqrt{y}\right)\\ \end{array} \]
Alternative 3
Error2.38%
Cost39880
\[\begin{array}{l} t_1 := \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\ t_2 := \sqrt{x + 1}\\ \mathbf{if}\;y \leq 3.1 \cdot 10^{-28}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + t_1\right) + 2\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+25}:\\ \;\;\;\;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 4
Error3.19%
Cost39876
\[\begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{+29}:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right) - \left(\frac{-1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{t} - \sqrt{1 + t}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 5
Error4.27%
Cost26824
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 2 \cdot 10^{-89}:\\ \;\;\;\;2 + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t_1 - \sqrt{z}\right)\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+25}:\\ \;\;\;\;1 - \left(\frac{-1}{t_1 + \sqrt{z}} + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 6
Error4.52%
Cost26824
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 10^{-109}:\\ \;\;\;\;2 + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t_1 - \sqrt{z}\right)\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+25}:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) + \frac{1}{t_1 + \sqrt{z}}\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 7
Error2.63%
Cost26824
\[\begin{array}{l} t_1 := \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\ \mathbf{if}\;y \leq 1.05 \cdot 10^{-30}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + t_1\right) + 2\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+25}:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) + t_1\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 8
Error10.47%
Cost26760
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;2 + \left(t_1 + \left(\sqrt{1 + t} - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(t_2 + \left(1 + t_1\right)\right) - {z}^{0.5}\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \left(t_2 - \sqrt{y}\right)\\ \end{array} \]
Alternative 9
Error8.88%
Cost26692
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;t \leq 2.3 \cdot 10^{+15}:\\ \;\;\;\;2 + \left(t_1 + \left(\sqrt{1 + t} - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{-1}{t_1 + \sqrt{z}} + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\ \end{array} \]
Alternative 10
Error10.79%
Cost26564
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;y \leq 4.4 \cdot 10^{-24}:\\ \;\;\;\;1 + \left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+23}:\\ \;\;\;\;\left(1 + t_1\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 11
Error10.67%
Cost26564
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;z \leq 2.55 \cdot 10^{-23}:\\ \;\;\;\;2 + \left(t_1 + \left(\sqrt{1 + t} - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+15}:\\ \;\;\;\;\left(1 + \left(t_1 + \left(1 + y \cdot 0.5\right)\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]
Alternative 12
Error10.81%
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq 1.25 \cdot 10^{-23}:\\ \;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+23}:\\ \;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 13
Error16.27%
Cost13380
\[\begin{array}{l} \mathbf{if}\;z \leq 3.8 \cdot 10^{+15}:\\ \;\;\;\;2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]
Alternative 14
Error16.27%
Cost13380
\[\begin{array}{l} \mathbf{if}\;z \leq 3.8 \cdot 10^{+15}:\\ \;\;\;\;\left(\sqrt{1 + z} + 2\right) - \sqrt{z}\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]
Alternative 15
Error35.58%
Cost13248
\[1 + \left(\sqrt{1 + y} - \sqrt{y}\right) \]
Alternative 16
Error64.43%
Cost13120
\[\sqrt{x + 1} - \sqrt{x} \]
Alternative 17
Error65%
Cost6848
\[\left(1 + x \cdot 0.5\right) - \sqrt{x} \]
Alternative 18
Error65.47%
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023089 
(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))))