
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z 1.0)))
(t_2 (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(t_3 (sqrt (+ t 1.0)))
(t_4 (+ t_3 (sqrt t)))
(t_5 (sqrt (+ x 1.0)))
(t_6 (- t_5 (sqrt x)))
(t_7 (+ t_1 (sqrt z))))
(if (<= t_6 0.99999995)
(+ (+ t_2 (- t_3 (+ (sqrt t) (- (sqrt z) t_1)))) (/ 1.0 (+ t_5 (sqrt x))))
(+ t_6 (+ t_2 (/ (+ t_4 t_7) (* t_4 t_7)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = 1.0 / (sqrt((y + 1.0)) + sqrt(y));
double t_3 = sqrt((t + 1.0));
double t_4 = t_3 + sqrt(t);
double t_5 = sqrt((x + 1.0));
double t_6 = t_5 - sqrt(x);
double t_7 = t_1 + sqrt(z);
double tmp;
if (t_6 <= 0.99999995) {
tmp = (t_2 + (t_3 - (sqrt(t) + (sqrt(z) - t_1)))) + (1.0 / (t_5 + sqrt(x)));
} else {
tmp = t_6 + (t_2 + ((t_4 + t_7) / (t_4 * t_7)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = 1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y))
t_3 = sqrt((t + 1.0d0))
t_4 = t_3 + sqrt(t)
t_5 = sqrt((x + 1.0d0))
t_6 = t_5 - sqrt(x)
t_7 = t_1 + sqrt(z)
if (t_6 <= 0.99999995d0) then
tmp = (t_2 + (t_3 - (sqrt(t) + (sqrt(z) - t_1)))) + (1.0d0 / (t_5 + sqrt(x)))
else
tmp = t_6 + (t_2 + ((t_4 + t_7) / (t_4 * t_7)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double t_2 = 1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y));
double t_3 = Math.sqrt((t + 1.0));
double t_4 = t_3 + Math.sqrt(t);
double t_5 = Math.sqrt((x + 1.0));
double t_6 = t_5 - Math.sqrt(x);
double t_7 = t_1 + Math.sqrt(z);
double tmp;
if (t_6 <= 0.99999995) {
tmp = (t_2 + (t_3 - (Math.sqrt(t) + (Math.sqrt(z) - t_1)))) + (1.0 / (t_5 + Math.sqrt(x)));
} else {
tmp = t_6 + (t_2 + ((t_4 + t_7) / (t_4 * t_7)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = 1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)) t_3 = math.sqrt((t + 1.0)) t_4 = t_3 + math.sqrt(t) t_5 = math.sqrt((x + 1.0)) t_6 = t_5 - math.sqrt(x) t_7 = t_1 + math.sqrt(z) tmp = 0 if t_6 <= 0.99999995: tmp = (t_2 + (t_3 - (math.sqrt(t) + (math.sqrt(z) - t_1)))) + (1.0 / (t_5 + math.sqrt(x))) else: tmp = t_6 + (t_2 + ((t_4 + t_7) / (t_4 * t_7))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y))) t_3 = sqrt(Float64(t + 1.0)) t_4 = Float64(t_3 + sqrt(t)) t_5 = sqrt(Float64(x + 1.0)) t_6 = Float64(t_5 - sqrt(x)) t_7 = Float64(t_1 + sqrt(z)) tmp = 0.0 if (t_6 <= 0.99999995) tmp = Float64(Float64(t_2 + Float64(t_3 - Float64(sqrt(t) + Float64(sqrt(z) - t_1)))) + Float64(1.0 / Float64(t_5 + sqrt(x)))); else tmp = Float64(t_6 + Float64(t_2 + Float64(Float64(t_4 + t_7) / Float64(t_4 * t_7)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
t_2 = 1.0 / (sqrt((y + 1.0)) + sqrt(y));
t_3 = sqrt((t + 1.0));
t_4 = t_3 + sqrt(t);
t_5 = sqrt((x + 1.0));
t_6 = t_5 - sqrt(x);
t_7 = t_1 + sqrt(z);
tmp = 0.0;
if (t_6 <= 0.99999995)
tmp = (t_2 + (t_3 - (sqrt(t) + (sqrt(z) - t_1)))) + (1.0 / (t_5 + sqrt(x)));
else
tmp = t_6 + (t_2 + ((t_4 + t_7) / (t_4 * t_7)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.99999995], N[(N[(t$95$2 + N[(t$95$3 - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$5 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$6 + N[(t$95$2 + N[(N[(t$95$4 + t$95$7), $MachinePrecision] / N[(t$95$4 * t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
t_2 := \frac{1}{\sqrt{y + 1} + \sqrt{y}}\\
t_3 := \sqrt{t + 1}\\
t_4 := t\_3 + \sqrt{t}\\
t_5 := \sqrt{x + 1}\\
t_6 := t\_5 - \sqrt{x}\\
t_7 := t\_1 + \sqrt{z}\\
\mathbf{if}\;t\_6 \leq 0.99999995:\\
\;\;\;\;\left(t\_2 + \left(t\_3 - \left(\sqrt{t} + \left(\sqrt{z} - t\_1\right)\right)\right)\right) + \frac{1}{t\_5 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_6 + \left(t\_2 + \frac{t\_4 + t\_7}{t\_4 \cdot t\_7}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.999999949999999971Initial program 84.0%
associate-+l+84.0%
associate-+l+84.0%
+-commutative84.0%
+-commutative84.0%
associate-+l-65.1%
+-commutative65.1%
+-commutative65.1%
Simplified65.1%
flip--65.5%
div-inv65.5%
add-sqr-sqrt39.3%
+-commutative39.3%
add-sqr-sqrt65.8%
associate--l+69.9%
+-commutative69.9%
Applied egg-rr69.9%
+-inverses69.9%
metadata-eval69.9%
*-lft-identity69.9%
Simplified69.9%
flip--69.9%
div-inv69.9%
add-sqr-sqrt59.6%
add-sqr-sqrt69.9%
associate--l+72.3%
Applied egg-rr72.3%
+-inverses72.3%
metadata-eval72.3%
*-lft-identity72.3%
Simplified72.3%
if 0.999999949999999971 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
associate-+l-74.9%
+-commutative74.9%
+-commutative74.9%
Simplified74.9%
associate--r-97.0%
flip--97.1%
flip--97.1%
frac-add97.1%
Applied egg-rr98.4%
flip--75.0%
div-inv75.0%
add-sqr-sqrt60.7%
add-sqr-sqrt75.0%
associate--l+75.4%
Applied egg-rr99.0%
+-inverses75.4%
metadata-eval75.4%
*-lft-identity75.4%
Simplified99.0%
*-un-lft-identity99.0%
Applied egg-rr99.0%
associate-*r/99.0%
Simplified99.9%
Final simplification85.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (+ (- t_1 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y)))))
(if (<= t_2 0.0)
(/ 1.0 (+ t_1 (sqrt x)))
(+
t_2
(+
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))
(/ 1.0 (+ (sqrt (+ t 1.0)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = (t_1 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y));
double tmp;
if (t_2 <= 0.0) {
tmp = 1.0 / (t_1 + sqrt(x));
} else {
tmp = t_2 + ((1.0 / (sqrt((z + 1.0)) + sqrt(z))) + (1.0 / (sqrt((t + 1.0)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = (t_1 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))
if (t_2 <= 0.0d0) then
tmp = 1.0d0 / (t_1 + sqrt(x))
else
tmp = t_2 + ((1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))) + (1.0d0 / (sqrt((t + 1.0d0)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = (t_1 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y));
double tmp;
if (t_2 <= 0.0) {
tmp = 1.0 / (t_1 + Math.sqrt(x));
} else {
tmp = t_2 + ((1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))) + (1.0 / (Math.sqrt((t + 1.0)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = (t_1 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y)) tmp = 0 if t_2 <= 0.0: tmp = 1.0 / (t_1 + math.sqrt(x)) else: tmp = t_2 + ((1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z))) + (1.0 / (math.sqrt((t + 1.0)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(Float64(t_1 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) + Float64(1.0 / Float64(sqrt(Float64(t + 1.0)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = (t_1 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y));
tmp = 0.0;
if (t_2 <= 0.0)
tmp = 1.0 / (t_1 + sqrt(x));
else
tmp = t_2 + ((1.0 / (sqrt((z + 1.0)) + sqrt(z))) + (1.0 / (sqrt((t + 1.0)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \left(t\_1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(\frac{1}{\sqrt{z + 1} + \sqrt{z}} + \frac{1}{\sqrt{t + 1} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 0.0Initial program 64.8%
associate-+l+64.8%
associate-+l+64.8%
+-commutative64.8%
+-commutative64.8%
associate-+l-45.7%
+-commutative45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in t around inf 29.0%
Taylor expanded in z around inf 3.2%
associate--l+4.7%
+-commutative4.7%
Simplified4.7%
Taylor expanded in y around inf 3.2%
flip--3.2%
add-sqr-sqrt3.1%
add-sqr-sqrt3.2%
Applied egg-rr3.2%
associate--l+14.1%
+-inverses14.1%
metadata-eval14.1%
+-commutative14.1%
Simplified14.1%
if 0.0 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
flip--97.1%
div-inv97.1%
add-sqr-sqrt75.6%
add-sqr-sqrt97.3%
associate--l+97.6%
Applied egg-rr97.6%
+-inverses97.6%
metadata-eval97.6%
*-lft-identity97.6%
Simplified97.6%
flip--97.6%
add-sqr-sqrt77.3%
+-commutative77.3%
add-sqr-sqrt98.1%
associate--l+98.1%
Applied egg-rr98.1%
Taylor expanded in z around 0 98.7%
Final simplification81.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z 1.0)))
(t_2 (sqrt (+ y 1.0)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (+ (- t_3 (sqrt x)) (- t_2 (sqrt y))))
(t_5 (sqrt (+ t 1.0))))
(if (<= t_4 1.5)
(+
(+ (/ 1.0 (+ t_2 (sqrt y))) (- t_5 (+ (sqrt t) (- (sqrt z) t_1))))
(/ 1.0 (+ t_3 (sqrt x))))
(+ t_4 (+ (/ 1.0 (+ t_1 (sqrt z))) (/ 1.0 (+ t_5 (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = sqrt((y + 1.0));
double t_3 = sqrt((x + 1.0));
double t_4 = (t_3 - sqrt(x)) + (t_2 - sqrt(y));
double t_5 = sqrt((t + 1.0));
double tmp;
if (t_4 <= 1.5) {
tmp = ((1.0 / (t_2 + sqrt(y))) + (t_5 - (sqrt(t) + (sqrt(z) - t_1)))) + (1.0 / (t_3 + sqrt(x)));
} else {
tmp = t_4 + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (t_5 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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((z + 1.0d0))
t_2 = sqrt((y + 1.0d0))
t_3 = sqrt((x + 1.0d0))
t_4 = (t_3 - sqrt(x)) + (t_2 - sqrt(y))
t_5 = sqrt((t + 1.0d0))
if (t_4 <= 1.5d0) then
tmp = ((1.0d0 / (t_2 + sqrt(y))) + (t_5 - (sqrt(t) + (sqrt(z) - t_1)))) + (1.0d0 / (t_3 + sqrt(x)))
else
tmp = t_4 + ((1.0d0 / (t_1 + sqrt(z))) + (1.0d0 / (t_5 + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = (t_3 - Math.sqrt(x)) + (t_2 - Math.sqrt(y));
double t_5 = Math.sqrt((t + 1.0));
double tmp;
if (t_4 <= 1.5) {
tmp = ((1.0 / (t_2 + Math.sqrt(y))) + (t_5 - (Math.sqrt(t) + (Math.sqrt(z) - t_1)))) + (1.0 / (t_3 + Math.sqrt(x)));
} else {
tmp = t_4 + ((1.0 / (t_1 + Math.sqrt(z))) + (1.0 / (t_5 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = math.sqrt((y + 1.0)) t_3 = math.sqrt((x + 1.0)) t_4 = (t_3 - math.sqrt(x)) + (t_2 - math.sqrt(y)) t_5 = math.sqrt((t + 1.0)) tmp = 0 if t_4 <= 1.5: tmp = ((1.0 / (t_2 + math.sqrt(y))) + (t_5 - (math.sqrt(t) + (math.sqrt(z) - t_1)))) + (1.0 / (t_3 + math.sqrt(x))) else: tmp = t_4 + ((1.0 / (t_1 + math.sqrt(z))) + (1.0 / (t_5 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(y + 1.0)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(Float64(t_3 - sqrt(x)) + Float64(t_2 - sqrt(y))) t_5 = sqrt(Float64(t + 1.0)) tmp = 0.0 if (t_4 <= 1.5) tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(t_5 - Float64(sqrt(t) + Float64(sqrt(z) - t_1)))) + Float64(1.0 / Float64(t_3 + sqrt(x)))); else tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(1.0 / Float64(t_5 + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
t_2 = sqrt((y + 1.0));
t_3 = sqrt((x + 1.0));
t_4 = (t_3 - sqrt(x)) + (t_2 - sqrt(y));
t_5 = sqrt((t + 1.0));
tmp = 0.0;
if (t_4 <= 1.5)
tmp = ((1.0 / (t_2 + sqrt(y))) + (t_5 - (sqrt(t) + (sqrt(z) - t_1)))) + (1.0 / (t_3 + sqrt(x)));
else
tmp = t_4 + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (t_5 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, 1.5], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + 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]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
t_2 := \sqrt{y + 1}\\
t_3 := \sqrt{x + 1}\\
t_4 := \left(t\_3 - \sqrt{x}\right) + \left(t\_2 - \sqrt{y}\right)\\
t_5 := \sqrt{t + 1}\\
\mathbf{if}\;t\_4 \leq 1.5:\\
\;\;\;\;\left(\frac{1}{t\_2 + \sqrt{y}} + \left(t\_5 - \left(\sqrt{t} + \left(\sqrt{z} - t\_1\right)\right)\right)\right) + \frac{1}{t\_3 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(\frac{1}{t\_1 + \sqrt{z}} + \frac{1}{t\_5 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1.5Initial program 87.9%
associate-+l+87.9%
associate-+l+87.9%
+-commutative87.9%
+-commutative87.9%
associate-+l-67.2%
+-commutative67.2%
+-commutative67.2%
Simplified67.2%
flip--67.5%
div-inv67.5%
add-sqr-sqrt49.5%
+-commutative49.5%
add-sqr-sqrt67.7%
associate--l+70.5%
+-commutative70.5%
Applied egg-rr70.5%
+-inverses70.5%
metadata-eval70.5%
*-lft-identity70.5%
Simplified70.5%
flip--70.5%
div-inv70.5%
add-sqr-sqrt54.5%
add-sqr-sqrt70.5%
associate--l+72.5%
Applied egg-rr72.5%
+-inverses72.5%
metadata-eval72.5%
*-lft-identity72.5%
Simplified72.5%
if 1.5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
flip--97.7%
div-inv97.7%
add-sqr-sqrt84.1%
add-sqr-sqrt98.2%
associate--l+98.8%
Applied egg-rr98.8%
+-inverses98.8%
metadata-eval98.8%
*-lft-identity98.8%
Simplified98.8%
flip--98.8%
add-sqr-sqrt78.3%
+-commutative78.3%
add-sqr-sqrt99.3%
associate--l+99.3%
Applied egg-rr99.3%
Taylor expanded in z around 0 99.9%
Final simplification79.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (- t_2 (sqrt x)))
(t_4 (sqrt (+ z 1.0))))
(if (<= (+ t_3 t_1) 1.9998)
(+ (/ 1.0 (+ t_2 (sqrt x))) (+ (- t_4 (sqrt z)) t_1))
(-
(+ t_3 (- (+ (* y 0.5) 1.0) (sqrt y)))
(+ (/ -1.0 (+ t_4 (sqrt z))) (/ -1.0 (+ (sqrt (+ t 1.0)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((x + 1.0));
double t_3 = t_2 - sqrt(x);
double t_4 = sqrt((z + 1.0));
double tmp;
if ((t_3 + t_1) <= 1.9998) {
tmp = (1.0 / (t_2 + sqrt(x))) + ((t_4 - sqrt(z)) + t_1);
} else {
tmp = (t_3 + (((y * 0.5) + 1.0) - sqrt(y))) - ((-1.0 / (t_4 + sqrt(z))) + (-1.0 / (sqrt((t + 1.0)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((x + 1.0d0))
t_3 = t_2 - sqrt(x)
t_4 = sqrt((z + 1.0d0))
if ((t_3 + t_1) <= 1.9998d0) then
tmp = (1.0d0 / (t_2 + sqrt(x))) + ((t_4 - sqrt(z)) + t_1)
else
tmp = (t_3 + (((y * 0.5d0) + 1.0d0) - sqrt(y))) - (((-1.0d0) / (t_4 + sqrt(z))) + ((-1.0d0) / (sqrt((t + 1.0d0)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((x + 1.0));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = Math.sqrt((z + 1.0));
double tmp;
if ((t_3 + t_1) <= 1.9998) {
tmp = (1.0 / (t_2 + Math.sqrt(x))) + ((t_4 - Math.sqrt(z)) + t_1);
} else {
tmp = (t_3 + (((y * 0.5) + 1.0) - Math.sqrt(y))) - ((-1.0 / (t_4 + Math.sqrt(z))) + (-1.0 / (Math.sqrt((t + 1.0)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((x + 1.0)) t_3 = t_2 - math.sqrt(x) t_4 = math.sqrt((z + 1.0)) tmp = 0 if (t_3 + t_1) <= 1.9998: tmp = (1.0 / (t_2 + math.sqrt(x))) + ((t_4 - math.sqrt(z)) + t_1) else: tmp = (t_3 + (((y * 0.5) + 1.0) - math.sqrt(y))) - ((-1.0 / (t_4 + math.sqrt(z))) + (-1.0 / (math.sqrt((t + 1.0)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(t_2 - sqrt(x)) t_4 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (Float64(t_3 + t_1) <= 1.9998) tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(Float64(t_4 - sqrt(z)) + t_1)); else tmp = Float64(Float64(t_3 + Float64(Float64(Float64(y * 0.5) + 1.0) - sqrt(y))) - Float64(Float64(-1.0 / Float64(t_4 + sqrt(z))) + Float64(-1.0 / Float64(sqrt(Float64(t + 1.0)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((x + 1.0));
t_3 = t_2 - sqrt(x);
t_4 = sqrt((z + 1.0));
tmp = 0.0;
if ((t_3 + t_1) <= 1.9998)
tmp = (1.0 / (t_2 + sqrt(x))) + ((t_4 - sqrt(z)) + t_1);
else
tmp = (t_3 + (((y * 0.5) + 1.0) - sqrt(y))) - ((-1.0 / (t_4 + sqrt(z))) + (-1.0 / (sqrt((t + 1.0)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 + t$95$1), $MachinePrecision], 1.9998], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 + N[(N[(N[(y * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{x + 1}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := \sqrt{z + 1}\\
\mathbf{if}\;t\_3 + t\_1 \leq 1.9998:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}} + \left(\left(t\_4 - \sqrt{z}\right) + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_3 + \left(\left(y \cdot 0.5 + 1\right) - \sqrt{y}\right)\right) - \left(\frac{-1}{t\_4 + \sqrt{z}} + \frac{-1}{\sqrt{t + 1} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1.9998Initial program 88.0%
associate-+l+88.0%
associate-+l+88.0%
+-commutative88.0%
+-commutative88.0%
associate-+l-67.1%
+-commutative67.1%
+-commutative67.1%
Simplified67.1%
Taylor expanded in t around inf 53.0%
flip--67.4%
div-inv67.4%
add-sqr-sqrt49.6%
+-commutative49.6%
add-sqr-sqrt67.6%
associate--l+70.4%
+-commutative70.4%
Applied egg-rr55.8%
+-inverses70.4%
metadata-eval70.4%
*-lft-identity70.4%
Simplified55.8%
if 1.9998 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
flip--97.6%
div-inv97.6%
add-sqr-sqrt85.3%
add-sqr-sqrt98.2%
associate--l+98.8%
Applied egg-rr98.8%
+-inverses98.8%
metadata-eval98.8%
*-lft-identity98.8%
Simplified98.8%
flip--98.8%
add-sqr-sqrt78.9%
+-commutative78.9%
add-sqr-sqrt99.4%
associate--l+99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in z around 0 99.9%
Final simplification66.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ z 1.0))))
(if (<= y 6e-22)
(+
(+ (- t_1 (sqrt x)) (- 1.0 (sqrt y)))
(+
(/ 1.0 (+ (sqrt (+ t 1.0)) (sqrt t)))
(/ (+ z (- 1.0 z)) (+ t_2 (sqrt z)))))
(+
(/ 1.0 (+ t_1 (sqrt x)))
(+ (- t_2 (sqrt z)) (- (sqrt (+ y 1.0)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((z + 1.0));
double tmp;
if (y <= 6e-22) {
tmp = ((t_1 - sqrt(x)) + (1.0 - sqrt(y))) + ((1.0 / (sqrt((t + 1.0)) + sqrt(t))) + ((z + (1.0 - z)) / (t_2 + sqrt(z))));
} else {
tmp = (1.0 / (t_1 + sqrt(x))) + ((t_2 - sqrt(z)) + (sqrt((y + 1.0)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((z + 1.0d0))
if (y <= 6d-22) then
tmp = ((t_1 - sqrt(x)) + (1.0d0 - sqrt(y))) + ((1.0d0 / (sqrt((t + 1.0d0)) + sqrt(t))) + ((z + (1.0d0 - z)) / (t_2 + sqrt(z))))
else
tmp = (1.0d0 / (t_1 + sqrt(x))) + ((t_2 - sqrt(z)) + (sqrt((y + 1.0d0)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((z + 1.0));
double tmp;
if (y <= 6e-22) {
tmp = ((t_1 - Math.sqrt(x)) + (1.0 - Math.sqrt(y))) + ((1.0 / (Math.sqrt((t + 1.0)) + Math.sqrt(t))) + ((z + (1.0 - z)) / (t_2 + Math.sqrt(z))));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + ((t_2 - Math.sqrt(z)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((z + 1.0)) tmp = 0 if y <= 6e-22: tmp = ((t_1 - math.sqrt(x)) + (1.0 - math.sqrt(y))) + ((1.0 / (math.sqrt((t + 1.0)) + math.sqrt(t))) + ((z + (1.0 - z)) / (t_2 + math.sqrt(z)))) else: tmp = (1.0 / (t_1 + math.sqrt(x))) + ((t_2 - math.sqrt(z)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (y <= 6e-22) tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 - sqrt(y))) + Float64(Float64(1.0 / Float64(sqrt(Float64(t + 1.0)) + sqrt(t))) + Float64(Float64(z + Float64(1.0 - z)) / Float64(t_2 + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(Float64(t_2 - sqrt(z)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((z + 1.0));
tmp = 0.0;
if (y <= 6e-22)
tmp = ((t_1 - sqrt(x)) + (1.0 - sqrt(y))) + ((1.0 / (sqrt((t + 1.0)) + sqrt(t))) + ((z + (1.0 - z)) / (t_2 + sqrt(z))));
else
tmp = (1.0 / (t_1 + sqrt(x))) + ((t_2 - sqrt(z)) + (sqrt((y + 1.0)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6e-22], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{z + 1}\\
\mathbf{if}\;y \leq 6 \cdot 10^{-22}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right) + \left(\frac{1}{\sqrt{t + 1} + \sqrt{t}} + \frac{z + \left(1 - z\right)}{t\_2 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(\left(t\_2 - \sqrt{z}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if y < 5.9999999999999998e-22Initial program 97.3%
associate-+l+97.3%
sub-neg97.3%
sub-neg97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
flip--97.6%
div-inv97.6%
add-sqr-sqrt77.0%
add-sqr-sqrt97.9%
associate--l+98.2%
Applied egg-rr98.2%
+-inverses98.2%
metadata-eval98.2%
*-lft-identity98.2%
Simplified98.2%
flip--98.1%
add-sqr-sqrt79.1%
+-commutative79.1%
add-sqr-sqrt98.7%
associate--l+98.7%
Applied egg-rr98.7%
Taylor expanded in y around 0 98.7%
if 5.9999999999999998e-22 < y Initial program 83.7%
associate-+l+83.7%
associate-+l+83.7%
+-commutative83.7%
+-commutative83.7%
associate-+l-61.5%
+-commutative61.5%
+-commutative61.5%
Simplified61.5%
Taylor expanded in t around inf 47.2%
flip--61.6%
div-inv61.6%
add-sqr-sqrt51.8%
+-commutative51.8%
add-sqr-sqrt61.8%
associate--l+65.5%
+-commutative65.5%
Applied egg-rr51.2%
+-inverses65.5%
metadata-eval65.5%
*-lft-identity65.5%
Simplified51.2%
Final simplification74.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= x 15200000000000.0)
(+
(- t_1 (sqrt x))
(+ (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (x <= 15200000000000.0) {
tmp = (t_1 - sqrt(x)) + ((1.0 / (sqrt((y + 1.0)) + sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (x <= 15200000000000.0d0) then
tmp = (t_1 - sqrt(x)) + ((1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (x <= 15200000000000.0) {
tmp = (t_1 - Math.sqrt(x)) + ((1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if x <= 15200000000000.0: tmp = (t_1 - math.sqrt(x)) + ((1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (x <= 15200000000000.0) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (x <= 15200000000000.0)
tmp = (t_1 - sqrt(x)) + ((1.0 / (sqrt((y + 1.0)) + sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 15200000000000.0], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 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]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;x \leq 15200000000000:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{y + 1} + \sqrt{y}} + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if x < 1.52e13Initial program 96.9%
associate-+l+96.9%
associate-+l+96.9%
+-commutative96.9%
+-commutative96.9%
associate-+l-74.6%
+-commutative74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in t around inf 57.3%
flip--74.8%
div-inv74.8%
add-sqr-sqrt59.5%
add-sqr-sqrt74.8%
associate--l+75.3%
Applied egg-rr57.6%
+-inverses75.3%
metadata-eval75.3%
*-lft-identity75.3%
Simplified57.6%
if 1.52e13 < x Initial program 82.9%
associate-+l+82.9%
associate-+l+82.9%
+-commutative82.9%
+-commutative82.9%
associate-+l-64.5%
+-commutative64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in t around inf 48.3%
Taylor expanded in z around inf 5.2%
associate--l+5.9%
+-commutative5.9%
Simplified5.9%
Taylor expanded in y around inf 3.3%
flip--3.3%
add-sqr-sqrt3.6%
add-sqr-sqrt3.3%
Applied egg-rr3.3%
associate--l+9.9%
+-inverses9.9%
metadata-eval9.9%
+-commutative9.9%
Simplified9.9%
Final simplification34.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y))) (t_2 (sqrt (+ x 1.0))))
(if (<= t 2.05e+15)
(+ (- t_2 (sqrt x)) (+ t_1 (+ (- (sqrt (+ t 1.0)) (sqrt t)) 1.0)))
(+ (/ 1.0 (+ t_2 (sqrt x))) (+ (- (sqrt (+ z 1.0)) (sqrt z)) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((x + 1.0));
double tmp;
if (t <= 2.05e+15) {
tmp = (t_2 - sqrt(x)) + (t_1 + ((sqrt((t + 1.0)) - sqrt(t)) + 1.0));
} else {
tmp = (1.0 / (t_2 + sqrt(x))) + ((sqrt((z + 1.0)) - sqrt(z)) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((x + 1.0d0))
if (t <= 2.05d+15) then
tmp = (t_2 - sqrt(x)) + (t_1 + ((sqrt((t + 1.0d0)) - sqrt(t)) + 1.0d0))
else
tmp = (1.0d0 / (t_2 + sqrt(x))) + ((sqrt((z + 1.0d0)) - sqrt(z)) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (t <= 2.05e+15) {
tmp = (t_2 - Math.sqrt(x)) + (t_1 + ((Math.sqrt((t + 1.0)) - Math.sqrt(t)) + 1.0));
} else {
tmp = (1.0 / (t_2 + Math.sqrt(x))) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((x + 1.0)) tmp = 0 if t <= 2.05e+15: tmp = (t_2 - math.sqrt(x)) + (t_1 + ((math.sqrt((t + 1.0)) - math.sqrt(t)) + 1.0)) else: tmp = (1.0 / (t_2 + math.sqrt(x))) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (t <= 2.05e+15) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(t_1 + Float64(Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) + 1.0))); else tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (t <= 2.05e+15)
tmp = (t_2 - sqrt(x)) + (t_1 + ((sqrt((t + 1.0)) - sqrt(t)) + 1.0));
else
tmp = (1.0 / (t_2 + sqrt(x))) + ((sqrt((z + 1.0)) - sqrt(z)) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 2.05e+15], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;t \leq 2.05 \cdot 10^{+15}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(t\_1 + \left(\left(\sqrt{t + 1} - \sqrt{t}\right) + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + t\_1\right)\\
\end{array}
\end{array}
if t < 2.05e15Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in z around 0 57.2%
associate--l+57.2%
Simplified57.2%
if 2.05e15 < t Initial program 84.2%
associate-+l+84.2%
associate-+l+84.2%
+-commutative84.2%
+-commutative84.2%
associate-+l-44.9%
+-commutative44.9%
+-commutative44.9%
Simplified44.9%
Taylor expanded in t around inf 84.2%
flip--45.0%
div-inv45.0%
add-sqr-sqrt36.9%
+-commutative36.9%
add-sqr-sqrt45.0%
associate--l+48.7%
+-commutative48.7%
Applied egg-rr88.1%
+-inverses48.7%
metadata-eval48.7%
*-lft-identity48.7%
Simplified88.1%
Final simplification73.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))) (t_2 (sqrt (+ z 1.0))))
(if (<= t 3.3e+16)
(-
(+ t_1 (+ t_2 (+ (sqrt (+ t 1.0)) 1.0)))
(+ (sqrt z) (+ (sqrt t) (sqrt y))))
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(+ (- t_2 (sqrt z)) (- t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((z + 1.0));
double tmp;
if (t <= 3.3e+16) {
tmp = (t_1 + (t_2 + (sqrt((t + 1.0)) + 1.0))) - (sqrt(z) + (sqrt(t) + sqrt(y)));
} else {
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((t_2 - sqrt(z)) + (t_1 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((z + 1.0d0))
if (t <= 3.3d+16) then
tmp = (t_1 + (t_2 + (sqrt((t + 1.0d0)) + 1.0d0))) - (sqrt(z) + (sqrt(t) + sqrt(y)))
else
tmp = (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + ((t_2 - sqrt(z)) + (t_1 - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = Math.sqrt((z + 1.0));
double tmp;
if (t <= 3.3e+16) {
tmp = (t_1 + (t_2 + (Math.sqrt((t + 1.0)) + 1.0))) - (Math.sqrt(z) + (Math.sqrt(t) + Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + ((t_2 - Math.sqrt(z)) + (t_1 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((z + 1.0)) tmp = 0 if t <= 3.3e+16: tmp = (t_1 + (t_2 + (math.sqrt((t + 1.0)) + 1.0))) - (math.sqrt(z) + (math.sqrt(t) + math.sqrt(y))) else: tmp = (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + ((t_2 - math.sqrt(z)) + (t_1 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t <= 3.3e+16) tmp = Float64(Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(t + 1.0)) + 1.0))) - Float64(sqrt(z) + Float64(sqrt(t) + sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(Float64(t_2 - sqrt(z)) + Float64(t_1 - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = sqrt((z + 1.0));
tmp = 0.0;
if (t <= 3.3e+16)
tmp = (t_1 + (t_2 + (sqrt((t + 1.0)) + 1.0))) - (sqrt(z) + (sqrt(t) + sqrt(y)));
else
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((t_2 - sqrt(z)) + (t_1 - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3.3e+16], N[(N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{z + 1}\\
\mathbf{if}\;t \leq 3.3 \cdot 10^{+16}:\\
\;\;\;\;\left(t\_1 + \left(t\_2 + \left(\sqrt{t + 1} + 1\right)\right)\right) - \left(\sqrt{z} + \left(\sqrt{t} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(t\_2 - \sqrt{z}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 3.3e16Initial program 96.5%
associate-+l+96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
associate-+l-96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
flip--96.8%
div-inv96.8%
add-sqr-sqrt77.2%
+-commutative77.2%
add-sqr-sqrt97.1%
associate--l+97.6%
+-commutative97.6%
Applied egg-rr97.6%
+-inverses97.6%
metadata-eval97.6%
*-lft-identity97.6%
Simplified97.6%
Taylor expanded in x around 0 21.5%
associate-+r+21.5%
+-commutative21.5%
associate-+r+21.5%
associate-+r+21.5%
+-commutative21.5%
Simplified21.5%
if 3.3e16 < t Initial program 84.3%
associate-+l+84.3%
associate-+l+84.3%
+-commutative84.3%
+-commutative84.3%
associate-+l-44.8%
+-commutative44.8%
+-commutative44.8%
Simplified44.8%
Taylor expanded in t around inf 84.3%
flip--44.8%
div-inv44.8%
add-sqr-sqrt36.7%
+-commutative36.7%
add-sqr-sqrt44.8%
associate--l+48.6%
+-commutative48.6%
Applied egg-rr88.3%
+-inverses48.6%
metadata-eval48.6%
*-lft-identity48.6%
Simplified88.3%
Final simplification56.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= x 4.5e+20)
(+
(- t_1 (sqrt x))
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (- (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (x <= 4.5e+20) {
tmp = (t_1 - sqrt(x)) + ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((y + 1.0)) - sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (x <= 4.5d+20) then
tmp = (t_1 - sqrt(x)) + ((sqrt((z + 1.0d0)) - sqrt(z)) + (sqrt((y + 1.0d0)) - sqrt(y)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (x <= 4.5e+20) {
tmp = (t_1 - Math.sqrt(x)) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if x <= 4.5e+20: tmp = (t_1 - math.sqrt(x)) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (x <= 4.5e+20) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (x <= 4.5e+20)
tmp = (t_1 - sqrt(x)) + ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((y + 1.0)) - sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.5e+20], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{+20}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if x < 4.5e20Initial program 96.0%
associate-+l+96.0%
associate-+l+96.0%
+-commutative96.0%
+-commutative96.0%
associate-+l-73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in t around inf 56.6%
if 4.5e20 < x Initial program 83.4%
associate-+l+83.4%
associate-+l+83.4%
+-commutative83.4%
+-commutative83.4%
associate-+l-65.0%
+-commutative65.0%
+-commutative65.0%
Simplified65.0%
Taylor expanded in t around inf 48.8%
Taylor expanded in z around inf 5.1%
associate--l+5.7%
+-commutative5.7%
Simplified5.7%
Taylor expanded in y around inf 3.2%
flip--3.2%
add-sqr-sqrt3.5%
add-sqr-sqrt3.2%
Applied egg-rr3.2%
associate--l+9.8%
+-inverses9.8%
metadata-eval9.8%
+-commutative9.8%
Simplified9.8%
Final simplification35.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 2.4e-33)
(+ (+ (sqrt (+ y 1.0)) (- (sqrt (+ z 1.0)) (+ (sqrt z) (sqrt y)))) 1.0)
(if (<= y 5.4e+15)
(+ t_1 (- (hypot 1.0 (sqrt y)) (+ (sqrt y) (sqrt x))))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 2.4e-33) {
tmp = (sqrt((y + 1.0)) + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)))) + 1.0;
} else if (y <= 5.4e+15) {
tmp = t_1 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 2.4e-33) {
tmp = (Math.sqrt((y + 1.0)) + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + Math.sqrt(y)))) + 1.0;
} else if (y <= 5.4e+15) {
tmp = t_1 + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 2.4e-33: tmp = (math.sqrt((y + 1.0)) + (math.sqrt((z + 1.0)) - (math.sqrt(z) + math.sqrt(y)))) + 1.0 elif y <= 5.4e+15: tmp = t_1 + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 2.4e-33) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + sqrt(y)))) + 1.0); elseif (y <= 5.4e+15) tmp = Float64(t_1 + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 2.4e-33)
tmp = (sqrt((y + 1.0)) + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)))) + 1.0;
elseif (y <= 5.4e+15)
tmp = t_1 + (hypot(1.0, sqrt(y)) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.4e-33], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[y, 5.4e+15], N[(t$95$1 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 2.4 \cdot 10^{-33}:\\
\;\;\;\;\left(\sqrt{y + 1} + \left(\sqrt{z + 1} - \left(\sqrt{z} + \sqrt{y}\right)\right)\right) + 1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.4e-33Initial program 97.2%
associate-+l+97.2%
associate-+l+97.2%
+-commutative97.2%
+-commutative97.2%
associate-+l-78.8%
+-commutative78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in t around inf 59.3%
Taylor expanded in x around 0 31.4%
associate--l+51.7%
associate--l+48.7%
+-commutative48.7%
Simplified48.7%
if 2.4e-33 < y < 5.4e15Initial program 96.5%
associate-+l+96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
associate-+l-70.8%
+-commutative70.8%
+-commutative70.8%
Simplified70.8%
Taylor expanded in t around inf 64.9%
Taylor expanded in z around inf 18.1%
associate--l+18.1%
unpow118.1%
sqr-pow18.1%
hypot-1-def18.1%
metadata-eval18.1%
unpow1/218.1%
+-commutative18.1%
Simplified18.1%
if 5.4e15 < y Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in t around inf 45.4%
Taylor expanded in z around inf 4.2%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in y around inf 20.2%
flip--20.2%
add-sqr-sqrt20.1%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
associate--l+24.9%
+-inverses24.9%
metadata-eval24.9%
+-commutative24.9%
Simplified24.9%
Final simplification35.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ y 1.0))))
(if (<= y 2.4e-33)
(+ (+ t_2 (- (sqrt (+ z 1.0)) (+ (sqrt z) (sqrt y)))) 1.0)
(if (<= y 5.2e+15)
(- (+ t_1 (- t_2 (sqrt y))) (sqrt x))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((y + 1.0));
double tmp;
if (y <= 2.4e-33) {
tmp = (t_2 + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)))) + 1.0;
} else if (y <= 5.2e+15) {
tmp = (t_1 + (t_2 - sqrt(y))) - sqrt(x);
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (y <= 2.4d-33) then
tmp = (t_2 + (sqrt((z + 1.0d0)) - (sqrt(z) + sqrt(y)))) + 1.0d0
else if (y <= 5.2d+15) then
tmp = (t_1 + (t_2 - sqrt(y))) - sqrt(x)
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (y <= 2.4e-33) {
tmp = (t_2 + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + Math.sqrt(y)))) + 1.0;
} else if (y <= 5.2e+15) {
tmp = (t_1 + (t_2 - Math.sqrt(y))) - Math.sqrt(x);
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((y + 1.0)) tmp = 0 if y <= 2.4e-33: tmp = (t_2 + (math.sqrt((z + 1.0)) - (math.sqrt(z) + math.sqrt(y)))) + 1.0 elif y <= 5.2e+15: tmp = (t_1 + (t_2 - math.sqrt(y))) - math.sqrt(x) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (y <= 2.4e-33) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + sqrt(y)))) + 1.0); elseif (y <= 5.2e+15) tmp = Float64(Float64(t_1 + Float64(t_2 - sqrt(y))) - sqrt(x)); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (y <= 2.4e-33)
tmp = (t_2 + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)))) + 1.0;
elseif (y <= 5.2e+15)
tmp = (t_1 + (t_2 - sqrt(y))) - sqrt(x);
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.4e-33], N[(N[(t$95$2 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[y, 5.2e+15], N[(N[(t$95$1 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;y \leq 2.4 \cdot 10^{-33}:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{z + 1} - \left(\sqrt{z} + \sqrt{y}\right)\right)\right) + 1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+15}:\\
\;\;\;\;\left(t\_1 + \left(t\_2 - \sqrt{y}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.4e-33Initial program 97.2%
associate-+l+97.2%
associate-+l+97.2%
+-commutative97.2%
+-commutative97.2%
associate-+l-78.8%
+-commutative78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in t around inf 59.3%
Taylor expanded in x around 0 31.4%
associate--l+51.7%
associate--l+48.7%
+-commutative48.7%
Simplified48.7%
if 2.4e-33 < y < 5.2e15Initial program 96.5%
associate-+l+96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
associate-+l-70.8%
+-commutative70.8%
+-commutative70.8%
Simplified70.8%
Taylor expanded in t around inf 64.9%
Taylor expanded in z around inf 18.1%
associate--l+18.1%
+-commutative18.1%
Simplified18.1%
add-cube-cbrt18.1%
pow318.2%
associate-+r-18.0%
Applied egg-rr18.0%
rem-cube-cbrt18.1%
associate--r+18.1%
metadata-eval18.1%
add-sqr-sqrt18.1%
hypot-undefine18.1%
associate-+r-18.1%
+-commutative18.1%
hypot-undefine18.1%
metadata-eval18.1%
add-sqr-sqrt18.1%
Applied egg-rr18.1%
if 5.2e15 < y Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in t around inf 45.4%
Taylor expanded in z around inf 4.2%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in y around inf 20.2%
flip--20.2%
add-sqr-sqrt20.1%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
associate--l+24.9%
+-inverses24.9%
metadata-eval24.9%
+-commutative24.9%
Simplified24.9%
Final simplification35.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))) (t_2 (sqrt (+ x 1.0))))
(if (<= z 2.4)
(+ (+ t_1 (- t_2 (+ (sqrt y) (sqrt x)))) 1.0)
(- (+ t_2 (- t_1 (sqrt y))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((x + 1.0));
double tmp;
if (z <= 2.4) {
tmp = (t_1 + (t_2 - (sqrt(y) + sqrt(x)))) + 1.0;
} else {
tmp = (t_2 + (t_1 - sqrt(y))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((x + 1.0d0))
if (z <= 2.4d0) then
tmp = (t_1 + (t_2 - (sqrt(y) + sqrt(x)))) + 1.0d0
else
tmp = (t_2 + (t_1 - sqrt(y))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (z <= 2.4) {
tmp = (t_1 + (t_2 - (Math.sqrt(y) + Math.sqrt(x)))) + 1.0;
} else {
tmp = (t_2 + (t_1 - Math.sqrt(y))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if z <= 2.4: tmp = (t_1 + (t_2 - (math.sqrt(y) + math.sqrt(x)))) + 1.0 else: tmp = (t_2 + (t_1 - math.sqrt(y))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (z <= 2.4) tmp = Float64(Float64(t_1 + Float64(t_2 - Float64(sqrt(y) + sqrt(x)))) + 1.0); else tmp = Float64(Float64(t_2 + Float64(t_1 - sqrt(y))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (z <= 2.4)
tmp = (t_1 + (t_2 - (sqrt(y) + sqrt(x)))) + 1.0;
else
tmp = (t_2 + (t_1 - sqrt(y))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.4], N[(N[(t$95$1 + N[(t$95$2 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(t$95$2 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 2.4:\\
\;\;\;\;\left(t\_1 + \left(t\_2 - \left(\sqrt{y} + \sqrt{x}\right)\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + \left(t\_1 - \sqrt{y}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 2.39999999999999991Initial program 96.6%
associate-+l+96.6%
associate-+l+96.6%
+-commutative96.6%
+-commutative96.6%
associate-+l-57.0%
+-commutative57.0%
+-commutative57.0%
Simplified57.0%
Taylor expanded in t around inf 60.5%
Taylor expanded in z around 0 21.1%
associate--l+38.1%
+-commutative38.1%
associate--l+39.6%
+-commutative39.6%
Simplified39.6%
if 2.39999999999999991 < z Initial program 83.9%
associate-+l+83.9%
associate-+l+83.9%
+-commutative83.9%
+-commutative83.9%
associate-+l-82.4%
+-commutative82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in t around inf 45.6%
Taylor expanded in z around inf 15.6%
associate--l+26.6%
+-commutative26.6%
Simplified26.6%
add-cube-cbrt26.5%
pow326.5%
associate-+r-15.4%
Applied egg-rr15.4%
rem-cube-cbrt15.6%
associate--r+15.1%
metadata-eval15.1%
add-sqr-sqrt15.1%
hypot-undefine15.1%
associate-+r-27.2%
+-commutative27.2%
hypot-undefine27.2%
metadata-eval27.2%
add-sqr-sqrt27.2%
Applied egg-rr27.2%
Final simplification33.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 5.2e+15)
(+ t_1 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 5.2e+15) {
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (y <= 5.2d+15) then
tmp = t_1 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 5.2e+15) {
tmp = t_1 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 5.2e+15: tmp = t_1 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 5.2e+15) tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 5.2e+15)
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 5.2e+15], N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 5.2 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.2e15Initial program 97.1%
associate-+l+97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
associate-+l-77.9%
+-commutative77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in t around inf 59.9%
Taylor expanded in z around inf 19.8%
associate--l+19.8%
+-commutative19.8%
Simplified19.8%
if 5.2e15 < y Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in t around inf 45.4%
Taylor expanded in z around inf 4.2%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in y around inf 20.2%
flip--20.2%
add-sqr-sqrt20.1%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
associate--l+24.9%
+-inverses24.9%
metadata-eval24.9%
+-commutative24.9%
Simplified24.9%
Final simplification22.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= x 14000000000.0)
(- (+ t_1 (- (sqrt (+ y 1.0)) (sqrt y))) (sqrt x))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (x <= 14000000000.0) {
tmp = (t_1 + (sqrt((y + 1.0)) - sqrt(y))) - sqrt(x);
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (x <= 14000000000.0d0) then
tmp = (t_1 + (sqrt((y + 1.0d0)) - sqrt(y))) - sqrt(x)
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (x <= 14000000000.0) {
tmp = (t_1 + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) - Math.sqrt(x);
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if x <= 14000000000.0: tmp = (t_1 + (math.sqrt((y + 1.0)) - math.sqrt(y))) - math.sqrt(x) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (x <= 14000000000.0) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) - sqrt(x)); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (x <= 14000000000.0)
tmp = (t_1 + (sqrt((y + 1.0)) - sqrt(y))) - sqrt(x);
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 14000000000.0], N[(N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;x \leq 14000000000:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if x < 1.4e10Initial program 96.9%
associate-+l+96.9%
associate-+l+96.9%
+-commutative96.9%
+-commutative96.9%
associate-+l-74.6%
+-commutative74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in t around inf 57.3%
Taylor expanded in z around inf 18.8%
associate--l+32.6%
+-commutative32.6%
Simplified32.6%
add-cube-cbrt32.5%
pow332.5%
associate-+r-18.7%
Applied egg-rr18.7%
rem-cube-cbrt18.8%
associate--r+18.2%
metadata-eval18.2%
add-sqr-sqrt18.2%
hypot-undefine18.2%
associate-+r-33.3%
+-commutative33.3%
hypot-undefine33.3%
metadata-eval33.3%
add-sqr-sqrt33.3%
Applied egg-rr33.3%
if 1.4e10 < x Initial program 82.9%
associate-+l+82.9%
associate-+l+82.9%
+-commutative82.9%
+-commutative82.9%
associate-+l-64.5%
+-commutative64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in t around inf 48.3%
Taylor expanded in z around inf 5.2%
associate--l+5.9%
+-commutative5.9%
Simplified5.9%
Taylor expanded in y around inf 3.3%
flip--3.3%
add-sqr-sqrt3.6%
add-sqr-sqrt3.3%
Applied egg-rr3.3%
associate--l+9.9%
+-inverses9.9%
metadata-eval9.9%
+-commutative9.9%
Simplified9.9%
Final simplification22.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 9e+15)
(+ t_1 (/ (- (+ y 1.0) y) (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 9e+15) {
tmp = t_1 + (((y + 1.0) - y) / (sqrt((y + 1.0)) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (y <= 9d+15) then
tmp = t_1 + (((y + 1.0d0) - y) / (sqrt((y + 1.0d0)) + sqrt(y)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 9e+15) {
tmp = t_1 + (((y + 1.0) - y) / (Math.sqrt((y + 1.0)) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 9e+15: tmp = t_1 + (((y + 1.0) - y) / (math.sqrt((y + 1.0)) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 9e+15) tmp = Float64(t_1 + Float64(Float64(Float64(y + 1.0) - y) / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 9e+15)
tmp = t_1 + (((y + 1.0) - y) / (sqrt((y + 1.0)) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 9e+15], N[(t$95$1 + N[(N[(N[(y + 1.0), $MachinePrecision] - y), $MachinePrecision] / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 9 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \frac{\left(y + 1\right) - y}{\sqrt{y + 1} + \sqrt{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 9e15Initial program 97.1%
associate-+l+97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
associate-+l-77.9%
+-commutative77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in t around inf 59.9%
Taylor expanded in z around inf 19.8%
associate--l+19.8%
unpow119.8%
sqr-pow19.8%
hypot-1-def19.8%
metadata-eval19.8%
unpow1/219.8%
+-commutative19.8%
Simplified19.8%
Taylor expanded in x around 0 19.0%
flip--19.0%
hypot-undefine19.0%
metadata-eval19.0%
add-sqr-sqrt19.0%
hypot-undefine19.0%
metadata-eval19.0%
add-sqr-sqrt19.0%
add-sqr-sqrt19.0%
add-sqr-sqrt19.0%
hypot-undefine19.0%
metadata-eval19.0%
add-sqr-sqrt19.0%
Applied egg-rr19.0%
if 9e15 < y Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in t around inf 45.4%
Taylor expanded in z around inf 4.2%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in y around inf 20.2%
flip--20.2%
add-sqr-sqrt20.1%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
associate--l+24.9%
+-inverses24.9%
metadata-eval24.9%
+-commutative24.9%
Simplified24.9%
Final simplification21.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 6.4e+15) (- (+ (sqrt (+ y 1.0)) 1.0) (sqrt y)) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.4e+15) {
tmp = (sqrt((y + 1.0)) + 1.0) - sqrt(y);
} else {
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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) :: tmp
if (y <= 6.4d+15) then
tmp = (sqrt((y + 1.0d0)) + 1.0d0) - sqrt(y)
else
tmp = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.4e+15) {
tmp = (Math.sqrt((y + 1.0)) + 1.0) - Math.sqrt(y);
} else {
tmp = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 6.4e+15: tmp = (math.sqrt((y + 1.0)) + 1.0) - math.sqrt(y) else: tmp = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 6.4e+15) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) + 1.0) - sqrt(y)); else tmp = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 6.4e+15)
tmp = (sqrt((y + 1.0)) + 1.0) - sqrt(y);
else
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 6.4e+15], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.4 \cdot 10^{+15}:\\
\;\;\;\;\left(\sqrt{y + 1} + 1\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 6.4e15Initial program 97.1%
associate-+l+97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
associate-+l-77.9%
+-commutative77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in t around inf 59.9%
Taylor expanded in z around inf 19.8%
associate--l+19.8%
+-commutative19.8%
Simplified19.8%
Taylor expanded in x around 0 40.5%
if 6.4e15 < y Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in t around inf 45.4%
Taylor expanded in z around inf 4.2%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in y around inf 20.2%
flip--20.2%
add-sqr-sqrt20.1%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
associate--l+24.9%
+-inverses24.9%
metadata-eval24.9%
+-commutative24.9%
Simplified24.9%
Final simplification33.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ x 1.0)))) (if (<= y 1.15) (+ t_1 1.0) (- t_1 (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 1.15) {
tmp = t_1 + 1.0;
} else {
tmp = t_1 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (y <= 1.15d0) then
tmp = t_1 + 1.0d0
else
tmp = t_1 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 1.15) {
tmp = t_1 + 1.0;
} else {
tmp = t_1 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 1.15: tmp = t_1 + 1.0 else: tmp = t_1 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 1.15) tmp = Float64(t_1 + 1.0); else tmp = Float64(t_1 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 1.15)
tmp = t_1 + 1.0;
else
tmp = t_1 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.15], N[(t$95$1 + 1.0), $MachinePrecision], N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 1.15:\\
\;\;\;\;t\_1 + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.1499999999999999Initial program 97.4%
associate-+l+97.4%
associate-+l+97.4%
+-commutative97.4%
+-commutative97.4%
associate-+l-78.8%
+-commutative78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in t around inf 59.3%
Taylor expanded in z around inf 19.8%
associate--l+19.8%
unpow119.8%
sqr-pow19.8%
hypot-1-def19.8%
metadata-eval19.8%
unpow1/219.8%
+-commutative19.8%
Simplified19.8%
Taylor expanded in x around 0 19.0%
Taylor expanded in y around 0 18.5%
if 1.1499999999999999 < y Initial program 82.7%
associate-+l+82.7%
associate-+l+82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l-60.3%
+-commutative60.3%
+-commutative60.3%
Simplified60.3%
Taylor expanded in t around inf 46.4%
Taylor expanded in z around inf 4.5%
associate--l+20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in y around inf 20.1%
Final simplification19.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (- (sqrt (+ y 1.0)) (sqrt y)) 1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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
code = (sqrt((y + 1.0d0)) - sqrt(y)) + 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((y + 1.0)) - Math.sqrt(y)) + 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (math.sqrt((y + 1.0)) - math.sqrt(y)) + 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + 1.0) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{y + 1} - \sqrt{y}\right) + 1
\end{array}
Initial program 90.2%
associate-+l+90.2%
associate-+l+90.2%
+-commutative90.2%
+-commutative90.2%
associate-+l-69.8%
+-commutative69.8%
+-commutative69.8%
Simplified69.8%
Taylor expanded in t around inf 53.0%
Taylor expanded in z around inf 12.4%
associate--l+19.9%
+-commutative19.9%
Simplified19.9%
Taylor expanded in x around 0 23.8%
associate--l+39.3%
Simplified39.3%
Final simplification39.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ x 1.0)))) (if (<= y 3.7) (+ t_1 1.0) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 3.7) {
tmp = t_1 + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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 (y <= 3.7d0) then
tmp = t_1 + 1.0d0
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 3.7) {
tmp = t_1 + 1.0;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 3.7: tmp = t_1 + 1.0 else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 3.7) tmp = Float64(t_1 + 1.0); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 3.7)
tmp = t_1 + 1.0;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.7], N[(t$95$1 + 1.0), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 3.7:\\
\;\;\;\;t\_1 + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < 3.7000000000000002Initial program 97.4%
associate-+l+97.4%
associate-+l+97.4%
+-commutative97.4%
+-commutative97.4%
associate-+l-78.8%
+-commutative78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in t around inf 59.3%
Taylor expanded in z around inf 19.8%
associate--l+19.8%
unpow119.8%
sqr-pow19.8%
hypot-1-def19.8%
metadata-eval19.8%
unpow1/219.8%
+-commutative19.8%
Simplified19.8%
Taylor expanded in x around 0 19.0%
Taylor expanded in y around 0 18.5%
if 3.7000000000000002 < y Initial program 82.7%
associate-+l+82.7%
associate-+l+82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l-60.3%
+-commutative60.3%
+-commutative60.3%
Simplified60.3%
Taylor expanded in t around inf 46.4%
Taylor expanded in z around inf 4.5%
associate--l+20.0%
unpow120.0%
sqr-pow19.5%
hypot-1-def19.5%
metadata-eval19.5%
unpow1/220.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in x around 0 20.6%
Taylor expanded in y around inf 20.6%
Final simplification19.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt (+ x 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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
code = sqrt((x + 1.0d0))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(Float64(x + 1.0)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1}
\end{array}
Initial program 90.2%
associate-+l+90.2%
associate-+l+90.2%
+-commutative90.2%
+-commutative90.2%
associate-+l-69.8%
+-commutative69.8%
+-commutative69.8%
Simplified69.8%
Taylor expanded in t around inf 53.0%
Taylor expanded in z around inf 12.4%
associate--l+19.9%
unpow119.9%
sqr-pow19.7%
hypot-1-def19.7%
metadata-eval19.7%
unpow1/219.9%
+-commutative19.9%
Simplified19.9%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around inf 16.2%
Final simplification16.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 0.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this 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
code = 0.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 0.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 0.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0
\end{array}
Initial program 90.2%
associate-+l+90.2%
associate-+l+90.2%
+-commutative90.2%
+-commutative90.2%
associate-+l-69.8%
+-commutative69.8%
+-commutative69.8%
Simplified69.8%
Taylor expanded in t around inf 53.0%
Taylor expanded in z around inf 12.4%
associate--l+19.9%
+-commutative19.9%
Simplified19.9%
Taylor expanded in y around inf 15.1%
Taylor expanded in x around inf 3.1%
Final simplification3.1%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 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))))
double code(double x, double y, double z, double t) {
return (((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));
}
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 = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((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)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\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)
\end{array}
herbie shell --seed 2024059
(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))))