| Alternative 1 | |
|---|---|
| Error | 1.6 |
| Cost | 78788 |
(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}
Results
| Original | 5.3 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.20000000000000001Initial program 13.5
Simplified13.5
[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)
\] |
Applied egg-rr13.5
Applied egg-rr4.7
Simplified4.7
[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)
\] |
Applied egg-rr3.4
Simplified0.6
[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)
\] |
Applied egg-rr0.6
Simplified0.6
[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)) Initial program 1.6
Simplified1.6
[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)
\] |
Applied egg-rr0.5
Simplified0.5
[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)
\] |
Applied egg-rr0.1
Simplified0.1
[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)
\] |
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 1.6 |
| Cost | 78788 |
| Alternative 2 | |
|---|---|
| Error | 1.5 |
| Cost | 78788 |
| Alternative 3 | |
|---|---|
| Error | 1.1 |
| Cost | 66112 |
| Alternative 4 | |
|---|---|
| Error | 2.6 |
| Cost | 65728 |
| Alternative 5 | |
|---|---|
| Error | 1.5 |
| Cost | 53060 |
| Alternative 6 | |
|---|---|
| Error | 1.8 |
| Cost | 52932 |
| Alternative 7 | |
|---|---|
| Error | 3.6 |
| Cost | 40004 |
| Alternative 8 | |
|---|---|
| Error | 4.0 |
| Cost | 39876 |
| Alternative 9 | |
|---|---|
| Error | 4.4 |
| Cost | 39748 |
| Alternative 10 | |
|---|---|
| Error | 4.1 |
| Cost | 39748 |
| Alternative 11 | |
|---|---|
| Error | 4.8 |
| Cost | 39620 |
| Alternative 12 | |
|---|---|
| Error | 6.2 |
| Cost | 26692 |
| Alternative 13 | |
|---|---|
| Error | 6.5 |
| Cost | 26564 |
| Alternative 14 | |
|---|---|
| Error | 6.9 |
| Cost | 26436 |
| Alternative 15 | |
|---|---|
| Error | 10.2 |
| Cost | 13512 |
| Alternative 16 | |
|---|---|
| Error | 38.4 |
| Cost | 13380 |
| Alternative 17 | |
|---|---|
| Error | 12.5 |
| Cost | 13380 |
| Alternative 18 | |
|---|---|
| Error | 38.8 |
| Cost | 6852 |
| Alternative 19 | |
|---|---|
| Error | 41.8 |
| Cost | 64 |
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))))