?

Average Error: 5.6 → 1.0
Time: 25.6s
Precision: binary64
Cost: 66116

?

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.6
Target0.4
Herbie1.0
\[\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)) < 1e-3

    1. Initial program 57.9

      \[\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right) \]
    2. Simplified60.9

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

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

      associate-+l+ [=>]57.9

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

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

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

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

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

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

      \[ \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 z around inf 59.3

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

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

      [Start]59.3

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

      associate--l+ [=>]57.9

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

      +-commutative [=>]57.9

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

      \[\leadsto \sqrt{x + 1} + \color{blue}{\left(\sqrt{1 + t} - \left(\sqrt{x} + \sqrt{t}\right)\right)} \]
    6. Taylor expanded in t around inf 57.9

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

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

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

      [Start]9.2

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

      +-commutative [=>]9.2

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

      +-inverses [=>]9.2

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

      metadata-eval [=>]9.2

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

      *-lft-identity [=>]9.2

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

    if 1e-3 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x))

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

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

      associate-+l+ [=>]2.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    6. Taylor expanded in y around 0 0.4

      \[\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}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    7. Applied egg-rr0.4

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

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

Alternatives

Alternative 1
Error1.5
Cost66244
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + y}\\ \mathbf{if}\;\left(t_1 - \sqrt{x}\right) + \left(t_2 - \sqrt{y}\right) \leq 1:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\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)\\ \end{array} \]
Alternative 2
Error1.0
Cost66116
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ \mathbf{if}\;t_1 - \sqrt{x} \leq 0.001:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t_1 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 3
Error2.3
Cost39880
\[\begin{array}{l} t_1 := \sqrt{x + 1}\\ t_2 := \sqrt{1 + t}\\ \mathbf{if}\;y \leq 6 \cdot 10^{-26}:\\ \;\;\;\;\left(\left(t_2 - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(1 + \left(t_1 - \sqrt{x}\right)\right)\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{+33}:\\ \;\;\;\;t_1 - \left(\left(\sqrt{x} + \left(\sqrt{t} - t_2\right)\right) + \frac{-1}{\sqrt{1 + y} + \sqrt{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\ \end{array} \]
Alternative 4
Error2.4
Cost39876
\[\begin{array}{l} \mathbf{if}\;y \leq 34500000000000:\\ \;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 5
Error1.9
Cost39876
\[\begin{array}{l} \mathbf{if}\;y \leq 34500000000000:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 6
Error5.0
Cost39748
\[\begin{array}{l} t_1 := \sqrt{1 + t}\\ \mathbf{if}\;z \leq 4.8 \cdot 10^{+23}:\\ \;\;\;\;\left(2 + \left(\sqrt{1 + z} + \frac{1}{t_1 + \sqrt{t}}\right)\right) - \sqrt{z}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - \left(\left(\sqrt{x} + \left(\sqrt{t} - t_1\right)\right) + \frac{-1}{\sqrt{1 + y} + \sqrt{y}}\right)\\ \end{array} \]
Alternative 7
Error2.7
Cost39748
\[\begin{array}{l} \mathbf{if}\;y \leq 34500000000000:\\ \;\;\;\;\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 + 1} + \sqrt{x}}\\ \end{array} \]
Alternative 8
Error5.8
Cost39620
\[\begin{array}{l} t_1 := \sqrt{1 + t}\\ \mathbf{if}\;z \leq 4.8 \cdot 10^{+23}:\\ \;\;\;\;\left(2 + \left(\sqrt{1 + z} + \frac{1}{t_1 + \sqrt{t}}\right)\right) - \sqrt{z}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(t_1 - \sqrt{t}\right) - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 9
Error7.0
Cost26696
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ \mathbf{if}\;z \leq 9 \cdot 10^{-53}:\\ \;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{+23}:\\ \;\;\;\;\sqrt{1 + z} + \left(\left(t_1 + \left(1 - \sqrt{y}\right)\right) - \sqrt{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - \left(\sqrt{y} + \left(\sqrt{x} - t_1\right)\right)\\ \end{array} \]
Alternative 10
Error6.5
Cost26692
\[\begin{array}{l} \mathbf{if}\;z \leq 4.8 \cdot 10^{+23}:\\ \;\;\;\;\left(2 + \left(\sqrt{1 + z} + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\right) - \sqrt{z}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - \left(\sqrt{y} + \left(\sqrt{x} - \sqrt{1 + y}\right)\right)\\ \end{array} \]
Alternative 11
Error9.1
Cost26436
\[\begin{array}{l} \mathbf{if}\;z \leq 0.9:\\ \;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 1} - \left(\sqrt{y} + \left(\sqrt{x} - \sqrt{1 + y}\right)\right)\\ \end{array} \]
Alternative 12
Error24.8
Cost13380
\[\begin{array}{l} t_1 := \sqrt{x + 1} - \sqrt{x}\\ \mathbf{if}\;y \leq 2:\\ \;\;\;\;1 + t_1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error9.2
Cost13380
\[\begin{array}{l} \mathbf{if}\;z \leq 0.34:\\ \;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\ \end{array} \]
Alternative 14
Error23.0
Cost13248
\[1 + \left(\sqrt{1 + y} - \sqrt{y}\right) \]
Alternative 15
Error41.3
Cost13120
\[\sqrt{x + 1} - \sqrt{x} \]
Alternative 16
Error41.7
Cost6848
\[\left(1 + x \cdot 0.5\right) - \sqrt{x} \]
Alternative 17
Error42.0
Cost64
\[1 \]

Error

Reproduce?

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