?

Average Error: 5.3 → 0.3
Time: 28.3s
Precision: binary64
Cost: 78916

?

\[ \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 + z}\\ t_2 := \sqrt{1 + x}\\ t_3 := \sqrt{1 + y}\\ t_4 := t_3 - \sqrt{y}\\ t_5 := \sqrt{1 + t}\\ \mathbf{if}\;t_4 \leq 0.2:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + t_2} + \frac{1}{t_3 + \sqrt{y}}\right)\right) + \left(\left(t_5 - \sqrt{t}\right) + \left(t_1 - \sqrt{z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_2 + \left(t_4 - \sqrt{x}\right)\right) + \left(\frac{1}{t_1 + \sqrt{z}} + \frac{1}{t_5 + \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 z)))
        (t_2 (sqrt (+ 1.0 x)))
        (t_3 (sqrt (+ 1.0 y)))
        (t_4 (- t_3 (sqrt y)))
        (t_5 (sqrt (+ 1.0 t))))
   (if (<= t_4 0.2)
     (+
      (expm1 (log1p (+ (/ 1.0 (+ (sqrt x) t_2)) (/ 1.0 (+ t_3 (sqrt y))))))
      (+ (- t_5 (sqrt t)) (- t_1 (sqrt z))))
     (+
      (+ t_2 (- t_4 (sqrt x)))
      (+ (/ 1.0 (+ t_1 (sqrt z))) (/ 1.0 (+ t_5 (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 + z));
	double t_2 = sqrt((1.0 + x));
	double t_3 = sqrt((1.0 + y));
	double t_4 = t_3 - sqrt(y);
	double t_5 = sqrt((1.0 + t));
	double tmp;
	if (t_4 <= 0.2) {
		tmp = expm1(log1p(((1.0 / (sqrt(x) + t_2)) + (1.0 / (t_3 + sqrt(y)))))) + ((t_5 - sqrt(t)) + (t_1 - sqrt(z)));
	} else {
		tmp = (t_2 + (t_4 - sqrt(x))) + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (t_5 + sqrt(t))));
	}
	return tmp;
}
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 + z));
	double t_2 = Math.sqrt((1.0 + x));
	double t_3 = Math.sqrt((1.0 + y));
	double t_4 = t_3 - Math.sqrt(y);
	double t_5 = Math.sqrt((1.0 + t));
	double tmp;
	if (t_4 <= 0.2) {
		tmp = Math.expm1(Math.log1p(((1.0 / (Math.sqrt(x) + t_2)) + (1.0 / (t_3 + Math.sqrt(y)))))) + ((t_5 - Math.sqrt(t)) + (t_1 - Math.sqrt(z)));
	} else {
		tmp = (t_2 + (t_4 - Math.sqrt(x))) + ((1.0 / (t_1 + Math.sqrt(z))) + (1.0 / (t_5 + 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 + z))
	t_2 = math.sqrt((1.0 + x))
	t_3 = math.sqrt((1.0 + y))
	t_4 = t_3 - math.sqrt(y)
	t_5 = math.sqrt((1.0 + t))
	tmp = 0
	if t_4 <= 0.2:
		tmp = math.expm1(math.log1p(((1.0 / (math.sqrt(x) + t_2)) + (1.0 / (t_3 + math.sqrt(y)))))) + ((t_5 - math.sqrt(t)) + (t_1 - math.sqrt(z)))
	else:
		tmp = (t_2 + (t_4 - math.sqrt(x))) + ((1.0 / (t_1 + math.sqrt(z))) + (1.0 / (t_5 + 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 + z))
	t_2 = sqrt(Float64(1.0 + x))
	t_3 = sqrt(Float64(1.0 + y))
	t_4 = Float64(t_3 - sqrt(y))
	t_5 = sqrt(Float64(1.0 + t))
	tmp = 0.0
	if (t_4 <= 0.2)
		tmp = Float64(expm1(log1p(Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(1.0 / Float64(t_3 + sqrt(y)))))) + Float64(Float64(t_5 - sqrt(t)) + Float64(t_1 - sqrt(z))));
	else
		tmp = Float64(Float64(t_2 + Float64(t_4 - sqrt(x))) + Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(1.0 / Float64(t_5 + sqrt(t)))));
	end
	return 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, 0.2], N[(N[(Exp[N[Log[1 + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] + N[(N[(t$95$5 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$5 + 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 + z}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + y}\\
t_4 := t_3 - \sqrt{y}\\
t_5 := \sqrt{1 + t}\\
\mathbf{if}\;t_4 \leq 0.2:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + t_2} + \frac{1}{t_3 + \sqrt{y}}\right)\right) + \left(\left(t_5 - \sqrt{t}\right) + \left(t_1 - \sqrt{z}\right)\right)\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.3
Target0.4
Herbie0.3
\[\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.20000000000000001

    1. Initial program 13.5

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

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

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

      associate-+l+ [=>]13.5

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

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

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

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

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

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

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

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

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

      \[ \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-rr13.5

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\sqrt{1 + x} - \sqrt{x}\right)\right)\right)} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    4. Applied egg-rr4.7

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\left(1 + \left(x - x\right)\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    5. Simplified4.7

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

      [Start]4.7

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

      +-commutative [=>]4.7

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

      +-inverses [=>]4.7

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

      metadata-eval [=>]4.7

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

      *-lft-identity [=>]4.7

      \[ \mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    6. Applied egg-rr3.4

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(y + \left(1 - y\right)\right) \cdot \frac{1}{\sqrt{1 + y} + \sqrt{y}}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    7. Simplified0.6

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

      [Start]3.4

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

      associate-*r/ [=>]3.4

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

      *-rgt-identity [=>]3.4

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

      associate-+r- [=>]3.4

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

      +-commutative [<=]3.4

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

      associate--l+ [=>]0.6

      \[ \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{1 + \left(y - y\right)}}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    8. Applied egg-rr0.6

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{-1}{\sqrt{1 + y} + \sqrt{y}}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
    9. Simplified0.6

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

      [Start]0.6

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

      associate-*r/ [=>]0.6

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

      metadata-eval [=>]0.6

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

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

    1. Initial program 1.6

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

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

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

      associate-+l+ [=>]1.6

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

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

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

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

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

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

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

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

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

      \[ \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.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. Simplified0.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]0.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 [=>]0.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 [=>]0.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 [=>]0.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 [=>]0.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-rr0.1

      \[\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(1 + \left(t - t\right)\right) \cdot \frac{1}{\sqrt{1 + t} + \sqrt{t}}}\right) \]
    6. Simplified0.1

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

      \[ \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 + \left(t - t\right)\right) \cdot \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) \]

      +-commutative [=>]0.1

      \[ \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(t - t\right) + 1\right)} \cdot \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) \]

      +-inverses [=>]0.1

      \[ \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(\color{blue}{0} + 1\right) \cdot \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) \]

      metadata-eval [=>]0.1

      \[ \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}{1} \cdot \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) \]

      *-lft-identity [=>]0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{1 + y} - \sqrt{y} \leq 0.2:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\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
