
(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 20 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 (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))) (t_2 (sqrt (+ y 1.0))))
(if (<= z 3.5e-16)
(+
t_2
(-
(- 2.0 (+ (sqrt z) (sqrt x)))
(- (sqrt y) (- (sqrt (+ t 1.0)) (sqrt t)))))
(if (<= z 4500000000.0)
(+ (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))) (+ (- t_2 (sqrt y)) t_1))
(+ (+ (/ 1.0 (+ t_2 (sqrt y))) t_1) (* 0.5 (sqrt (/ 1.0 z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
double t_2 = sqrt((y + 1.0));
double tmp;
if (z <= 3.5e-16) {
tmp = t_2 + ((2.0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0)) - sqrt(t))));
} else if (z <= 4500000000.0) {
tmp = (1.0 / (sqrt((z + 1.0)) + sqrt(z))) + ((t_2 - sqrt(y)) + t_1);
} else {
tmp = ((1.0 / (t_2 + sqrt(y))) + t_1) + (0.5 * sqrt((1.0 / z)));
}
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 = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
t_2 = sqrt((y + 1.0d0))
if (z <= 3.5d-16) then
tmp = t_2 + ((2.0d0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0d0)) - sqrt(t))))
else if (z <= 4500000000.0d0) then
tmp = (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))) + ((t_2 - sqrt(y)) + t_1)
else
tmp = ((1.0d0 / (t_2 + sqrt(y))) + t_1) + (0.5d0 * sqrt((1.0d0 / z)))
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 = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 3.5e-16) {
tmp = t_2 + ((2.0 - (Math.sqrt(z) + Math.sqrt(x))) - (Math.sqrt(y) - (Math.sqrt((t + 1.0)) - Math.sqrt(t))));
} else if (z <= 4500000000.0) {
tmp = (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))) + ((t_2 - Math.sqrt(y)) + t_1);
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(y))) + t_1) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) t_2 = math.sqrt((y + 1.0)) tmp = 0 if z <= 3.5e-16: tmp = t_2 + ((2.0 - (math.sqrt(z) + math.sqrt(x))) - (math.sqrt(y) - (math.sqrt((t + 1.0)) - math.sqrt(t)))) elif z <= 4500000000.0: tmp = (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z))) + ((t_2 - math.sqrt(y)) + t_1) else: tmp = ((1.0 / (t_2 + math.sqrt(y))) + t_1) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 3.5e-16) tmp = Float64(t_2 + Float64(Float64(2.0 - Float64(sqrt(z) + sqrt(x))) - Float64(sqrt(y) - Float64(sqrt(Float64(t + 1.0)) - sqrt(t))))); elseif (z <= 4500000000.0) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) + Float64(Float64(t_2 - sqrt(y)) + t_1)); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + t_1) + Float64(0.5 * sqrt(Float64(1.0 / z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 3.5e-16)
tmp = t_2 + ((2.0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0)) - sqrt(t))));
elseif (z <= 4500000000.0)
tmp = (1.0 / (sqrt((z + 1.0)) + sqrt(z))) + ((t_2 - sqrt(y)) + t_1);
else
tmp = ((1.0 / (t_2 + sqrt(y))) + t_1) + (0.5 * sqrt((1.0 / z)));
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[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3.5e-16], N[(t$95$2 + N[(N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] - N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4500000000.0], N[(N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 3.5 \cdot 10^{-16}:\\
\;\;\;\;t\_2 + \left(\left(2 - \left(\sqrt{z} + \sqrt{x}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\\
\mathbf{elif}\;z \leq 4500000000:\\
\;\;\;\;\frac{1}{\sqrt{z + 1} + \sqrt{z}} + \left(\left(t\_2 - \sqrt{y}\right) + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_2 + \sqrt{y}} + t\_1\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if z < 3.50000000000000017e-16Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-77.2%
associate-+l-67.3%
associate-+r-51.7%
Simplified51.7%
Taylor expanded in x around 0 21.3%
Taylor expanded in z around 0 21.3%
+-commutative21.3%
Simplified21.3%
if 3.50000000000000017e-16 < z < 4.5e9Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
flip--96.8%
add-sqr-sqrt57.6%
+-commutative57.6%
add-sqr-sqrt96.8%
+-commutative96.8%
Applied egg-rr96.8%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t around inf 27.7%
flip--27.4%
add-sqr-sqrt27.4%
add-sqr-sqrt28.4%
Applied egg-rr28.4%
associate--l+28.4%
+-inverses28.4%
metadata-eval28.4%
+-commutative28.4%
Simplified28.4%
if 4.5e9 < z Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.4%
add-sqr-sqrt71.3%
+-commutative71.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+88.8%
+-inverses88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in t around inf 50.0%
flip--50.1%
add-sqr-sqrt41.4%
add-sqr-sqrt50.8%
Applied egg-rr50.8%
associate--l+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in z around inf 56.6%
Final simplification38.7%
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_2 (sqrt z)) 4e-6)
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
(* 0.5 (sqrt (/ 1.0 z))))
(+
(+ (- 1.0 (sqrt x)) (- t_1 (sqrt y)))
(+ (/ 1.0 (+ t_2 (sqrt z))) (- (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));
double t_2 = sqrt((z + 1.0));
double tmp;
if ((t_2 - sqrt(z)) <= 4e-6) {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
} else {
tmp = ((1.0 - sqrt(x)) + (t_1 - sqrt(y))) + ((1.0 / (t_2 + sqrt(z))) + (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((y + 1.0d0))
t_2 = sqrt((z + 1.0d0))
if ((t_2 - sqrt(z)) <= 4d-6) then
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x)))) + (0.5d0 * sqrt((1.0d0 / z)))
else
tmp = ((1.0d0 - sqrt(x)) + (t_1 - sqrt(y))) + ((1.0d0 / (t_2 + sqrt(z))) + (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));
double t_2 = Math.sqrt((z + 1.0));
double tmp;
if ((t_2 - Math.sqrt(z)) <= 4e-6) {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)))) + (0.5 * Math.sqrt((1.0 / z)));
} else {
tmp = ((1.0 - Math.sqrt(x)) + (t_1 - Math.sqrt(y))) + ((1.0 / (t_2 + Math.sqrt(z))) + (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)) t_2 = math.sqrt((z + 1.0)) tmp = 0 if (t_2 - math.sqrt(z)) <= 4e-6: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)))) + (0.5 * math.sqrt((1.0 / z))) else: tmp = ((1.0 - math.sqrt(x)) + (t_1 - math.sqrt(y))) + ((1.0 / (t_2 + math.sqrt(z))) + (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(y + 1.0)) t_2 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (Float64(t_2 - sqrt(z)) <= 4e-6) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(t_1 - sqrt(y))) + Float64(Float64(1.0 / Float64(t_2 + sqrt(z))) + 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));
t_2 = sqrt((z + 1.0));
tmp = 0.0;
if ((t_2 - sqrt(z)) <= 4e-6)
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
else
tmp = ((1.0 - sqrt(x)) + (t_1 - sqrt(y))) + ((1.0 / (t_2 + sqrt(z))) + (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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 4e-6], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $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\_2 - \sqrt{z} \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right) + \left(\frac{1}{t\_2 + \sqrt{z}} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 3.99999999999999982e-6Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.4%
add-sqr-sqrt71.3%
+-commutative71.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+88.8%
+-inverses88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in t around inf 50.0%
flip--50.1%
add-sqr-sqrt41.4%
add-sqr-sqrt50.8%
Applied egg-rr50.8%
associate--l+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in z around inf 56.6%
if 3.99999999999999982e-6 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--56.4%
add-sqr-sqrt56.4%
add-sqr-sqrt56.5%
Applied egg-rr97.9%
associate--l+56.5%
+-inverses56.5%
metadata-eval56.5%
+-commutative56.5%
Simplified97.9%
Taylor expanded in x around 0 45.7%
Final simplification51.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))))
(if (<= z 7300000.0)
(+
t_1
(+
(+ (sqrt (+ z 1.0)) (- (- 1.0 (sqrt x)) (sqrt z)))
(- (- (sqrt (+ t 1.0)) (sqrt t)) (sqrt y))))
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
(* 0.5 (sqrt (/ 1.0 z)))))))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 tmp;
if (z <= 7300000.0) {
tmp = t_1 + ((sqrt((z + 1.0)) + ((1.0 - sqrt(x)) - sqrt(z))) + ((sqrt((t + 1.0)) - sqrt(t)) - sqrt(y)));
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
}
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((y + 1.0d0))
if (z <= 7300000.0d0) then
tmp = t_1 + ((sqrt((z + 1.0d0)) + ((1.0d0 - sqrt(x)) - sqrt(z))) + ((sqrt((t + 1.0d0)) - sqrt(t)) - sqrt(y)))
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x)))) + (0.5d0 * sqrt((1.0d0 / z)))
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 tmp;
if (z <= 7300000.0) {
tmp = t_1 + ((Math.sqrt((z + 1.0)) + ((1.0 - Math.sqrt(x)) - Math.sqrt(z))) + ((Math.sqrt((t + 1.0)) - Math.sqrt(t)) - Math.sqrt(y)));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 7300000.0: tmp = t_1 + ((math.sqrt((z + 1.0)) + ((1.0 - math.sqrt(x)) - math.sqrt(z))) + ((math.sqrt((t + 1.0)) - math.sqrt(t)) - math.sqrt(y))) else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 7300000.0) tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(z + 1.0)) + Float64(Float64(1.0 - sqrt(x)) - sqrt(z))) + Float64(Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) - sqrt(y)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); 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));
tmp = 0.0;
if (z <= 7300000.0)
tmp = t_1 + ((sqrt((z + 1.0)) + ((1.0 - sqrt(x)) - sqrt(z))) + ((sqrt((t + 1.0)) - sqrt(t)) - sqrt(y)));
else
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
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]}, If[LessEqual[z, 7300000.0], N[(t$95$1 + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $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}\\
\mathbf{if}\;z \leq 7300000:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{z + 1} + \left(\left(1 - \sqrt{x}\right) - \sqrt{z}\right)\right) + \left(\left(\sqrt{t + 1} - \sqrt{t}\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if z < 7.3e6Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-77.9%
associate-+l-68.0%
associate-+r-53.4%
Simplified53.3%
Taylor expanded in x around 0 22.2%
if 7.3e6 < z Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.4%
add-sqr-sqrt71.3%
+-commutative71.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+88.8%
+-inverses88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in t around inf 50.0%
flip--50.1%
add-sqr-sqrt41.4%
add-sqr-sqrt50.8%
Applied egg-rr50.8%
associate--l+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in z around inf 56.6%
Final simplification38.9%
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))))
(if (<= z 8.4e-54)
(+
t_1
(-
(- 2.0 (+ (sqrt z) (sqrt x)))
(- (sqrt y) (- (sqrt (+ t 1.0)) (sqrt t)))))
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
(- (sqrt (+ z 1.0)) (sqrt z))))))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 tmp;
if (z <= 8.4e-54) {
tmp = t_1 + ((2.0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0)) - sqrt(t))));
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (sqrt((z + 1.0)) - sqrt(z));
}
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((y + 1.0d0))
if (z <= 8.4d-54) then
tmp = t_1 + ((2.0d0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0d0)) - sqrt(t))))
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x)))) + (sqrt((z + 1.0d0)) - sqrt(z))
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 tmp;
if (z <= 8.4e-54) {
tmp = t_1 + ((2.0 - (Math.sqrt(z) + Math.sqrt(x))) - (Math.sqrt(y) - (Math.sqrt((t + 1.0)) - Math.sqrt(t))));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 8.4e-54: tmp = t_1 + ((2.0 - (math.sqrt(z) + math.sqrt(x))) - (math.sqrt(y) - (math.sqrt((t + 1.0)) - math.sqrt(t)))) else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)))) + (math.sqrt((z + 1.0)) - math.sqrt(z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 8.4e-54) tmp = Float64(t_1 + Float64(Float64(2.0 - Float64(sqrt(z) + sqrt(x))) - Float64(sqrt(y) - Float64(sqrt(Float64(t + 1.0)) - sqrt(t))))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))); 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));
tmp = 0.0;
if (z <= 8.4e-54)
tmp = t_1 + ((2.0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0)) - sqrt(t))));
else
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (sqrt((z + 1.0)) - sqrt(z));
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]}, If[LessEqual[z, 8.4e-54], N[(t$95$1 + N[(N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] - N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 8.4 \cdot 10^{-54}:\\
\;\;\;\;t\_1 + \left(\left(2 - \left(\sqrt{z} + \sqrt{x}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\\
\end{array}
\end{array}
if z < 8.4e-54Initial program 98.5%
+-commutative98.5%
associate-+r+98.5%
associate-+r-77.4%
associate-+l-66.8%
associate-+r-51.5%
Simplified51.4%
Taylor expanded in x around 0 20.8%
Taylor expanded in z around 0 20.8%
+-commutative20.8%
Simplified20.8%
if 8.4e-54 < z Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
flip--87.4%
add-sqr-sqrt69.8%
+-commutative69.8%
add-sqr-sqrt87.9%
+-commutative87.9%
Applied egg-rr87.9%
associate--l+89.4%
+-inverses89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in t around inf 49.8%
flip--49.8%
add-sqr-sqrt41.7%
add-sqr-sqrt50.4%
Applied egg-rr50.4%
associate--l+52.4%
+-inverses52.4%
metadata-eval52.4%
+-commutative52.4%
Simplified52.4%
Final simplification38.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 (+ y 1.0))))
(if (<= z 2.6e-52)
(+
t_1
(-
(- 2.0 (+ (sqrt z) (sqrt x)))
(- (sqrt y) (- (sqrt (+ t 1.0)) (sqrt t)))))
(if (<= z 7000000.0)
(+
2.0
(-
(+ (sqrt (+ z 1.0)) (* 0.5 (sqrt (/ 1.0 t))))
(+ (+ (sqrt y) (sqrt z)) (sqrt x))))
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
(* 0.5 (sqrt (/ 1.0 z))))))))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 tmp;
if (z <= 2.6e-52) {
tmp = t_1 + ((2.0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0)) - sqrt(t))));
} else if (z <= 7000000.0) {
tmp = 2.0 + ((sqrt((z + 1.0)) + (0.5 * sqrt((1.0 / t)))) - ((sqrt(y) + sqrt(z)) + sqrt(x)));
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
}
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((y + 1.0d0))
if (z <= 2.6d-52) then
tmp = t_1 + ((2.0d0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0d0)) - sqrt(t))))
else if (z <= 7000000.0d0) then
tmp = 2.0d0 + ((sqrt((z + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / t)))) - ((sqrt(y) + sqrt(z)) + sqrt(x)))
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x)))) + (0.5d0 * sqrt((1.0d0 / z)))
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 tmp;
if (z <= 2.6e-52) {
tmp = t_1 + ((2.0 - (Math.sqrt(z) + Math.sqrt(x))) - (Math.sqrt(y) - (Math.sqrt((t + 1.0)) - Math.sqrt(t))));
} else if (z <= 7000000.0) {
tmp = 2.0 + ((Math.sqrt((z + 1.0)) + (0.5 * Math.sqrt((1.0 / t)))) - ((Math.sqrt(y) + Math.sqrt(z)) + Math.sqrt(x)));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 2.6e-52: tmp = t_1 + ((2.0 - (math.sqrt(z) + math.sqrt(x))) - (math.sqrt(y) - (math.sqrt((t + 1.0)) - math.sqrt(t)))) elif z <= 7000000.0: tmp = 2.0 + ((math.sqrt((z + 1.0)) + (0.5 * math.sqrt((1.0 / t)))) - ((math.sqrt(y) + math.sqrt(z)) + math.sqrt(x))) else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 2.6e-52) tmp = Float64(t_1 + Float64(Float64(2.0 - Float64(sqrt(z) + sqrt(x))) - Float64(sqrt(y) - Float64(sqrt(Float64(t + 1.0)) - sqrt(t))))); elseif (z <= 7000000.0) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(z + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / t)))) - Float64(Float64(sqrt(y) + sqrt(z)) + sqrt(x)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); 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));
tmp = 0.0;
if (z <= 2.6e-52)
tmp = t_1 + ((2.0 - (sqrt(z) + sqrt(x))) - (sqrt(y) - (sqrt((t + 1.0)) - sqrt(t))));
elseif (z <= 7000000.0)
tmp = 2.0 + ((sqrt((z + 1.0)) + (0.5 * sqrt((1.0 / t)))) - ((sqrt(y) + sqrt(z)) + sqrt(x)));
else
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
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]}, If[LessEqual[z, 2.6e-52], N[(t$95$1 + N[(N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] - N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7000000.0], N[(2.0 + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $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}\\
\mathbf{if}\;z \leq 2.6 \cdot 10^{-52}:\\
\;\;\;\;t\_1 + \left(\left(2 - \left(\sqrt{z} + \sqrt{x}\right)\right) - \left(\sqrt{y} - \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\right)\\
\mathbf{elif}\;z \leq 7000000:\\
\;\;\;\;2 + \left(\left(\sqrt{z + 1} + 0.5 \cdot \sqrt{\frac{1}{t}}\right) - \left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if z < 2.5999999999999999e-52Initial program 98.5%
+-commutative98.5%
associate-+r+98.5%
associate-+r-77.4%
associate-+l-66.8%
associate-+r-51.5%
Simplified51.4%
Taylor expanded in x around 0 20.8%
Taylor expanded in z around 0 20.8%
+-commutative20.8%
Simplified20.8%
if 2.5999999999999999e-52 < z < 7e6Initial program 93.5%
+-commutative93.5%
associate-+r+93.5%
associate-+r-81.0%
associate-+l-75.4%
associate-+r-64.7%
Simplified64.7%
Taylor expanded in x around 0 30.5%
Taylor expanded in t around inf 16.4%
Taylor expanded in y around 0 16.0%
associate--l+16.0%
Simplified16.0%
if 7e6 < z Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.4%
add-sqr-sqrt71.3%
+-commutative71.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+88.8%
+-inverses88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in t around inf 50.0%
flip--50.1%
add-sqr-sqrt41.4%
add-sqr-sqrt50.8%
Applied egg-rr50.8%
associate--l+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in z around inf 56.6%
Final simplification37.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))))
(if (<= z 30000000.0)
(+
(- (sqrt (+ z 1.0)) (sqrt z))
(+ (- t_1 (sqrt y)) (/ 1.0 (+ 1.0 (sqrt x)))))
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
(* 0.5 (sqrt (/ 1.0 z)))))))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 tmp;
if (z <= 30000000.0) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((t_1 - sqrt(y)) + (1.0 / (1.0 + sqrt(x))));
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
}
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((y + 1.0d0))
if (z <= 30000000.0d0) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + ((t_1 - sqrt(y)) + (1.0d0 / (1.0d0 + sqrt(x))))
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x)))) + (0.5d0 * sqrt((1.0d0 / z)))
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 tmp;
if (z <= 30000000.0) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + ((t_1 - Math.sqrt(y)) + (1.0 / (1.0 + Math.sqrt(x))));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)))) + (0.5 * Math.sqrt((1.0 / z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 30000000.0: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + ((t_1 - math.sqrt(y)) + (1.0 / (1.0 + math.sqrt(x)))) else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)))) + (0.5 * math.sqrt((1.0 / z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 30000000.0) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(Float64(t_1 - sqrt(y)) + Float64(1.0 / Float64(1.0 + sqrt(x))))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); 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));
tmp = 0.0;
if (z <= 30000000.0)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((t_1 - sqrt(y)) + (1.0 / (1.0 + sqrt(x))));
else
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)))) + (0.5 * sqrt((1.0 / z)));
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]}, If[LessEqual[z, 30000000.0], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $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}\\
\mathbf{if}\;z \leq 30000000:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(t\_1 - \sqrt{y}\right) + \frac{1}{1 + \sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\end{array}
\end{array}
if z < 3e7Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.8%
add-sqr-sqrt75.8%
+-commutative75.8%
add-sqr-sqrt98.1%
+-commutative98.1%
Applied egg-rr98.1%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in t around inf 56.4%
Taylor expanded in x around 0 53.4%
if 3e7 < z Initial program 86.2%
associate-+l+86.2%
sub-neg86.2%
sub-neg86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.4%
add-sqr-sqrt71.3%
+-commutative71.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+88.8%
+-inverses88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in t around inf 50.0%
flip--50.1%
add-sqr-sqrt41.4%
add-sqr-sqrt50.8%
Applied egg-rr50.8%
associate--l+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in z around inf 56.6%
Final simplification55.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))))
(if (<= z 4e+17)
(+
(- (sqrt (+ z 1.0)) (sqrt z))
(+ (- t_1 (sqrt y)) (/ 1.0 (+ 1.0 (sqrt x)))))
(+ (/ 1.0 (+ t_1 (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 t_1 = sqrt((y + 1.0));
double tmp;
if (z <= 4e+17) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((t_1 - sqrt(y)) + (1.0 / (1.0 + sqrt(x))));
} else {
tmp = (1.0 / (t_1 + sqrt(y))) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
if (z <= 4d+17) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + ((t_1 - sqrt(y)) + (1.0d0 / (1.0d0 + sqrt(x))))
else
tmp = (1.0d0 / (t_1 + sqrt(y))) + (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 t_1 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 4e+17) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + ((t_1 - Math.sqrt(y)) + (1.0 / (1.0 + Math.sqrt(x))));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(y))) + (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): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 4e+17: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + ((t_1 - math.sqrt(y)) + (1.0 / (1.0 + math.sqrt(x)))) else: tmp = (1.0 / (t_1 + math.sqrt(y))) + (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) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 4e+17) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(Float64(t_1 - sqrt(y)) + Float64(1.0 / Float64(1.0 + sqrt(x))))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + 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)
t_1 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 4e+17)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((t_1 - sqrt(y)) + (1.0 / (1.0 + sqrt(x))));
else
tmp = (1.0 / (t_1 + sqrt(y))) + (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_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4e+17], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $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}\\
\mathbf{if}\;z \leq 4 \cdot 10^{+17}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\left(t\_1 - \sqrt{y}\right) + \frac{1}{1 + \sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if z < 4e17Initial program 95.6%
associate-+l+95.6%
sub-neg95.6%
sub-neg95.6%
+-commutative95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
flip--95.6%
add-sqr-sqrt73.8%
+-commutative73.8%
add-sqr-sqrt95.9%
+-commutative95.9%
Applied egg-rr95.9%
associate--l+96.5%
+-inverses96.5%
metadata-eval96.5%
Simplified96.5%
Taylor expanded in t around inf 55.6%
Taylor expanded in x around 0 52.7%
if 4e17 < z Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
flip--88.4%
add-sqr-sqrt73.5%
+-commutative73.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in t around inf 50.6%
flip--50.7%
add-sqr-sqrt42.4%
add-sqr-sqrt51.4%
Applied egg-rr51.4%
associate--l+53.8%
+-inverses53.8%
metadata-eval53.8%
+-commutative53.8%
Simplified53.8%
Taylor expanded in z around inf 53.8%
+-commutative53.8%
Simplified53.8%
Final simplification53.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 (+ y 1.0))))
(if (<= z 2.45e+17)
(+ (- (- (+ t_1 (sqrt (+ z 1.0))) (sqrt x)) (+ (sqrt y) (sqrt z))) 1.0)
(+ (/ 1.0 (+ t_1 (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 t_1 = sqrt((y + 1.0));
double tmp;
if (z <= 2.45e+17) {
tmp = (((t_1 + sqrt((z + 1.0))) - sqrt(x)) - (sqrt(y) + sqrt(z))) + 1.0;
} else {
tmp = (1.0 / (t_1 + sqrt(y))) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
if (z <= 2.45d+17) then
tmp = (((t_1 + sqrt((z + 1.0d0))) - sqrt(x)) - (sqrt(y) + sqrt(z))) + 1.0d0
else
tmp = (1.0d0 / (t_1 + sqrt(y))) + (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 t_1 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 2.45e+17) {
tmp = (((t_1 + Math.sqrt((z + 1.0))) - Math.sqrt(x)) - (Math.sqrt(y) + Math.sqrt(z))) + 1.0;
} else {
tmp = (1.0 / (t_1 + Math.sqrt(y))) + (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): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 2.45e+17: tmp = (((t_1 + math.sqrt((z + 1.0))) - math.sqrt(x)) - (math.sqrt(y) + math.sqrt(z))) + 1.0 else: tmp = (1.0 / (t_1 + math.sqrt(y))) + (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) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 2.45e+17) tmp = Float64(Float64(Float64(Float64(t_1 + sqrt(Float64(z + 1.0))) - sqrt(x)) - Float64(sqrt(y) + sqrt(z))) + 1.0); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + 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)
t_1 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 2.45e+17)
tmp = (((t_1 + sqrt((z + 1.0))) - sqrt(x)) - (sqrt(y) + sqrt(z))) + 1.0;
else
tmp = (1.0 / (t_1 + sqrt(y))) + (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_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.45e+17], N[(N[(N[(N[(t$95$1 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $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}\\
\mathbf{if}\;z \leq 2.45 \cdot 10^{+17}:\\
\;\;\;\;\left(\left(\left(t\_1 + \sqrt{z + 1}\right) - \sqrt{x}\right) - \left(\sqrt{y} + \sqrt{z}\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if z < 2.45e17Initial program 95.6%
+-commutative95.6%
associate-+r+95.6%
associate-+r-76.2%
associate-+l-66.3%
associate-+r-51.7%
Simplified51.7%
Taylor expanded in t around inf 20.1%
associate--l+24.6%
+-commutative24.6%
+-commutative24.6%
Simplified24.6%
Taylor expanded in x around 0 15.0%
associate--l+23.9%
associate--r+23.9%
+-commutative23.9%
+-commutative23.9%
Simplified23.9%
if 2.45e17 < z Initial program 88.1%
associate-+l+88.1%
sub-neg88.1%
sub-neg88.1%
+-commutative88.1%
+-commutative88.1%
+-commutative88.1%
Simplified88.1%
flip--88.4%
add-sqr-sqrt73.5%
+-commutative73.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in t around inf 50.6%
flip--50.7%
add-sqr-sqrt42.4%
add-sqr-sqrt51.4%
Applied egg-rr51.4%
associate--l+53.8%
+-inverses53.8%
metadata-eval53.8%
+-commutative53.8%
Simplified53.8%
Taylor expanded in z around inf 53.8%
+-commutative53.8%
Simplified53.8%
Final simplification37.7%
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))))
(if (<= z 9.6e+16)
(- (+ (+ t_1 (sqrt (+ z 1.0))) 1.0) (+ (+ (sqrt y) (sqrt z)) (sqrt x)))
(+ (/ 1.0 (+ t_1 (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 t_1 = sqrt((y + 1.0));
double tmp;
if (z <= 9.6e+16) {
tmp = ((t_1 + sqrt((z + 1.0))) + 1.0) - ((sqrt(y) + sqrt(z)) + sqrt(x));
} else {
tmp = (1.0 / (t_1 + sqrt(y))) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
if (z <= 9.6d+16) then
tmp = ((t_1 + sqrt((z + 1.0d0))) + 1.0d0) - ((sqrt(y) + sqrt(z)) + sqrt(x))
else
tmp = (1.0d0 / (t_1 + sqrt(y))) + (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 t_1 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 9.6e+16) {
tmp = ((t_1 + Math.sqrt((z + 1.0))) + 1.0) - ((Math.sqrt(y) + Math.sqrt(z)) + Math.sqrt(x));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(y))) + (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): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 9.6e+16: tmp = ((t_1 + math.sqrt((z + 1.0))) + 1.0) - ((math.sqrt(y) + math.sqrt(z)) + math.sqrt(x)) else: tmp = (1.0 / (t_1 + math.sqrt(y))) + (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) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 9.6e+16) tmp = Float64(Float64(Float64(t_1 + sqrt(Float64(z + 1.0))) + 1.0) - Float64(Float64(sqrt(y) + sqrt(z)) + sqrt(x))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + 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)
t_1 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 9.6e+16)
tmp = ((t_1 + sqrt((z + 1.0))) + 1.0) - ((sqrt(y) + sqrt(z)) + sqrt(x));
else
tmp = (1.0 / (t_1 + sqrt(y))) + (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_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 9.6e+16], N[(N[(N[(t$95$1 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $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}\\
\mathbf{if}\;z \leq 9.6 \cdot 10^{+16}:\\
\;\;\;\;\left(\left(t\_1 + \sqrt{z + 1}\right) + 1\right) - \left(\left(\sqrt{y} + \sqrt{z}\right) + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if z < 9.6e16Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-76.7%
associate-+l-66.8%
associate-+r-52.0%
Simplified52.0%
Taylor expanded in t around inf 20.2%
associate--l+24.8%
+-commutative24.8%
+-commutative24.8%
Simplified24.8%
Taylor expanded in x around 0 15.1%
if 9.6e16 < z Initial program 87.4%
associate-+l+87.4%
sub-neg87.4%
sub-neg87.4%
+-commutative87.4%
+-commutative87.4%
+-commutative87.4%
Simplified87.4%
flip--87.7%
add-sqr-sqrt72.9%
+-commutative72.9%
add-sqr-sqrt88.3%
+-commutative88.3%
Applied egg-rr88.3%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
Simplified90.1%
Taylor expanded in t around inf 50.3%
flip--50.3%
add-sqr-sqrt42.1%
add-sqr-sqrt51.1%
Applied egg-rr51.1%
associate--l+53.4%
+-inverses53.4%
metadata-eval53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in z around inf 53.4%
+-commutative53.4%
Simplified53.4%
Final simplification32.9%
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 5e+15)
(+ t_1 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))
(/ (+ (- x 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 <= 5e+15) {
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = ((x - x) + 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 <= 5d+15) then
tmp = t_1 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = ((x - x) + 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 <= 5e+15) {
tmp = t_1 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = ((x - x) + 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 <= 5e+15: tmp = t_1 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = ((x - x) + 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 <= 5e+15) tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(Float64(x - x) + 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 <= 5e+15)
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = ((x - x) + 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, 5e+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[(N[(N[(x - x), $MachinePrecision] + 1.0), $MachinePrecision] / 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 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - x\right) + 1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5e15Initial program 96.2%
+-commutative96.2%
associate-+r+96.2%
associate-+r-96.1%
associate-+l-96.1%
associate-+r-96.2%
Simplified79.0%
Taylor expanded in t around inf 21.8%
associate--l+26.0%
+-commutative26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in z around inf 22.3%
if 5e15 < y Initial program 87.9%
+-commutative87.9%
associate-+r+87.9%
associate-+r-43.7%
associate-+l-20.8%
associate-+r-4.4%
Simplified4.4%
Taylor expanded in t around inf 3.3%
associate--l+22.7%
+-commutative22.7%
+-commutative22.7%
Simplified22.7%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
flip-+22.8%
add-sqr-sqrt23.0%
pow223.0%
Applied egg-rr23.0%
associate--l+23.9%
unpow223.9%
sqr-neg23.9%
rem-square-sqrt25.7%
sub-neg25.7%
remove-double-neg25.7%
+-commutative25.7%
Simplified25.7%
Final simplification23.9%
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 5e+15)
(- (+ t_1 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x)))
(/ (+ (- x 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 <= 5e+15) {
tmp = (t_1 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = ((x - x) + 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 <= 5d+15) then
tmp = (t_1 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = ((x - x) + 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 <= 5e+15) {
tmp = (t_1 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = ((x - x) + 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 <= 5e+15: tmp = (t_1 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = ((x - x) + 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 <= 5e+15) tmp = Float64(Float64(t_1 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(Float64(Float64(x - x) + 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 <= 5e+15)
tmp = (t_1 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = ((x - x) + 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, 5e+15], N[(N[(t$95$1 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - x), $MachinePrecision] + 1.0), $MachinePrecision] / 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 \cdot 10^{+15}:\\
\;\;\;\;\left(t\_1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - x\right) + 1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5e15Initial program 96.2%
+-commutative96.2%
associate-+r+96.2%
associate-+r-96.1%
associate-+l-96.1%
associate-+r-96.2%
Simplified79.0%
Taylor expanded in t around inf 21.8%
associate--l+26.0%
+-commutative26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in z around inf 22.3%
if 5e15 < y Initial program 87.9%
+-commutative87.9%
associate-+r+87.9%
associate-+r-43.7%
associate-+l-20.8%
associate-+r-4.4%
Simplified4.4%
Taylor expanded in t around inf 3.3%
associate--l+22.7%
+-commutative22.7%
+-commutative22.7%
Simplified22.7%
Taylor expanded in x around inf 22.6%
mul-1-neg22.6%
Simplified22.6%
flip-+22.8%
add-sqr-sqrt23.0%
pow223.0%
Applied egg-rr23.0%
associate--l+23.9%
unpow223.9%
sqr-neg23.9%
rem-square-sqrt25.7%
sub-neg25.7%
remove-double-neg25.7%
+-commutative25.7%
Simplified25.7%
Final simplification23.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (/ 1.0 (+ (sqrt (+ y 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) {
return (1.0 / (sqrt((y + 1.0)) + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)));
}
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 = (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y))) + (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y))) + (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y))) + (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 / (sqrt((y + 1.0)) + sqrt(y))) + (1.0 / (sqrt((x + 1.0)) + sqrt(x)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{y + 1} + \sqrt{y}} + \frac{1}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.3%
add-sqr-sqrt73.6%
+-commutative73.6%
add-sqr-sqrt92.7%
+-commutative92.7%
Applied egg-rr92.7%
associate--l+93.9%
+-inverses93.9%
metadata-eval93.9%
Simplified93.9%
Taylor expanded in t around inf 53.3%
flip--53.3%
add-sqr-sqrt44.1%
add-sqr-sqrt53.7%
Applied egg-rr53.7%
associate--l+54.8%
+-inverses54.8%
metadata-eval54.8%
+-commutative54.8%
Simplified54.8%
Taylor expanded in z around inf 33.6%
+-commutative33.6%
Simplified33.6%
Final simplification33.6%
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 (+ (sqrt (+ x 1.0)) (sqrt x)))))
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 / (sqrt((x + 1.0)) + sqrt(x)));
}
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 / (sqrt((x + 1.0d0)) + sqrt(x)))
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 / (Math.sqrt((x + 1.0)) + Math.sqrt(x)));
}
[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 / (math.sqrt((x + 1.0)) + math.sqrt(x)))
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)) + Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x)))) 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 / (sqrt((x + 1.0)) + sqrt(x)));
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] + N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.3%
add-sqr-sqrt73.6%
+-commutative73.6%
add-sqr-sqrt92.7%
+-commutative92.7%
Applied egg-rr92.7%
associate--l+93.9%
+-inverses93.9%
metadata-eval93.9%
Simplified93.9%
Taylor expanded in t around inf 53.3%
Taylor expanded in z around inf 21.3%
+-commutative21.3%
+-commutative21.3%
associate-+r-32.1%
+-commutative32.1%
+-commutative32.1%
Simplified32.1%
Final simplification32.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ (+ (- x x) 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) {
return ((x - x) + 1.0) / (sqrt((x + 1.0)) + sqrt(x));
}
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 = ((x - x) + 1.0d0) / (sqrt((x + 1.0d0)) + sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((x - x) + 1.0) / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((x - x) + 1.0) / (math.sqrt((x + 1.0)) + math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(x - x) + 1.0) / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((x - x) + 1.0) / (sqrt((x + 1.0)) + sqrt(x));
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[(x - x), $MachinePrecision] + 1.0), $MachinePrecision] / 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])\\
\\
\frac{\left(x - x\right) + 1}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
Initial program 92.2%
+-commutative92.2%
associate-+r+92.2%
associate-+r-71.0%
associate-+l-60.0%
associate-+r-52.1%
Simplified43.2%
Taylor expanded in t around inf 12.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 16.2%
mul-1-neg16.2%
Simplified16.2%
flip-+16.3%
add-sqr-sqrt16.6%
pow216.6%
Applied egg-rr16.6%
associate--l+17.5%
unpow217.5%
sqr-neg17.5%
rem-square-sqrt18.8%
sub-neg18.8%
remove-double-neg18.8%
+-commutative18.8%
Simplified18.8%
Final simplification18.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 (<= x 55000000.0) (- (sqrt (+ x 1.0)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 55000000.0) {
tmp = sqrt((x + 1.0)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / 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 (x <= 55000000.0d0) then
tmp = sqrt((x + 1.0d0)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 (x <= 55000000.0) {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 55000000.0: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 55000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 (x <= 55000000.0)
tmp = sqrt((x + 1.0)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / 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[x, 55000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 55000000:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 5.5e7Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-55.6%
associate-+l-53.1%
associate-+r-49.1%
Simplified31.3%
Taylor expanded in t around inf 19.5%
associate--l+41.1%
+-commutative41.1%
+-commutative41.1%
Simplified41.1%
Taylor expanded in x around inf 28.9%
mul-1-neg28.9%
Simplified28.9%
unsub-neg28.9%
Applied egg-rr28.9%
if 5.5e7 < x Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-86.3%
associate-+l-66.8%
associate-+r-55.1%
Simplified55.1%
Taylor expanded in t around inf 6.3%
associate--l+7.8%
+-commutative7.8%
+-commutative7.8%
Simplified7.8%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 8.7%
Final simplification18.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 (<= x 3.1) (- (+ (* x (+ 0.5 (* x (- (* x 0.0625) 0.125)))) 1.0) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.1) {
tmp = ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) + 1.0) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / 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 (x <= 3.1d0) then
tmp = ((x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0)))) + 1.0d0) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 (x <= 3.1) {
tmp = ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) + 1.0) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 3.1: tmp = ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) + 1.0) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 3.1) tmp = Float64(Float64(Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125)))) + 1.0) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 (x <= 3.1)
tmp = ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) + 1.0) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / 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[x, 3.1], N[(N[(N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1:\\
\;\;\;\;\left(x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right) + 1\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 3.10000000000000009Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-55.3%
associate-+l-52.8%
associate-+r-48.8%
Simplified31.4%
Taylor expanded in t around inf 19.5%
associate--l+41.4%
+-commutative41.4%
+-commutative41.4%
Simplified41.4%
Taylor expanded in x around inf 29.2%
mul-1-neg29.2%
Simplified29.2%
Taylor expanded in x around 0 29.2%
if 3.10000000000000009 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.9%
associate-+l-66.8%
associate-+r-55.2%
Simplified54.4%
Taylor expanded in t around inf 6.6%
associate--l+8.3%
+-commutative8.3%
+-commutative8.3%
Simplified8.3%
Taylor expanded in x around inf 3.9%
mul-1-neg3.9%
Simplified3.9%
Taylor expanded in x around inf 8.9%
Final simplification18.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 (<= x 1.1) (+ (- (* x (+ 0.5 (* x -0.125))) (sqrt x)) 1.0) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.1) {
tmp = ((x * (0.5 + (x * -0.125))) - sqrt(x)) + 1.0;
} else {
tmp = 0.5 * sqrt((1.0 / 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 (x <= 1.1d0) then
tmp = ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x)) + 1.0d0
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 (x <= 1.1) {
tmp = ((x * (0.5 + (x * -0.125))) - Math.sqrt(x)) + 1.0;
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.1: tmp = ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) + 1.0 else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.1) tmp = Float64(Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x)) + 1.0); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 (x <= 1.1)
tmp = ((x * (0.5 + (x * -0.125))) - sqrt(x)) + 1.0;
else
tmp = 0.5 * sqrt((1.0 / 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[x, 1.1], N[(N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1:\\
\;\;\;\;\left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right) + 1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.1000000000000001Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-55.3%
associate-+l-52.8%
associate-+r-48.8%
Simplified31.4%
Taylor expanded in t around inf 19.5%
associate--l+41.4%
+-commutative41.4%
+-commutative41.4%
Simplified41.4%
Taylor expanded in x around inf 29.2%
mul-1-neg29.2%
Simplified29.2%
Taylor expanded in x around 0 29.2%
associate--l+29.2%
*-commutative29.2%
Simplified29.2%
if 1.1000000000000001 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.9%
associate-+l-66.8%
associate-+r-55.2%
Simplified54.4%
Taylor expanded in t around inf 6.6%
associate--l+8.3%
+-commutative8.3%
+-commutative8.3%
Simplified8.3%
Taylor expanded in x around inf 3.9%
mul-1-neg3.9%
Simplified3.9%
Taylor expanded in x around inf 8.9%
Final simplification18.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 (<= x 0.08) (+ (- (* x 0.5) (sqrt x)) 1.0) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.08) {
tmp = ((x * 0.5) - sqrt(x)) + 1.0;
} else {
tmp = 0.5 * sqrt((1.0 / 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 (x <= 0.08d0) then
tmp = ((x * 0.5d0) - sqrt(x)) + 1.0d0
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 (x <= 0.08) {
tmp = ((x * 0.5) - Math.sqrt(x)) + 1.0;
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.08: tmp = ((x * 0.5) - math.sqrt(x)) + 1.0 else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.08) tmp = Float64(Float64(Float64(x * 0.5) - sqrt(x)) + 1.0); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 (x <= 0.08)
tmp = ((x * 0.5) - sqrt(x)) + 1.0;
else
tmp = 0.5 * sqrt((1.0 / 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[x, 0.08], N[(N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.08:\\
\;\;\;\;\left(x \cdot 0.5 - \sqrt{x}\right) + 1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.0800000000000000017Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-55.3%
associate-+l-52.8%
associate-+r-48.8%
Simplified31.4%
Taylor expanded in t around inf 19.5%
associate--l+41.4%
+-commutative41.4%
+-commutative41.4%
Simplified41.4%
Taylor expanded in x around inf 29.2%
mul-1-neg29.2%
Simplified29.2%
Taylor expanded in x around 0 29.2%
associate--l+29.2%
*-commutative29.2%
Simplified29.2%
if 0.0800000000000000017 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.9%
associate-+l-66.8%
associate-+r-55.2%
Simplified54.4%
Taylor expanded in t around inf 6.6%
associate--l+8.3%
+-commutative8.3%
+-commutative8.3%
Simplified8.3%
Taylor expanded in x around inf 3.9%
mul-1-neg3.9%
Simplified3.9%
Taylor expanded in x around inf 8.9%
Final simplification18.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 (<= x 0.122) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.122) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / 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 (x <= 0.122d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 (x <= 0.122) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.122: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.122) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 (x <= 0.122)
tmp = 1.0 - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / 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[x, 0.122], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.122:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.122Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r-55.3%
associate-+l-52.8%
associate-+r-48.8%
Simplified31.4%
Taylor expanded in t around inf 19.5%
associate--l+41.4%
+-commutative41.4%
+-commutative41.4%
Simplified41.4%
Taylor expanded in x around inf 29.2%
mul-1-neg29.2%
Simplified29.2%
Taylor expanded in x around 0 29.2%
if 0.122 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.9%
associate-+l-66.8%
associate-+r-55.2%
Simplified54.4%
Taylor expanded in t around inf 6.6%
associate--l+8.3%
+-commutative8.3%
+-commutative8.3%
Simplified8.3%
Taylor expanded in x around inf 3.9%
mul-1-neg3.9%
Simplified3.9%
Taylor expanded in x around inf 8.9%
Final simplification18.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
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 = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 92.2%
+-commutative92.2%
associate-+r+92.2%
associate-+r-71.0%
associate-+l-60.0%
associate-+r-52.1%
Simplified43.2%
Taylor expanded in t around inf 12.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 16.2%
mul-1-neg16.2%
Simplified16.2%
Taylor expanded in x around 0 14.9%
Final simplification14.9%
(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 2024050
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 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))))