
(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 17 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 (- t_1 (sqrt z))) (t_3 (sqrt (+ y 1.0))))
(if (<= t_2 0.2)
(+
(+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ t_3 (sqrt y))))
(/ 1.0 (+ t_1 (sqrt z))))
(+
(- (+ t_3 1.0) (sqrt y))
(+ t_2 (/ 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((z + 1.0));
double t_2 = t_1 - sqrt(z);
double t_3 = sqrt((y + 1.0));
double tmp;
if (t_2 <= 0.2) {
tmp = ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (1.0 / (t_1 + sqrt(z)));
} else {
tmp = ((t_3 + 1.0) - sqrt(y)) + (t_2 + (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) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((y + 1.0d0))
if (t_2 <= 0.2d0) then
tmp = ((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + (1.0d0 / (t_1 + sqrt(z)))
else
tmp = ((t_3 + 1.0d0) - sqrt(y)) + (t_2 + (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((z + 1.0));
double t_2 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((y + 1.0));
double tmp;
if (t_2 <= 0.2) {
tmp = ((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + (1.0 / (t_1 + Math.sqrt(z)));
} else {
tmp = ((t_3 + 1.0) - Math.sqrt(y)) + (t_2 + (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((z + 1.0)) t_2 = t_1 - math.sqrt(z) t_3 = math.sqrt((y + 1.0)) tmp = 0 if t_2 <= 0.2: tmp = ((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + (1.0 / (t_1 + math.sqrt(z))) else: tmp = ((t_3 + 1.0) - math.sqrt(y)) + (t_2 + (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(z + 1.0)) t_2 = Float64(t_1 - sqrt(z)) t_3 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (t_2 <= 0.2) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + Float64(1.0 / Float64(t_1 + sqrt(z)))); else tmp = Float64(Float64(Float64(t_3 + 1.0) - sqrt(y)) + Float64(t_2 + 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((z + 1.0));
t_2 = t_1 - sqrt(z);
t_3 = sqrt((y + 1.0));
tmp = 0.0;
if (t_2 <= 0.2)
tmp = ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (1.0 / (t_1 + sqrt(z)));
else
tmp = ((t_3 + 1.0) - sqrt(y)) + (t_2 + (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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.2], N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$3 + 1.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + 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{z + 1}\\
t_2 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{y + 1}\\
\mathbf{if}\;t\_2 \leq 0.2:\\
\;\;\;\;\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{t\_3 + \sqrt{y}}\right) + \frac{1}{t\_1 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_3 + 1\right) - \sqrt{y}\right) + \left(t\_2 + \frac{1}{\sqrt{t + 1} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.20000000000000001Initial program 89.4%
associate-+l+89.4%
sub-neg89.4%
sub-neg89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
flip--89.4%
div-inv89.4%
add-sqr-sqrt69.0%
+-commutative69.0%
add-sqr-sqrt89.4%
+-commutative89.4%
Applied egg-rr89.4%
associate--l+90.4%
+-inverses90.4%
metadata-eval90.4%
*-lft-identity90.4%
Simplified90.4%
flip--90.6%
div-inv90.6%
add-sqr-sqrt74.8%
add-sqr-sqrt90.5%
associate--l+92.2%
Applied egg-rr92.2%
+-inverses92.2%
metadata-eval92.2%
*-lft-identity92.2%
Simplified92.2%
flip--92.8%
div-inv92.8%
add-sqr-sqrt57.9%
add-sqr-sqrt93.9%
associate--l+96.2%
Applied egg-rr96.2%
+-inverses96.2%
metadata-eval96.2%
*-lft-identity96.2%
Simplified96.2%
Taylor expanded in t around inf 56.7%
if 0.20000000000000001 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
flip--97.8%
div-inv97.8%
add-sqr-sqrt74.4%
+-commutative74.4%
add-sqr-sqrt98.0%
associate--l+98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate-+r-98.0%
+-commutative98.0%
associate-+r-98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in x around 0 53.0%
Final simplification54.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 (+ 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)))))
assert(x < y && y < z && z < 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)));
}
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 + 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
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 + 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)));
}
[x, y, z, t] = sort([x, y, z, 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)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 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(Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
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
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 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[(N[(1.0 / 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]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \left(\frac{1}{\sqrt{z + 1} + \sqrt{z}} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)
\end{array}
Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
flip--93.6%
div-inv93.6%
add-sqr-sqrt73.8%
+-commutative73.8%
add-sqr-sqrt93.6%
+-commutative93.6%
Applied egg-rr93.6%
associate--l+94.3%
+-inverses94.3%
metadata-eval94.3%
*-lft-identity94.3%
Simplified94.3%
flip--94.4%
div-inv94.4%
add-sqr-sqrt76.5%
add-sqr-sqrt94.4%
associate--l+95.6%
Applied egg-rr95.6%
+-inverses95.6%
metadata-eval95.6%
*-lft-identity95.6%
Simplified95.6%
flip--95.9%
div-inv95.9%
add-sqr-sqrt77.8%
add-sqr-sqrt96.4%
associate--l+97.7%
Applied egg-rr97.7%
+-inverses97.7%
metadata-eval97.7%
*-lft-identity97.7%
Simplified97.7%
Final simplification97.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 (+ z 1.0))) (t_2 (sqrt (+ y 1.0))))
(if (<= t 1.1e-9)
(- (+ 2.0 (+ t_2 t_1)) (+ (sqrt y) (sqrt z)))
(+
(/ 1.0 (+ t_1 (sqrt z)))
(+ (/ 1.0 (+ t_2 (sqrt y))) (- (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((z + 1.0));
double t_2 = sqrt((y + 1.0));
double tmp;
if (t <= 1.1e-9) {
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
} else {
tmp = (1.0 / (t_1 + sqrt(z))) + ((1.0 / (t_2 + sqrt(y))) + (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) :: t_2
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (t <= 1.1d-9) then
tmp = (2.0d0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z))
else
tmp = (1.0d0 / (t_1 + sqrt(z))) + ((1.0d0 / (t_2 + sqrt(y))) + (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((z + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (t <= 1.1e-9) {
tmp = (2.0 + (t_2 + t_1)) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(z))) + ((1.0 / (t_2 + Math.sqrt(y))) + (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((z + 1.0)) t_2 = math.sqrt((y + 1.0)) tmp = 0 if t <= 1.1e-9: tmp = (2.0 + (t_2 + t_1)) - (math.sqrt(y) + math.sqrt(z)) else: tmp = (1.0 / (t_1 + math.sqrt(z))) + ((1.0 / (t_2 + math.sqrt(y))) + (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(z + 1.0)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (t <= 1.1e-9) tmp = Float64(Float64(2.0 + Float64(t_2 + t_1)) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + 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((z + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (t <= 1.1e-9)
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
else
tmp = (1.0 / (t_1 + sqrt(z))) + ((1.0 / (t_2 + sqrt(y))) + (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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.1e-9], N[(N[(2.0 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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{z + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;t \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;\left(2 + \left(t\_2 + t\_1\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{z}} + \left(\frac{1}{t\_2 + \sqrt{y}} + \left(\sqrt{x + 1} - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if t < 1.0999999999999999e-9Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in t around 0 96.3%
Taylor expanded in x around 0 16.6%
if 1.0999999999999999e-9 < t Initial program 90.1%
associate-+l+90.1%
sub-neg90.1%
sub-neg90.1%
+-commutative90.1%
+-commutative90.1%
+-commutative90.1%
Simplified90.1%
flip--91.2%
div-inv91.2%
add-sqr-sqrt73.8%
add-sqr-sqrt91.3%
associate--l+93.2%
Applied egg-rr92.4%
+-inverses93.2%
metadata-eval93.2%
*-lft-identity93.2%
Simplified92.4%
Taylor expanded in t around inf 88.7%
flip--93.6%
div-inv93.6%
add-sqr-sqrt76.6%
add-sqr-sqrt94.1%
associate--l+96.1%
Applied egg-rr91.0%
+-inverses96.1%
metadata-eval96.1%
*-lft-identity96.1%
Simplified91.0%
Final simplification59.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 (+ z 1.0))) (t_2 (sqrt (+ y 1.0))))
(if (<= t 1.7e-10)
(- (+ 2.0 (+ t_2 t_1)) (+ (sqrt y) (sqrt z)))
(+
(+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ t_2 (sqrt y))))
(- t_1 (sqrt z))))))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 tmp;
if (t <= 1.7e-10) {
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
} else {
tmp = ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (t_2 + sqrt(y)))) + (t_1 - 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) :: t_2
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (t <= 1.7d-10) then
tmp = (2.0d0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z))
else
tmp = ((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (t_2 + sqrt(y)))) + (t_1 - 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((z + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (t <= 1.7e-10) {
tmp = (2.0 + (t_2 + t_1)) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = ((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (t_2 + Math.sqrt(y)))) + (t_1 - Math.sqrt(z));
}
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)) tmp = 0 if t <= 1.7e-10: tmp = (2.0 + (t_2 + t_1)) - (math.sqrt(y) + math.sqrt(z)) else: tmp = ((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (t_2 + math.sqrt(y)))) + (t_1 - math.sqrt(z)) 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)) tmp = 0.0 if (t <= 1.7e-10) tmp = Float64(Float64(2.0 + Float64(t_2 + t_1)) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(t_2 + sqrt(y)))) + Float64(t_1 - 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((z + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (t <= 1.7e-10)
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
else
tmp = ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (t_2 + sqrt(y)))) + (t_1 - 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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.7e-10], N[(N[(2.0 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - 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{z + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;t \leq 1.7 \cdot 10^{-10}:\\
\;\;\;\;\left(2 + \left(t\_2 + t\_1\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{t\_2 + \sqrt{y}}\right) + \left(t\_1 - \sqrt{z}\right)\\
\end{array}
\end{array}
if t < 1.70000000000000007e-10Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around 0 96.8%
Taylor expanded in x around 0 16.7%
if 1.70000000000000007e-10 < t Initial program 90.1%
associate-+l+90.1%
sub-neg90.1%
sub-neg90.1%
+-commutative90.1%
+-commutative90.1%
+-commutative90.1%
Simplified90.1%
flip--90.5%
div-inv90.5%
add-sqr-sqrt71.8%
+-commutative71.8%
add-sqr-sqrt90.5%
+-commutative90.5%
Applied egg-rr90.5%
associate--l+91.1%
+-inverses91.1%
metadata-eval91.1%
*-lft-identity91.1%
Simplified91.1%
flip--91.3%
div-inv91.3%
add-sqr-sqrt74.0%
add-sqr-sqrt91.4%
associate--l+93.2%
Applied egg-rr93.2%
+-inverses93.2%
metadata-eval93.2%
*-lft-identity93.2%
Simplified93.2%
Taylor expanded in t around inf 89.0%
Final simplification59.1%
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)) (sqrt z))) (t_2 (sqrt (+ y 1.0))))
(if (<= y 9.5e-5)
(+ (- (+ t_2 1.0) (sqrt y)) (+ t_1 (/ 1.0 (+ (sqrt (+ t 1.0)) (sqrt t)))))
(+
(+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ t_2 (sqrt y))))
t_1))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0)) - sqrt(z);
double t_2 = sqrt((y + 1.0));
double tmp;
if (y <= 9.5e-5) {
tmp = ((t_2 + 1.0) - sqrt(y)) + (t_1 + (1.0 / (sqrt((t + 1.0)) + sqrt(t))));
} else {
tmp = ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (t_2 + sqrt(y)))) + 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((z + 1.0d0)) - sqrt(z)
t_2 = sqrt((y + 1.0d0))
if (y <= 9.5d-5) then
tmp = ((t_2 + 1.0d0) - sqrt(y)) + (t_1 + (1.0d0 / (sqrt((t + 1.0d0)) + sqrt(t))))
else
tmp = ((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (t_2 + sqrt(y)))) + 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((z + 1.0)) - Math.sqrt(z);
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (y <= 9.5e-5) {
tmp = ((t_2 + 1.0) - Math.sqrt(y)) + (t_1 + (1.0 / (Math.sqrt((t + 1.0)) + Math.sqrt(t))));
} else {
tmp = ((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (t_2 + Math.sqrt(y)))) + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) - math.sqrt(z) t_2 = math.sqrt((y + 1.0)) tmp = 0 if y <= 9.5e-5: tmp = ((t_2 + 1.0) - math.sqrt(y)) + (t_1 + (1.0 / (math.sqrt((t + 1.0)) + math.sqrt(t)))) else: tmp = ((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (t_2 + math.sqrt(y)))) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (y <= 9.5e-5) tmp = Float64(Float64(Float64(t_2 + 1.0) - sqrt(y)) + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(t + 1.0)) + sqrt(t))))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(t_2 + sqrt(y)))) + 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((z + 1.0)) - sqrt(z);
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (y <= 9.5e-5)
tmp = ((t_2 + 1.0) - sqrt(y)) + (t_1 + (1.0 / (sqrt((t + 1.0)) + sqrt(t))));
else
tmp = ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (t_2 + sqrt(y)))) + 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[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 9.5e-5], N[(N[(N[(t$95$2 + 1.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1} - \sqrt{z}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;y \leq 9.5 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(t\_2 + 1\right) - \sqrt{y}\right) + \left(t\_1 + \frac{1}{\sqrt{t + 1} + \sqrt{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{t\_2 + \sqrt{y}}\right) + t\_1\\
\end{array}
\end{array}
if y < 9.5000000000000005e-5Initial program 97.0%
associate-+l+97.0%
sub-neg97.0%
sub-neg97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--97.3%
div-inv97.3%
add-sqr-sqrt74.7%
+-commutative74.7%
add-sqr-sqrt97.5%
associate--l+97.5%
Applied egg-rr97.5%
associate-*r/97.5%
*-rgt-identity97.5%
associate-+r-97.5%
+-commutative97.5%
associate-+r-98.1%
+-inverses98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in x around 0 52.8%
if 9.5000000000000005e-5 < y Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
flip--88.9%
div-inv88.9%
add-sqr-sqrt70.9%
+-commutative70.9%
add-sqr-sqrt88.9%
+-commutative88.9%
Applied egg-rr88.9%
associate--l+89.8%
+-inverses89.8%
metadata-eval89.8%
*-lft-identity89.8%
Simplified89.8%
flip--90.0%
div-inv90.0%
add-sqr-sqrt49.9%
add-sqr-sqrt90.1%
associate--l+92.7%
Applied egg-rr92.7%
+-inverses92.7%
metadata-eval92.7%
*-lft-identity92.7%
Simplified92.7%
Taylor expanded in t around inf 55.9%
Final simplification54.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 (<= (- t_1 (sqrt x)) 1.0)
(/ 1.0 (+ t_1 (sqrt x)))
(+
(- (sqrt (+ z 1.0)) (sqrt z))
(+ (/ 1.0 (+ (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) {
double t_1 = sqrt((x + 1.0));
double tmp;
if ((t_1 - sqrt(x)) <= 1.0) {
tmp = 1.0 / (t_1 + sqrt(x));
} else {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 / (sqrt((y + 1.0)) + sqrt(y))) + 1.0);
}
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 ((t_1 - sqrt(x)) <= 1.0d0) then
tmp = 1.0d0 / (t_1 + sqrt(x))
else
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + ((1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y))) + 1.0d0)
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 ((t_1 - Math.sqrt(x)) <= 1.0) {
tmp = 1.0 / (t_1 + Math.sqrt(x));
} else {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y))) + 1.0);
}
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 (t_1 - math.sqrt(x)) <= 1.0: tmp = 1.0 / (t_1 + math.sqrt(x)) else: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + ((1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y))) + 1.0) 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 (Float64(t_1 - sqrt(x)) <= 1.0) tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); else tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y))) + 1.0)); 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 ((t_1 - sqrt(x)) <= 1.0)
tmp = 1.0 / (t_1 + sqrt(x));
else
tmp = (sqrt((z + 1.0)) - sqrt(z)) + ((1.0 / (sqrt((y + 1.0)) + sqrt(y))) + 1.0);
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[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1.0], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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}\;t\_1 - \sqrt{x} \leq 1:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{y + 1} + \sqrt{y}} + 1\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 1Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in t around inf 57.6%
Taylor expanded in y around inf 30.6%
Taylor expanded in z around inf 15.3%
flip--15.3%
div-inv15.3%
add-sqr-sqrt15.8%
add-sqr-sqrt15.3%
Applied egg-rr15.3%
associate-*r/15.3%
*-rgt-identity15.3%
associate--l+17.2%
+-inverses17.2%
metadata-eval17.2%
Simplified17.2%
if 1 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
flip--94.4%
div-inv94.4%
add-sqr-sqrt76.5%
add-sqr-sqrt94.4%
associate--l+95.6%
Applied egg-rr94.8%
+-inverses95.6%
metadata-eval95.6%
*-lft-identity95.6%
Simplified94.8%
Taylor expanded in t around inf 59.2%
Taylor expanded in x around 0 53.6%
+-commutative53.6%
Simplified53.6%
Final simplification17.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))))
(if (<= t 7.6e-10)
(- (+ 2.0 (+ t_2 t_1)) (+ (sqrt y) (sqrt z)))
(+
(- t_1 (sqrt z))
(+ (/ 1.0 (+ t_2 (sqrt y))) (- (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((z + 1.0));
double t_2 = sqrt((y + 1.0));
double tmp;
if (t <= 7.6e-10) {
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (t_2 + sqrt(y))) + (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) :: t_2
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (t <= 7.6d-10) then
tmp = (2.0d0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (t_2 + sqrt(y))) + (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((z + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (t <= 7.6e-10) {
tmp = (2.0 + (t_2 + t_1)) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (t_2 + Math.sqrt(y))) + (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((z + 1.0)) t_2 = math.sqrt((y + 1.0)) tmp = 0 if t <= 7.6e-10: tmp = (2.0 + (t_2 + t_1)) - (math.sqrt(y) + math.sqrt(z)) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (t_2 + math.sqrt(y))) + (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(z + 1.0)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (t <= 7.6e-10) tmp = Float64(Float64(2.0 + Float64(t_2 + t_1)) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + 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((z + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (t <= 7.6e-10)
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (t_2 + sqrt(y))) + (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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 7.6e-10], N[(N[(2.0 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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{z + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;t \leq 7.6 \cdot 10^{-10}:\\
\;\;\;\;\left(2 + \left(t\_2 + t\_1\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{t\_2 + \sqrt{y}} + \left(\sqrt{x + 1} - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if t < 7.5999999999999996e-10Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in t around 0 96.3%
Taylor expanded in x around 0 16.6%
if 7.5999999999999996e-10 < t Initial program 90.1%
associate-+l+90.1%
sub-neg90.1%
sub-neg90.1%
+-commutative90.1%
+-commutative90.1%
+-commutative90.1%
Simplified90.1%
flip--91.2%
div-inv91.2%
add-sqr-sqrt73.8%
add-sqr-sqrt91.3%
associate--l+93.2%
Applied egg-rr92.4%
+-inverses93.2%
metadata-eval93.2%
*-lft-identity93.2%
Simplified92.4%
Taylor expanded in t around inf 88.7%
Final simplification58.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 (+ z 1.0))) (t_2 (sqrt (+ y 1.0))))
(if (<= t 3.5e-10)
(- (+ 2.0 (+ t_2 t_1)) (+ (sqrt y) (sqrt z)))
(+
(- t_1 (sqrt z))
(+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (- t_2 (sqrt y)))))))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 tmp;
if (t <= 3.5e-10) {
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (t_2 - 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((z + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (t <= 3.5d-10) then
tmp = (2.0d0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (t_2 - 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((z + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (t <= 3.5e-10) {
tmp = (2.0 + (t_2 + t_1)) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (t_2 - Math.sqrt(y)));
}
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)) tmp = 0 if t <= 3.5e-10: tmp = (2.0 + (t_2 + t_1)) - (math.sqrt(y) + math.sqrt(z)) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (t_2 - math.sqrt(y))) 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)) tmp = 0.0 if (t <= 3.5e-10) tmp = Float64(Float64(2.0 + Float64(t_2 + t_1)) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(t_2 - 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((z + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (t <= 3.5e-10)
tmp = (2.0 + (t_2 + t_1)) - (sqrt(y) + sqrt(z));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (t_2 - 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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3.5e-10], N[(N[(2.0 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - 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{z + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;t \leq 3.5 \cdot 10^{-10}:\\
\;\;\;\;\left(2 + \left(t\_2 + t\_1\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \left(t\_2 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 3.4999999999999998e-10Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around 0 96.8%
Taylor expanded in x around 0 16.7%
if 3.4999999999999998e-10 < t Initial program 90.1%
associate-+l+90.1%
sub-neg90.1%
sub-neg90.1%
+-commutative90.1%
+-commutative90.1%
+-commutative90.1%
Simplified90.1%
flip--90.5%
div-inv90.5%
add-sqr-sqrt71.8%
+-commutative71.8%
add-sqr-sqrt90.5%
+-commutative90.5%
Applied egg-rr90.5%
associate--l+91.1%
+-inverses91.1%
metadata-eval91.1%
*-lft-identity91.1%
Simplified91.1%
Taylor expanded in t around inf 86.9%
Final simplification57.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 2.15e+19) (+ (- (sqrt (+ y 1.0)) (sqrt y)) (+ (- (sqrt (+ z 1.0)) (sqrt z)) 1.0)) (/ 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 <= 2.15e+19) {
tmp = (sqrt((y + 1.0)) - sqrt(y)) + ((sqrt((z + 1.0)) - sqrt(z)) + 1.0);
} 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 <= 2.15d+19) then
tmp = (sqrt((y + 1.0d0)) - sqrt(y)) + ((sqrt((z + 1.0d0)) - sqrt(z)) + 1.0d0)
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 <= 2.15e+19) {
tmp = (Math.sqrt((y + 1.0)) - Math.sqrt(y)) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 1.0);
} 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 <= 2.15e+19: tmp = (math.sqrt((y + 1.0)) - math.sqrt(y)) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) + 1.0) 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 <= 2.15e+19) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 1.0)); 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 <= 2.15e+19)
tmp = (sqrt((y + 1.0)) - sqrt(y)) + ((sqrt((z + 1.0)) - sqrt(z)) + 1.0);
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, 2.15e+19], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 1.0), $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 2.15 \cdot 10^{+19}:\\
\;\;\;\;\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.15e19Initial program 96.0%
associate-+l+96.0%
sub-neg96.0%
sub-neg96.0%
+-commutative96.0%
+-commutative96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in t around 0 52.7%
Taylor expanded in x around inf 54.2%
if 2.15e19 < y Initial program 89.7%
associate-+l+89.7%
sub-neg89.7%
sub-neg89.7%
+-commutative89.7%
+-commutative89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in t around inf 52.6%
Taylor expanded in y around inf 52.6%
Taylor expanded in z around inf 22.7%
flip--22.7%
div-inv22.7%
add-sqr-sqrt23.1%
add-sqr-sqrt22.7%
Applied egg-rr22.7%
associate-*r/22.7%
*-rgt-identity22.7%
associate--l+24.7%
+-inverses24.7%
metadata-eval24.7%
Simplified24.7%
Final simplification41.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 2.15e+19) (+ (+ (sqrt (+ y 1.0)) 1.0) (- (- (sqrt (+ z 1.0)) (sqrt z)) (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 <= 2.15e+19) {
tmp = (sqrt((y + 1.0)) + 1.0) + ((sqrt((z + 1.0)) - sqrt(z)) - 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 <= 2.15d+19) then
tmp = (sqrt((y + 1.0d0)) + 1.0d0) + ((sqrt((z + 1.0d0)) - sqrt(z)) - 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 <= 2.15e+19) {
tmp = (Math.sqrt((y + 1.0)) + 1.0) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) - 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 <= 2.15e+19: tmp = (math.sqrt((y + 1.0)) + 1.0) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) - 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 <= 2.15e+19) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) + 1.0) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) - 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 <= 2.15e+19)
tmp = (sqrt((y + 1.0)) + 1.0) + ((sqrt((z + 1.0)) - sqrt(z)) - 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, 2.15e+19], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{+19}:\\
\;\;\;\;\left(\sqrt{y + 1} + 1\right) + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.15e19Initial program 96.0%
associate-+l+96.0%
sub-neg96.0%
sub-neg96.0%
+-commutative96.0%
+-commutative96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in t around inf 61.2%
Taylor expanded in x around 0 54.2%
associate-+l-54.2%
+-rgt-identity54.2%
Applied egg-rr54.2%
if 2.15e19 < y Initial program 89.7%
associate-+l+89.7%
sub-neg89.7%
sub-neg89.7%
+-commutative89.7%
+-commutative89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in t around inf 52.6%
Taylor expanded in y around inf 52.6%
Taylor expanded in z around inf 22.7%
flip--22.7%
div-inv22.7%
add-sqr-sqrt23.1%
add-sqr-sqrt22.7%
Applied egg-rr22.7%
associate-*r/22.7%
*-rgt-identity22.7%
associate--l+24.7%
+-inverses24.7%
metadata-eval24.7%
Simplified24.7%
Final simplification41.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 2.7e-25)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0)
(if (<= y 2.9e+15)
(+ (- (sqrt (+ y 1.0)) (sqrt y)) 1.0)
(/ 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 <= 2.7e-25) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else if (y <= 2.9e+15) {
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
} 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 <= 2.7d-25) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else if (y <= 2.9d+15) then
tmp = (sqrt((y + 1.0d0)) - sqrt(y)) + 1.0d0
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 <= 2.7e-25) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2.9e+15) {
tmp = (Math.sqrt((y + 1.0)) - Math.sqrt(y)) + 1.0;
} 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 <= 2.7e-25: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 elif y <= 2.9e+15: tmp = (math.sqrt((y + 1.0)) - math.sqrt(y)) + 1.0 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 <= 2.7e-25) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); elseif (y <= 2.9e+15) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + 1.0); 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 <= 2.7e-25)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
elseif (y <= 2.9e+15)
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
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, 2.7e-25], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.9e+15], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + 1.0), $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 2.7 \cdot 10^{-25}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+15}:\\
\;\;\;\;\left(\sqrt{y + 1} - \sqrt{y}\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.70000000000000016e-25Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in t around 0 53.5%
Taylor expanded in x around inf 29.8%
associate--l+48.6%
+-commutative48.6%
+-commutative48.6%
Simplified48.6%
Taylor expanded in y around 0 29.8%
associate--l+54.7%
Simplified54.7%
if 2.70000000000000016e-25 < y < 2.9e15Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in t around 0 50.4%
Taylor expanded in x around inf 43.9%
associate--l+59.4%
+-commutative59.4%
+-commutative59.4%
Simplified59.4%
Taylor expanded in z around inf 41.6%
if 2.9e15 < y Initial program 88.7%
associate-+l+88.7%
sub-neg88.7%
sub-neg88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 52.3%
Taylor expanded in y around inf 52.3%
Taylor expanded in z around inf 22.4%
flip--22.3%
div-inv22.3%
add-sqr-sqrt22.8%
add-sqr-sqrt22.3%
Applied egg-rr22.3%
associate-*r/22.3%
*-rgt-identity22.3%
associate--l+24.3%
+-inverses24.3%
metadata-eval24.3%
Simplified24.3%
Final simplification41.1%
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)) (sqrt x)))) (if (<= y 6.4) (+ 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)) - sqrt(x);
double tmp;
if (y <= 6.4) {
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)) - sqrt(x)
if (y <= 6.4d0) 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)) - Math.sqrt(x);
double tmp;
if (y <= 6.4) {
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)) - math.sqrt(x) tmp = 0 if y <= 6.4: 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 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (y <= 6.4) 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)) - sqrt(x);
tmp = 0.0;
if (y <= 6.4)
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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.4], 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} - \sqrt{x}\\
\mathbf{if}\;y \leq 6.4:\\
\;\;\;\;t\_1 + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < 6.4000000000000004Initial program 97.0%
associate-+l+97.0%
sub-neg97.0%
sub-neg97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in t around inf 61.3%
Taylor expanded in y around inf 14.1%
Taylor expanded in z around 0 21.0%
associate--l+40.5%
Simplified40.5%
if 6.4000000000000004 < y Initial program 88.6%
associate-+l+88.6%
sub-neg88.6%
sub-neg88.6%
+-commutative88.6%
+-commutative88.6%
+-commutative88.6%
Simplified88.6%
Taylor expanded in t around inf 52.8%
Taylor expanded in y around inf 52.1%
Taylor expanded in z around inf 22.4%
Final simplification32.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 2.3e+14) (+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0) (+ (- (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) {
double tmp;
if (z <= 2.3e+14) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else {
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
}
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 (z <= 2.3d+14) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else
tmp = (sqrt((y + 1.0d0)) - sqrt(y)) + 1.0d0
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 (z <= 2.3e+14) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else {
tmp = (Math.sqrt((y + 1.0)) - Math.sqrt(y)) + 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 2.3e+14: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 else: tmp = (math.sqrt((y + 1.0)) - math.sqrt(y)) + 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 2.3e+14) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); else tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + 1.0); 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 (z <= 2.3e+14)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
else
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
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[z, 2.3e+14], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+14}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{y + 1} - \sqrt{y}\right) + 1\\
\end{array}
\end{array}
if z < 2.3e14Initial program 96.5%
associate-+l+96.5%
sub-neg96.5%
sub-neg96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in t around 0 49.2%
Taylor expanded in x around inf 32.5%
associate--l+50.1%
+-commutative50.1%
+-commutative50.1%
Simplified50.1%
Taylor expanded in y around 0 45.8%
associate--l+45.8%
Simplified45.8%
if 2.3e14 < z Initial program 90.2%
associate-+l+90.2%
sub-neg90.2%
sub-neg90.2%
+-commutative90.2%
+-commutative90.2%
+-commutative90.2%
Simplified90.2%
Taylor expanded in t around 0 53.3%
Taylor expanded in x around inf 6.5%
associate--l+49.4%
+-commutative49.4%
+-commutative49.4%
Simplified49.4%
Taylor expanded in z around inf 55.3%
Final simplification50.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 43000000000000.0) (- (+ (sqrt (+ z 1.0)) 2.0) (sqrt z)) (+ (- (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) {
double tmp;
if (z <= 43000000000000.0) {
tmp = (sqrt((z + 1.0)) + 2.0) - sqrt(z);
} else {
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
}
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 (z <= 43000000000000.0d0) then
tmp = (sqrt((z + 1.0d0)) + 2.0d0) - sqrt(z)
else
tmp = (sqrt((y + 1.0d0)) - sqrt(y)) + 1.0d0
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 (z <= 43000000000000.0) {
tmp = (Math.sqrt((z + 1.0)) + 2.0) - Math.sqrt(z);
} else {
tmp = (Math.sqrt((y + 1.0)) - Math.sqrt(y)) + 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 43000000000000.0: tmp = (math.sqrt((z + 1.0)) + 2.0) - math.sqrt(z) else: tmp = (math.sqrt((y + 1.0)) - math.sqrt(y)) + 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 43000000000000.0) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) + 2.0) - sqrt(z)); else tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + 1.0); 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 (z <= 43000000000000.0)
tmp = (sqrt((z + 1.0)) + 2.0) - sqrt(z);
else
tmp = (sqrt((y + 1.0)) - sqrt(y)) + 1.0;
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[z, 43000000000000.0], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 43000000000000:\\
\;\;\;\;\left(\sqrt{z + 1} + 2\right) - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{y + 1} - \sqrt{y}\right) + 1\\
\end{array}
\end{array}
if z < 4.3e13Initial program 96.5%
associate-+l+96.5%
sub-neg96.5%
sub-neg96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in t around 0 49.2%
Taylor expanded in x around inf 32.5%
associate--l+50.1%
+-commutative50.1%
+-commutative50.1%
Simplified50.1%
Taylor expanded in y around 0 45.8%
if 4.3e13 < z Initial program 90.2%
associate-+l+90.2%
sub-neg90.2%
sub-neg90.2%
+-commutative90.2%
+-commutative90.2%
+-commutative90.2%
Simplified90.2%
Taylor expanded in t around 0 53.3%
Taylor expanded in x around inf 6.5%
associate--l+49.4%
+-commutative49.4%
+-commutative49.4%
Simplified49.4%
Taylor expanded in z around inf 55.3%
Final simplification50.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 (+ 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 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in t around 0 51.3%
Taylor expanded in x around inf 19.6%
associate--l+49.8%
+-commutative49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in z around inf 48.8%
Final simplification48.8%
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)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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((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((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 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(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((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[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in t around inf 57.6%
Taylor expanded in y around inf 30.6%
Taylor expanded in z around inf 15.3%
Final simplification15.3%
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)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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 = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in t around inf 57.6%
Taylor expanded in y around inf 30.6%
Taylor expanded in z around inf 15.3%
Taylor expanded in x around 0 39.2%
Final simplification39.2%
(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 2024043
(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))))