Error1.6
Cost78788
\[\begin{array}{l} t_1 := \sqrt{1 + t}\\ t_2 := \sqrt{1 + y}\\ t_3 := \sqrt{1 + z}\\ t_4 := \sqrt{1 + x}\\ \mathbf{if}\;\left(t_2 - \sqrt{y}\right) + \left(t_4 - \sqrt{x}\right) \leq 1:\\ \;\;\;\;\left(\left(t_1 - \sqrt{t}\right) + \left(t_3 - \sqrt{z}\right)\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + t_4}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{t_3 + \sqrt{z}} + \frac{1}{t_1 + \sqrt{t}}\right) + \left(\left(1 + t_2\right) - \sqrt{y}\right)\\ \end{array} \]
Alternative 2
Error1.5
Cost78788
\[\begin{array}{l} t_1 := \sqrt{1 + t}\\ t_2 := \sqrt{1 + z}\\ t_3 := \sqrt{1 + x}\\ t_4 := \sqrt{1 + y} - \sqrt{y}\\ \mathbf{if}\;t_3 - \sqrt{x} \leq 0.96:\\ \;\;\;\;\left(\left(t_1 - \sqrt{t}\right) + \left(t_2 - \sqrt{z}\right)\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + t_3} + t_4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_3 + \left(t_4 - \sqrt{x}\right)\right) + \left(\frac{1}{t_2 + \sqrt{z}} + \frac{1}{t_1 + \sqrt{t}}\right)\\ \end{array} \]
Alternative 3
Error1.1
Cost66112
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + \left(y - y\right)}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{\sqrt{x} + \sqrt{1 + x}}\right)\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) \]
Alternative 4
Error2.6
Cost65728
\[\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\right) \]
Alternative 5
Error1.5
Cost53060
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ t_2 := \sqrt{1 + x}\\ t_3 := \sqrt{1 + t}\\ \mathbf{if}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\left(t_2 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\right) + \left(\frac{1}{t_1 + \sqrt{z}} + \frac{1}{t_3 + \sqrt{t}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(t_3 - \sqrt{t}\right) + \left(t_1 - \sqrt{z}\right)\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + t_2}\right)\right)\\ \end{array} \]
Alternative 6
Error1.8
Cost52932
\[\begin{array}{l} t_1 := \sqrt{1 + t} - \sqrt{t}\\ t_2 := \sqrt{1 + x}\\ t_3 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 4.5 \cdot 10^{+15}:\\ \;\;\;\;\left(\frac{1}{t_3 + \sqrt{z}} + t_1\right) + \left(t_2 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + \left(t_3 - \sqrt{z}\right)\right) + \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x} + t_2}\right)\right)\\ \end{array} \]
Alternative 7
Error3.6
Cost40004
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + z}\\ \mathbf{if}\;z \leq 9.2 \cdot 10^{+39}:\\ \;\;\;\;\left(\frac{1}{t_2 + \sqrt{z}} + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) + \left(\left(1 + t_1\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\frac{1}{t_1 + \sqrt{y}} + \left(\left(t_2 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 8
Error4.0
Cost39876
\[\begin{array}{l} t_1 := \sqrt{1 + y}\\ t_2 := \sqrt{1 + z}\\ \mathbf{if}\;z \leq 1.85 \cdot 10^{+39}:\\ \;\;\;\;\left(\frac{1}{t_2 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + t_1\right) - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\frac{1}{t_1 + \sqrt{y}} + \left(\left(t_2 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 9
Error4.4
Cost39748
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;t \leq 1.22 \cdot 10^{+23}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(t_1 + 2\right)\right) - \sqrt{z}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\frac{1}{t_1 + \sqrt{z}} - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 10
Error4.1
Cost39748
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 1.45 \cdot 10^{-36}:\\ \;\;\;\;\left(\frac{1}{t_1 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 11
Error4.8
Cost39620
\[\begin{array}{l} t_1 := \sqrt{1 + z}\\ \mathbf{if}\;y \leq 1.35 \cdot 10^{-36}:\\ \;\;\;\;\left(\frac{1}{t_1 + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} - \left(\left(\sqrt{x} + \left(\sqrt{z} - t_1\right)\right) + \left(\sqrt{y} - \sqrt{1 + y}\right)\right)\\ \end{array} \]
Alternative 12
Error6.2
Cost26692
\[\begin{array}{l} \mathbf{if}\;z \leq 9 \cdot 10^{+29}:\\ \;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + 2\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 13
Error6.5
Cost26564
\[\begin{array}{l} \mathbf{if}\;z \leq 1.2 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + 2\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 14
Error6.9
Cost26436
\[\begin{array}{l} \mathbf{if}\;z \leq 1.3 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(\sqrt{1 + z} + 2\right) + \frac{1}{\sqrt{t} + \left(1 + t \cdot 0.5\right)}\right) - \sqrt{z}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + x} + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\ \end{array} \]
Alternative 15
Error10.2
Cost13512
\[\begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-24}:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+15}:\\ \;\;\;\;\sqrt{1 + y} + \left(1 - \sqrt{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 16
Error38.4
Cost13380
\[\begin{array}{l} \mathbf{if}\;t \leq 7.6:\\ \;\;\;\;2 + \left(2 - \sqrt{t}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\sqrt{1 + z} - \sqrt{z}\right)\\ \end{array} \]
Alternative 17
Error12.5
Cost13380
\[\begin{array}{l} \mathbf{if}\;y \leq 1.5:\\ \;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 18
Error38.8
Cost6852
\[\begin{array}{l} \mathbf{if}\;t \leq 9:\\ \;\;\;\;2 + \left(2 - \sqrt{t}\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 19
Error41.8
Cost64
\[1 \]

Error

Reproduce?

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