?

Average Error: 8.17% → 0.38%
Time: 28.0s
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{1 + x}\\ t_2 := \sqrt{1 + y}\\ t_3 := t_2 + \sqrt{y}\\ t_4 := t_2 - \sqrt{y}\\ t_5 := \sqrt{x} + t_1\\ \mathbf{if}\;t_4 \leq 0.02:\\ \;\;\;\;\frac{t_5 + t_3 \cdot \left(1 + \left(x - x\right)\right)}{t_3 \cdot t_5}\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + \left(t_4 - \sqrt{x}\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 (+ 1.0 x)))
        (t_2 (sqrt (+ 1.0 y)))
        (t_3 (+ t_2 (sqrt y)))
        (t_4 (- t_2 (sqrt y)))
        (t_5 (+ (sqrt x) t_1)))
   (if (<= t_4 0.02)
     (/ (+ t_5 (* t_3 (+ 1.0 (- x x)))) (* t_3 t_5))
     (+
      (+ t_1 (- t_4 (sqrt x)))
      (+
       (/ 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((1.0 + x));
	double t_2 = sqrt((1.0 + y));
	double t_3 = t_2 + sqrt(y);
	double t_4 = t_2 - sqrt(y);
	double t_5 = sqrt(x) + t_1;
	double tmp;
	if (t_4 <= 0.02) {
		tmp = (t_5 + (t_3 * (1.0 + (x - x)))) / (t_3 * t_5);
	} else {
		tmp = (t_1 + (t_4 - sqrt(x))) + ((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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_1 = sqrt((1.0d0 + x))
    t_2 = sqrt((1.0d0 + y))
    t_3 = t_2 + sqrt(y)
    t_4 = t_2 - sqrt(y)
    t_5 = sqrt(x) + t_1
    if (t_4 <= 0.02d0) then
        tmp = (t_5 + (t_3 * (1.0d0 + (x - x)))) / (t_3 * t_5)
    else
        tmp = (t_1 + (t_4 - sqrt(x))) + ((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((1.0 + x));
	double t_2 = Math.sqrt((1.0 + y));
	double t_3 = t_2 + Math.sqrt(y);
	double t_4 = t_2 - Math.sqrt(y);
	double t_5 = Math.sqrt(x) + t_1;
	double tmp;
	if (t_4 <= 0.02) {
		tmp = (t_5 + (t_3 * (1.0 + (x - x)))) / (t_3 * t_5);
	} else {
		tmp = (t_1 + (t_4 - Math.sqrt(x))) + ((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((1.0 + x))
	t_2 = math.sqrt((1.0 + y))
	t_3 = t_2 + math.sqrt(y)
	t_4 = t_2 - math.sqrt(y)
	t_5 = math.sqrt(x) + t_1
	tmp = 0
	if t_4 <= 0.02:
		tmp = (t_5 + (t_3 * (1.0 + (x - x)))) / (t_3 * t_5)
	else:
		tmp = (t_1 + (t_4 - math.sqrt(x))) + ((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(1.0 + x))
	t_2 = sqrt(Float64(1.0 + y))
	t_3 = Float64(t_2 + sqrt(y))
	t_4 = Float64(t_2 - sqrt(y))
	t_5 = Float64(sqrt(x) + t_1)
	tmp = 0.0
	if (t_4 <= 0.02)
		tmp = Float64(Float64(t_5 + Float64(t_3 * Float64(1.0 + Float64(x - x)))) / Float64(t_3 * t_5));
	else
		tmp = Float64(Float64(t_1 + Float64(t_4 - sqrt(x))) + 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((1.0 + x));
	t_2 = sqrt((1.0 + y));
	t_3 = t_2 + sqrt(y);
	t_4 = t_2 - sqrt(y);
	t_5 = sqrt(x) + t_1;
	tmp = 0.0;
	if (t_4 <= 0.02)
		tmp = (t_5 + (t_3 * (1.0 + (x - x)))) / (t_3 * t_5);
	else
		tmp = (t_1 + (t_4 - sqrt(x))) + ((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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, 0.02], N[(N[(t$95$5 + N[(t$95$3 * N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * t$95$5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $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{1 + x}\\
t_2 := \sqrt{1 + y}\\
t_3 := t_2 + \sqrt{y}\\
t_4 := t_2 - \sqrt{y}\\
t_5 := \sqrt{x} + t_1\\
\mathbf{if}\;t_4 \leq 0.02:\\
\;\;\;\;\frac{t_5 + t_3 \cdot \left(1 + \left(x - x\right)\right)}{t_3 \cdot t_5}\\

\mathbf{else}:\\
\;\;\;\;\left(t_1 + \left(t_4 - \sqrt{x}\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

Original8.17%
Target0.57%
Herbie0.38%
\[\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 y 1)) (sqrt.f64 y)) < 0.0200000000000000004

    1. Initial program 21.19

      \[\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. Simplified93.76

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)} \]
    5. Applied egg-rr21.28

      \[\leadsto \color{blue}{\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\sqrt{x} - \mathsf{hypot}\left(1, \sqrt{x}\right)\right)} \]
    6. Applied egg-rr15.31

      \[\leadsto \color{blue}{\frac{\left(1 + \left(y - y\right)\right) \cdot \left(\sqrt{x} + \sqrt{x + 1}\right) - \left(\sqrt{1 + y} + \sqrt{y}\right) \cdot \left(x - \left(x + 1\right)\right)}{\left(\sqrt{1 + y} + \sqrt{y}\right) \cdot \left(\sqrt{x} + \sqrt{x + 1}\right)}} \]
    7. Simplified0.95

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

      [Start]15.31

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

      +-commutative [=>]15.31

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

      +-inverses [=>]15.31

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

      metadata-eval [=>]15.31

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

      distribute-lft-in [=>]15.31

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

      *-lft-identity [=>]15.31

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

      *-commutative [<=]15.31

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

      +-commutative [=>]15.31

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

      *-commutative [=>]15.31

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

      associate--r+ [=>]0.95

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

      *-commutative [=>]0.95

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

    if 0.0200000000000000004 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))

    1. Initial program 2.48

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

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

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

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

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

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

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

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

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

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

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

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

      \[ \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-rr0.76

      \[\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. Simplified0.76

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

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

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

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

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

      \[ \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-rr0.43

      \[\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. Simplified0.13

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

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

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

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

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

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

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

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

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

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

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

      \[ \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 simplification0.38

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

Alternatives

Alternative 1
Error2.34%
Cost92612
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + x}\\ t_3 := \sqrt{1 + t} - \sqrt{t}\\ t_4 := \sqrt{1 + z}\\ \mathbf{if}\;t_3 + \left(\left(\left(t_1 - \sqrt{y}\right) + \left(t_2 - \sqrt{x}\right)\right) + \left(t_4 - \sqrt{z}\right)\right) \leq 1:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{t_4 + \sqrt{z}} + t_3\right) + \left(1 + \frac{1}{t_1 + \sqrt{y}}\right)\\ \end{array} \]
Alternative 2
Error0.57%
Cost53312
\[\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}}\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
Alternative 3
Error1.59%
Cost53060
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 9.6 \cdot 10^{+42}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(t_1 - \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 4
Error1.81%
Cost52804
\[\begin{array}{l} t_1 := \sqrt{\sqrt{x} + \sqrt{1 + x}}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;x \leq 1.6 \cdot 10^{-45}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \frac{1}{t_2 + \sqrt{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_2 - \sqrt{y}\right) + \frac{1 + \left(x - x\right)}{t_1 \cdot t_1}\\ \end{array} \]
Alternative 5
Error2.96%
Cost39876
\[\begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{+17}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\ \end{array} \]
Alternative 6
Error4.17%
Cost39748
\[\begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{+17}:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\ \end{array} \]
Alternative 7
Error3.12%
Cost33348
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 1.1 \cdot 10^{-12}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\left(2 + y \cdot 0.5\right) - \sqrt{y}\right)\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+42}:\\ \;\;\;\;\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(t_1 - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 8
Error3.55%
Cost26696
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 2.65 \cdot 10^{-24}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + 2\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+41}:\\ \;\;\;\;\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(t_1 - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 9
Error4.6%
Cost26568
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 1.8 \cdot 10^{-24}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + 2\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 10
Error13.76%
Cost26564
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 9.8 \cdot 10^{+14}:\\ \;\;\;\;1 + \left(\sqrt{1 + z} + \left(t_1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(t_1 - \sqrt{y}\right) - \sqrt{x}\right)\\ \end{array} \]
Alternative 11
Error30.39%
Cost26436
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 12
Error30.42%
Cost26436
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;x \leq 36000:\\ \;\;\;\;t_1 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 13
Error30.61%
Cost19908
\[\begin{array}{l} t_1 := \sqrt{1 + x}\\ \mathbf{if}\;y \leq 2 \cdot 10^{+15}:\\ \;\;\;\;t_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + t_1}\\ \end{array} \]
Alternative 14
Error30.49%
Cost19908
\[\begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\ \end{array} \]
Alternative 15
Error38.75%
Cost13380
\[\begin{array}{l} t_1 := \sqrt{1 + x} - \sqrt{x}\\ \mathbf{if}\;y \leq 38:\\ \;\;\;\;1 + t_1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 16
Error30.61%
Cost13380
\[\begin{array}{l} \mathbf{if}\;y \leq 10^{+16}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\ \end{array} \]
Alternative 17
Error35.89%
Cost13248
\[1 + \left(\sqrt{1 + y} - \sqrt{y}\right) \]
Alternative 18
Error64.31%
Cost13120
\[\sqrt{1 + x} - \sqrt{x} \]
Alternative 19
Error65.38%
Cost64
\[1 \]

Error

Reproduce?

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