
(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 (sqrt (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (- t_1 (sqrt x)))
(t_4 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= t_3 0.9999)
(+ t_2 (+ (/ 1.0 (+ t_1 (sqrt x))) t_4))
(+ t_2 (+ t_3 (+ t_4 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double t_3 = t_1 - sqrt(x);
double t_4 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double tmp;
if (t_3 <= 0.9999) {
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + t_4);
} else {
tmp = t_2 + (t_3 + (t_4 + (1.0 / (sqrt((1.0 + z)) + 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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = t_1 - sqrt(x)
t_4 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
if (t_3 <= 0.9999d0) then
tmp = t_2 + ((1.0d0 / (t_1 + sqrt(x))) + t_4)
else
tmp = t_2 + (t_3 + (t_4 + (1.0d0 / (sqrt((1.0d0 + z)) + 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((1.0 + x));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_3 = t_1 - Math.sqrt(x);
double t_4 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double tmp;
if (t_3 <= 0.9999) {
tmp = t_2 + ((1.0 / (t_1 + Math.sqrt(x))) + t_4);
} else {
tmp = t_2 + (t_3 + (t_4 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) t_3 = t_1 - math.sqrt(x) t_4 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) tmp = 0 if t_3 <= 0.9999: tmp = t_2 + ((1.0 / (t_1 + math.sqrt(x))) + t_4) else: tmp = t_2 + (t_3 + (t_4 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = Float64(t_1 - sqrt(x)) t_4 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) tmp = 0.0 if (t_3 <= 0.9999) tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + t_4)); else tmp = Float64(t_2 + Float64(t_3 + Float64(t_4 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + 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((1.0 + x));
t_2 = sqrt((1.0 + t)) - sqrt(t);
t_3 = t_1 - sqrt(x);
t_4 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
tmp = 0.0;
if (t_3 <= 0.9999)
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + t_4);
else
tmp = t_2 + (t_3 + (t_4 + (1.0 / (sqrt((1.0 + z)) + 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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.9999], N[(t$95$2 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t$95$3 + N[(t$95$4 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
t_3 := t_1 - \sqrt{x}\\
t_4 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{if}\;t_3 \leq 0.9999:\\
\;\;\;\;t_2 + \left(\frac{1}{t_1 + \sqrt{x}} + t_4\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(t_3 + \left(t_4 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.99990000000000001Initial program 84.2%
associate-+l+84.2%
+-commutative84.2%
+-commutative84.2%
+-commutative84.2%
+-commutative84.2%
+-commutative84.2%
Simplified84.2%
flip--85.0%
add-sqr-sqrt51.1%
+-commutative51.1%
add-sqr-sqrt85.4%
+-commutative85.4%
Applied egg-rr85.4%
associate--l+88.5%
+-inverses88.5%
metadata-eval88.5%
Simplified88.5%
flip--88.5%
add-sqr-sqrt67.2%
add-sqr-sqrt89.1%
Applied egg-rr89.1%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in z around inf 55.1%
if 0.99990000000000001 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
flip--96.8%
add-sqr-sqrt70.5%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified98.0%
flip--96.5%
add-sqr-sqrt69.3%
add-sqr-sqrt96.9%
Applied egg-rr98.6%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified99.2%
Final simplification75.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 (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 y))))
(if (<= z 2.35e+30)
(+
t_2
(+
(- t_1 (sqrt x))
(+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (- t_3 (sqrt y)))))
(+ t_2 (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double t_3 = sqrt((1.0 + y));
double tmp;
if (z <= 2.35e+30) {
tmp = t_2 + ((t_1 - sqrt(x)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (t_3 - sqrt(y))));
} else {
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + 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) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = sqrt((1.0d0 + y))
if (z <= 2.35d+30) then
tmp = t_2 + ((t_1 - sqrt(x)) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (t_3 - sqrt(y))))
else
tmp = t_2 + ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + 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((1.0 + x));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 2.35e+30) {
tmp = t_2 + ((t_1 - Math.sqrt(x)) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (t_3 - Math.sqrt(y))));
} else {
tmp = t_2 + ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) t_3 = math.sqrt((1.0 + y)) tmp = 0 if z <= 2.35e+30: tmp = t_2 + ((t_1 - math.sqrt(x)) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (t_3 - math.sqrt(y)))) else: tmp = t_2 + ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 2.35e+30) tmp = Float64(t_2 + Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(t_3 - sqrt(y))))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + 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((1.0 + x));
t_2 = sqrt((1.0 + t)) - sqrt(t);
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 2.35e+30)
tmp = t_2 + ((t_1 - sqrt(x)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (t_3 - sqrt(y))));
else
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + 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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.35e+30], N[(t$95$2 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 2.35 \cdot 10^{+30}:\\
\;\;\;\;t_2 + \left(\left(t_1 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(t_3 - \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if z < 2.34999999999999995e30Initial program 94.6%
associate-+l+94.6%
+-commutative94.6%
+-commutative94.6%
+-commutative94.6%
+-commutative94.6%
+-commutative94.6%
Simplified94.6%
flip--95.1%
add-sqr-sqrt94.9%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
if 2.34999999999999995e30 < z Initial program 84.7%
associate-+l+84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
Simplified84.7%
flip--85.4%
add-sqr-sqrt67.1%
+-commutative67.1%
add-sqr-sqrt85.5%
+-commutative85.5%
Applied egg-rr85.5%
associate--l+88.7%
+-inverses88.7%
metadata-eval88.7%
Simplified88.7%
flip--88.7%
add-sqr-sqrt61.4%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in z around inf 92.5%
Final simplification94.5%
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 (+ 1.0 x)) (sqrt x))) (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (- (sqrt (+ 1.0 z)) (sqrt z)))) (- (sqrt (+ 1.0 t)) (sqrt t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (sqrt((1.0 + z)) - sqrt(z)))) + (sqrt((1.0 + t)) - 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((1.0d0 + x)) + sqrt(x))) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (sqrt((1.0d0 + z)) - sqrt(z)))) + (sqrt((1.0d0 + t)) - 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((1.0 + x)) + Math.sqrt(x))) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (math.sqrt((1.0 + z)) - math.sqrt(z)))) + (math.sqrt((1.0 + t)) - 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(1.0 + x)) + sqrt(x))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (sqrt((1.0 + z)) - sqrt(z)))) + (sqrt((1.0 + t)) - 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[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)
\end{array}
Initial program 89.7%
associate-+l+89.7%
+-commutative89.7%
+-commutative89.7%
+-commutative89.7%
+-commutative89.7%
+-commutative89.7%
Simplified89.7%
flip--90.2%
add-sqr-sqrt71.7%
+-commutative71.7%
add-sqr-sqrt90.4%
+-commutative90.4%
Applied egg-rr90.4%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
flip--92.1%
add-sqr-sqrt68.2%
add-sqr-sqrt92.7%
Applied egg-rr92.7%
associate--l+94.5%
+-inverses94.5%
metadata-eval94.5%
Simplified94.5%
Final simplification94.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 y))))
(if (<= z 8.5e+19)
(+
t_2
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (+ (- t_1 (sqrt x)) (- t_3 (sqrt y)))))
(+ t_2 (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double t_3 = sqrt((1.0 + y));
double tmp;
if (z <= 8.5e+19) {
tmp = t_2 + ((sqrt((1.0 + z)) - sqrt(z)) + ((t_1 - sqrt(x)) + (t_3 - sqrt(y))));
} else {
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + 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) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = sqrt((1.0d0 + y))
if (z <= 8.5d+19) then
tmp = t_2 + ((sqrt((1.0d0 + z)) - sqrt(z)) + ((t_1 - sqrt(x)) + (t_3 - sqrt(y))))
else
tmp = t_2 + ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + 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((1.0 + x));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 8.5e+19) {
tmp = t_2 + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((t_1 - Math.sqrt(x)) + (t_3 - Math.sqrt(y))));
} else {
tmp = t_2 + ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) t_3 = math.sqrt((1.0 + y)) tmp = 0 if z <= 8.5e+19: tmp = t_2 + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + ((t_1 - math.sqrt(x)) + (t_3 - math.sqrt(y)))) else: tmp = t_2 + ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 8.5e+19) tmp = Float64(t_2 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 - sqrt(y))))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + 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((1.0 + x));
t_2 = sqrt((1.0 + t)) - sqrt(t);
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 8.5e+19)
tmp = t_2 + ((sqrt((1.0 + z)) - sqrt(z)) + ((t_1 - sqrt(x)) + (t_3 - sqrt(y))));
else
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + 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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 8.5e+19], N[(t$95$2 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 8.5 \cdot 10^{+19}:\\
\;\;\;\;t_2 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(t_1 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if z < 8.5e19Initial program 95.0%
if 8.5e19 < z Initial program 84.8%
associate-+l+84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
flip--85.5%
add-sqr-sqrt66.6%
+-commutative66.6%
add-sqr-sqrt85.6%
+-commutative85.6%
Applied egg-rr85.6%
associate--l+88.6%
+-inverses88.6%
metadata-eval88.6%
Simplified88.6%
flip--88.6%
add-sqr-sqrt62.6%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
associate--l+92.3%
+-inverses92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in z around inf 92.3%
Final simplification93.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 (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_3 (sqrt (+ 1.0 y))))
(if (<= z 6.4e+19)
(+
(+ (sqrt (+ 1.0 z)) (+ t_3 (- (- t_1 (sqrt x)) (sqrt z))))
(- t_2 (sqrt y)))
(+ t_2 (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double t_3 = sqrt((1.0 + y));
double tmp;
if (z <= 6.4e+19) {
tmp = (sqrt((1.0 + z)) + (t_3 + ((t_1 - sqrt(x)) - sqrt(z)))) + (t_2 - sqrt(y));
} else {
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + 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) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
t_3 = sqrt((1.0d0 + y))
if (z <= 6.4d+19) then
tmp = (sqrt((1.0d0 + z)) + (t_3 + ((t_1 - sqrt(x)) - sqrt(z)))) + (t_2 - sqrt(y))
else
tmp = t_2 + ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + 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((1.0 + x));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 6.4e+19) {
tmp = (Math.sqrt((1.0 + z)) + (t_3 + ((t_1 - Math.sqrt(x)) - Math.sqrt(z)))) + (t_2 - Math.sqrt(y));
} else {
tmp = t_2 + ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) t_3 = math.sqrt((1.0 + y)) tmp = 0 if z <= 6.4e+19: tmp = (math.sqrt((1.0 + z)) + (t_3 + ((t_1 - math.sqrt(x)) - math.sqrt(z)))) + (t_2 - math.sqrt(y)) else: tmp = t_2 + ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 6.4e+19) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(t_3 + Float64(Float64(t_1 - sqrt(x)) - sqrt(z)))) + Float64(t_2 - sqrt(y))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + 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((1.0 + x));
t_2 = sqrt((1.0 + t)) - sqrt(t);
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 6.4e+19)
tmp = (sqrt((1.0 + z)) + (t_3 + ((t_1 - sqrt(x)) - sqrt(z)))) + (t_2 - sqrt(y));
else
tmp = t_2 + ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + 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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6.4e+19], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(t$95$3 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 6.4 \cdot 10^{+19}:\\
\;\;\;\;\left(\sqrt{1 + z} + \left(t_3 + \left(\left(t_1 - \sqrt{x}\right) - \sqrt{z}\right)\right)\right) + \left(t_2 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if z < 6.4e19Initial program 95.0%
+-commutative95.0%
associate-+r+95.0%
associate-+r-76.1%
associate-+l-67.5%
associate-+r-52.5%
Simplified52.6%
if 6.4e19 < z Initial program 84.8%
associate-+l+84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
flip--85.5%
add-sqr-sqrt66.6%
+-commutative66.6%
add-sqr-sqrt85.6%
+-commutative85.6%
Applied egg-rr85.6%
associate--l+88.6%
+-inverses88.6%
metadata-eval88.6%
Simplified88.6%
flip--88.6%
add-sqr-sqrt62.6%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
associate--l+92.3%
+-inverses92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in z around inf 92.3%
Final simplification73.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 (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 2.5e-25)
(+ (+ t_1 t_2) (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= y 3.3e+31)
(+
(- t_1 (sqrt x))
(+ (/ 1.0 (+ t_2 (sqrt y))) (- (sqrt (+ 1.0 t)) (sqrt t))))
(/ 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((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 2.5e-25) {
tmp = (t_1 + t_2) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (y <= 3.3e+31) {
tmp = (t_1 - sqrt(x)) + ((1.0 / (t_2 + sqrt(y))) + (sqrt((1.0 + t)) - sqrt(t)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (y <= 2.5d-25) then
tmp = (t_1 + t_2) + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (y <= 3.3d+31) then
tmp = (t_1 - sqrt(x)) + ((1.0d0 / (t_2 + sqrt(y))) + (sqrt((1.0d0 + t)) - sqrt(t)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 2.5e-25) {
tmp = (t_1 + t_2) + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 3.3e+31) {
tmp = (t_1 - Math.sqrt(x)) + ((1.0 / (t_2 + Math.sqrt(y))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if y <= 2.5e-25: tmp = (t_1 + t_2) + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif y <= 3.3e+31: tmp = (t_1 - math.sqrt(x)) + ((1.0 / (t_2 + math.sqrt(y))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 2.5e-25) tmp = Float64(Float64(t_1 + t_2) + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (y <= 3.3e+31) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 2.5e-25)
tmp = (t_1 + t_2) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (y <= 3.3e+31)
tmp = (t_1 - sqrt(x)) + ((1.0 / (t_2 + sqrt(y))) + (sqrt((1.0 + t)) - sqrt(t)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.5e-25], N[(N[(t$95$1 + t$95$2), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+31], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 2.5 \cdot 10^{-25}:\\
\;\;\;\;\left(t_1 + t_2\right) + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+31}:\\
\;\;\;\;\left(t_1 - \sqrt{x}\right) + \left(\frac{1}{t_2 + \sqrt{y}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.49999999999999981e-25Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
+-commutative97.6%
associate-+r+97.6%
associate-+r+97.6%
+-commutative97.6%
associate-+l-82.0%
Simplified55.7%
Taylor expanded in t around inf 23.2%
associate-+r+23.2%
associate--l+31.8%
+-commutative31.8%
Simplified31.8%
if 2.49999999999999981e-25 < y < 3.29999999999999992e31Initial program 80.5%
+-commutative80.5%
associate-+r+80.5%
associate-+r-78.3%
associate-+l-78.3%
associate-+r-78.3%
Simplified48.7%
Taylor expanded in z around inf 35.2%
+-commutative35.2%
associate-+r-47.4%
+-commutative47.4%
associate-+l-35.2%
Simplified35.2%
sub-neg35.2%
associate--r-47.4%
associate--r-34.4%
Applied egg-rr34.4%
unsub-neg34.4%
associate--l+34.4%
associate-+l-47.5%
associate--r-47.5%
Simplified47.5%
flip--80.8%
add-sqr-sqrt80.3%
add-sqr-sqrt85.6%
Applied egg-rr49.9%
associate--l+96.2%
+-inverses96.2%
metadata-eval96.2%
Simplified58.5%
if 3.29999999999999992e31 < y Initial program 85.6%
+-commutative85.6%
associate-+r+85.6%
+-commutative85.6%
associate-+r+85.6%
associate-+r+85.6%
+-commutative85.6%
associate-+l-63.1%
Simplified6.2%
Taylor expanded in t around inf 3.2%
associate--l+20.7%
+-commutative20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in z around inf 20.5%
+-commutative20.5%
Simplified20.5%
Taylor expanded in y around inf 20.5%
flip--20.9%
add-sqr-sqrt21.0%
add-sqr-sqrt20.9%
Applied egg-rr20.9%
associate--l+24.7%
+-inverses24.7%
metadata-eval24.7%
+-commutative24.7%
Simplified24.7%
Final simplification31.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 (+ 1.0 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 8.6e+14)
(+ (- (+ 1.0 (+ t_2 (sqrt (+ 1.0 z)))) (sqrt z)) (- t_1 (sqrt y)))
(+
t_1
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ 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((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 8.6e+14) {
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (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((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 8.6d+14) then
tmp = ((1.0d0 + (t_2 + sqrt((1.0d0 + z)))) - sqrt(z)) + (t_1 - sqrt(y))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (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((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 8.6e+14) {
tmp = ((1.0 + (t_2 + Math.sqrt((1.0 + z)))) - Math.sqrt(z)) + (t_1 - Math.sqrt(y));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (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((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 8.6e+14: tmp = ((1.0 + (t_2 + math.sqrt((1.0 + z)))) - math.sqrt(z)) + (t_1 - math.sqrt(y)) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (t_2 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 8.6e+14) tmp = Float64(Float64(Float64(1.0 + Float64(t_2 + sqrt(Float64(1.0 + z)))) - sqrt(z)) + Float64(t_1 - sqrt(y))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / 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((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 8.6e+14)
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 8.6e+14], N[(N[(N[(1.0 + N[(t$95$2 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 8.6 \cdot 10^{+14}:\\
\;\;\;\;\left(\left(1 + \left(t_2 + \sqrt{1 + z}\right)\right) - \sqrt{z}\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{t_2 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if z < 8.6e14Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r-76.2%
associate-+l-67.5%
associate-+r-52.4%
Simplified52.5%
Taylor expanded in x around 0 30.6%
if 8.6e14 < z Initial program 84.7%
associate-+l+84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
Simplified84.7%
flip--85.4%
add-sqr-sqrt66.6%
+-commutative66.6%
add-sqr-sqrt85.5%
+-commutative85.5%
Applied egg-rr85.5%
associate--l+88.5%
+-inverses88.5%
metadata-eval88.5%
Simplified88.5%
flip--88.5%
add-sqr-sqrt62.7%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in z around inf 92.1%
Final simplification62.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 (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 4.2e+15)
(+ (+ t_1 t_2) (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(/ 1.0 (+ t_1 (sqrt x)))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt y) t_2))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 4.2e+15) {
tmp = (t_1 + t_2) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = (1.0 / (t_1 + sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) - (sqrt(y) - t_2));
}
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((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (z <= 4.2d+15) then
tmp = (t_1 + t_2) + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = (1.0d0 / (t_1 + sqrt(x))) + ((sqrt((1.0d0 + t)) - sqrt(t)) - (sqrt(y) - t_2))
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((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 4.2e+15) {
tmp = (t_1 + t_2) + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - (Math.sqrt(y) - t_2));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 4.2e+15: tmp = (t_1 + t_2) + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = (1.0 / (t_1 + math.sqrt(x))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) - (math.sqrt(y) - t_2)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 4.2e+15) tmp = Float64(Float64(t_1 + t_2) + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - Float64(sqrt(y) - t_2))); 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((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 4.2e+15)
tmp = (t_1 + t_2) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = (1.0 / (t_1 + sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) - (sqrt(y) - t_2));
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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4.2e+15], N[(N[(t$95$1 + t$95$2), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 4.2 \cdot 10^{+15}:\\
\;\;\;\;\left(t_1 + t_2\right) + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}} + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \left(\sqrt{y} - t_2\right)\right)\\
\end{array}
\end{array}
if z < 4.2e15Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l-95.2%
Simplified56.3%
Taylor expanded in t around inf 20.8%
associate-+r+20.8%
associate--l+20.8%
+-commutative20.8%
Simplified20.8%
if 4.2e15 < z Initial program 84.7%
+-commutative84.7%
associate-+r+84.7%
associate-+r-61.8%
associate-+l-44.5%
associate-+r-44.5%
Simplified8.9%
Taylor expanded in z around inf 27.2%
+-commutative27.2%
associate-+r-44.5%
+-commutative44.5%
associate-+l-27.2%
Simplified27.2%
sub-neg27.2%
associate--r-44.5%
associate--r-42.3%
Applied egg-rr42.3%
unsub-neg42.3%
associate--l+47.7%
associate-+l-57.4%
associate--r-84.7%
Simplified84.7%
flip--20.3%
add-sqr-sqrt20.6%
add-sqr-sqrt20.4%
Applied egg-rr85.5%
associate--l+24.3%
+-inverses24.3%
metadata-eval24.3%
+-commutative24.3%
Simplified88.5%
Final simplification56.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 6e+14)
(+ (- (+ 1.0 (+ t_2 (sqrt (+ 1.0 z)))) (sqrt z)) (- t_1 (sqrt y)))
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (- t_1 (- (sqrt y) t_2))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 6e+14) {
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
} else {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (t_1 - (sqrt(y) - t_2));
}
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((1.0d0 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 6d+14) then
tmp = ((1.0d0 + (t_2 + sqrt((1.0d0 + z)))) - sqrt(z)) + (t_1 - sqrt(y))
else
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (t_1 - (sqrt(y) - t_2))
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((1.0 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 6e+14) {
tmp = ((1.0 + (t_2 + Math.sqrt((1.0 + z)))) - Math.sqrt(z)) + (t_1 - Math.sqrt(y));
} else {
tmp = (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (t_1 - (Math.sqrt(y) - t_2));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 6e+14: tmp = ((1.0 + (t_2 + math.sqrt((1.0 + z)))) - math.sqrt(z)) + (t_1 - math.sqrt(y)) else: tmp = (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (t_1 - (math.sqrt(y) - t_2)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 6e+14) tmp = Float64(Float64(Float64(1.0 + Float64(t_2 + sqrt(Float64(1.0 + z)))) - sqrt(z)) + Float64(t_1 - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(t_1 - Float64(sqrt(y) - t_2))); 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((1.0 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 6e+14)
tmp = ((1.0 + (t_2 + sqrt((1.0 + z)))) - sqrt(z)) + (t_1 - sqrt(y));
else
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (t_1 - (sqrt(y) - t_2));
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[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6e+14], N[(N[(N[(1.0 + N[(t$95$2 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[y], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 6 \cdot 10^{+14}:\\
\;\;\;\;\left(\left(1 + \left(t_2 + \sqrt{1 + z}\right)\right) - \sqrt{z}\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(t_1 - \left(\sqrt{y} - t_2\right)\right)\\
\end{array}
\end{array}
if z < 6e14Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r-76.2%
associate-+l-67.5%
associate-+r-52.4%
Simplified52.5%
Taylor expanded in x around 0 30.6%
if 6e14 < z Initial program 84.7%
+-commutative84.7%
associate-+r+84.7%
associate-+r-61.8%
associate-+l-44.5%
associate-+r-44.5%
Simplified8.9%
Taylor expanded in z around inf 27.2%
+-commutative27.2%
associate-+r-44.5%
+-commutative44.5%
associate-+l-27.2%
Simplified27.2%
sub-neg27.2%
associate--r-44.5%
associate--r-42.3%
Applied egg-rr42.3%
unsub-neg42.3%
associate--l+47.7%
associate-+l-57.4%
associate--r-84.7%
Simplified84.7%
flip--20.3%
add-sqr-sqrt20.6%
add-sqr-sqrt20.4%
Applied egg-rr85.5%
associate--l+24.3%
+-inverses24.3%
metadata-eval24.3%
+-commutative24.3%
Simplified88.5%
Final simplification60.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 (+ 1.0 x))))
(if (<= y 1.65e-25)
(+
(+ t_1 (sqrt (+ 1.0 y)))
(- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= y 4.2e+16)
(+ t_1 (- (hypot 1.0 (sqrt y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.65e-25) {
tmp = (t_1 + sqrt((1.0 + y))) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (y <= 4.2e+16) {
tmp = t_1 + (hypot(1.0, sqrt(y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.65e-25) {
tmp = (t_1 + Math.sqrt((1.0 + y))) + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 4.2e+16) {
tmp = t_1 + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.65e-25: tmp = (t_1 + math.sqrt((1.0 + y))) + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif y <= 4.2e+16: tmp = t_1 + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.65e-25) tmp = Float64(Float64(t_1 + sqrt(Float64(1.0 + y))) + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (y <= 4.2e+16) tmp = Float64(t_1 + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.65e-25)
tmp = (t_1 + sqrt((1.0 + y))) + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (y <= 4.2e+16)
tmp = t_1 + (hypot(1.0, sqrt(y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.65e-25], N[(N[(t$95$1 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+16], N[(t$95$1 + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.65 \cdot 10^{-25}:\\
\;\;\;\;\left(t_1 + \sqrt{1 + y}\right) + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;t_1 + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.6499999999999999e-25Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
+-commutative97.6%
associate-+r+97.6%
associate-+r+97.6%
+-commutative97.6%
associate-+l-82.0%
Simplified55.7%
Taylor expanded in t around inf 23.2%
associate-+r+23.2%
associate--l+31.8%
+-commutative31.8%
Simplified31.8%
if 1.6499999999999999e-25 < y < 4.2e16Initial program 87.5%
+-commutative87.5%
associate-+r+87.5%
+-commutative87.5%
associate-+r+87.5%
associate-+r+87.5%
+-commutative87.5%
associate-+l-67.5%
Simplified57.3%
Taylor expanded in t around inf 17.4%
associate--l+22.2%
+-commutative22.2%
+-commutative22.2%
Simplified22.2%
Taylor expanded in z around inf 33.1%
+-commutative33.1%
Simplified33.1%
add-sqr-sqrt33.1%
hypot-1-def33.1%
Applied egg-rr33.1%
if 4.2e16 < y Initial program 84.3%
+-commutative84.3%
associate-+r+84.3%
+-commutative84.3%
associate-+r+84.3%
associate-+r+84.3%
+-commutative84.3%
associate-+l-62.6%
Simplified7.5%
Taylor expanded in t around inf 4.1%
associate--l+20.7%
+-commutative20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in y around inf 20.3%
flip--20.7%
add-sqr-sqrt20.8%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
associate--l+24.4%
+-inverses24.4%
metadata-eval24.4%
+-commutative24.4%
Simplified24.4%
Final simplification28.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 (+ 1.0 y))))
(if (<= z 7.6e+14)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt y) (sqrt z)))
(exp (log (+ (- (sqrt (+ 1.0 x)) (sqrt x)) (- t_1 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 7.6e+14) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
} else {
tmp = exp(log(((sqrt((1.0 + x)) - sqrt(x)) + (t_1 - sqrt(y)))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 7.6d+14) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (sqrt(y) + sqrt(z))
else
tmp = exp(log(((sqrt((1.0d0 + x)) - sqrt(x)) + (t_1 - sqrt(y)))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 7.6e+14) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = Math.exp(Math.log(((Math.sqrt((1.0 + x)) - Math.sqrt(x)) + (t_1 - Math.sqrt(y)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 7.6e+14: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = math.exp(math.log(((math.sqrt((1.0 + x)) - math.sqrt(x)) + (t_1 - math.sqrt(y))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 7.6e+14) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(sqrt(y) + sqrt(z))); else tmp = exp(log(Float64(Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) + Float64(t_1 - sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 7.6e+14)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
else
tmp = exp(log(((sqrt((1.0 + x)) - sqrt(x)) + (t_1 - sqrt(y)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 7.6e+14], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[N[Log[N[(N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 7.6 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + \left(t_1 + \sqrt{1 + z}\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(\left(\sqrt{1 + x} - \sqrt{x}\right) + \left(t_1 - \sqrt{y}\right)\right)}\\
\end{array}
\end{array}
if z < 7.6e14Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l-95.2%
Simplified56.3%
Taylor expanded in t around inf 20.8%
associate--l+25.3%
+-commutative25.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in x around 0 32.3%
if 7.6e14 < z Initial program 84.7%
+-commutative84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+r+84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+l-47.7%
Simplified6.1%
Taylor expanded in t around inf 5.0%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
add-exp-log21.2%
associate-+r-5.0%
+-commutative5.0%
+-commutative5.0%
Applied egg-rr5.0%
Taylor expanded in z around inf 16.6%
associate--r+15.6%
+-commutative15.6%
associate-+r-25.6%
+-commutative25.6%
associate-+r-38.5%
+-commutative38.5%
Simplified38.5%
Final simplification35.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 9.6e+14) (- (+ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt (+ 1.0 z)))) (+ (sqrt y) (sqrt z))) (+ (sqrt (+ 1.0 x)) (- (hypot 1.0 (sqrt y)) (+ (sqrt x) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 9.6e+14) {
tmp = (1.0 + (sqrt((1.0 + y)) + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
} else {
tmp = sqrt((1.0 + x)) + (hypot(1.0, sqrt(y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 9.6e+14) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) + Math.sqrt((1.0 + z)))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = Math.sqrt((1.0 + x)) + (Math.hypot(1.0, Math.sqrt(y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 9.6e+14: tmp = (1.0 + (math.sqrt((1.0 + y)) + math.sqrt((1.0 + z)))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = math.sqrt((1.0 + x)) + (math.hypot(1.0, math.sqrt(y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 9.6e+14) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + sqrt(Float64(1.0 + z)))) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(hypot(1.0, sqrt(y)) - Float64(sqrt(x) + sqrt(y)))); 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 <= 9.6e+14)
tmp = (1.0 + (sqrt((1.0 + y)) + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
else
tmp = sqrt((1.0 + x)) + (hypot(1.0, sqrt(y)) - (sqrt(x) + 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_] := If[LessEqual[z, 9.6e+14], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[y], $MachinePrecision] ^ 2], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 9.6 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} + \sqrt{1 + z}\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\mathsf{hypot}\left(1, \sqrt{y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 9.6e14Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l-95.2%
Simplified56.3%
Taylor expanded in t around inf 20.8%
associate--l+25.3%
+-commutative25.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in x around 0 32.3%
if 9.6e14 < z Initial program 84.7%
+-commutative84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+r+84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+l-47.7%
Simplified6.1%
Taylor expanded in t around inf 5.0%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in z around inf 29.2%
+-commutative29.2%
Simplified29.2%
add-sqr-sqrt29.2%
hypot-1-def29.2%
Applied egg-rr29.2%
Final simplification30.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 (+ 1.0 y))))
(if (<= z 4.1e+15)
(+ 1.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (- (sqrt y) t_1))))
(+ (sqrt (+ 1.0 x)) (- t_1 (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 4.1e+15) {
tmp = 1.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) - t_1)));
} else {
tmp = sqrt((1.0 + x)) + (t_1 - (sqrt(x) + 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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 4.1d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(y) - t_1)))
else
tmp = sqrt((1.0d0 + x)) + (t_1 - (sqrt(x) + 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((1.0 + y));
double tmp;
if (z <= 4.1e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(y) - t_1)));
} else {
tmp = Math.sqrt((1.0 + x)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 4.1e+15: tmp = 1.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(y) - t_1))) else: tmp = math.sqrt((1.0 + x)) + (t_1 - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 4.1e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(y) - t_1)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(t_1 - Float64(sqrt(x) + 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((1.0 + y));
tmp = 0.0;
if (z <= 4.1e+15)
tmp = 1.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) - t_1)));
else
tmp = sqrt((1.0 + x)) + (t_1 - (sqrt(x) + 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[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4.1e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 4.1 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{y} - t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 4.1e15Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l-95.2%
Simplified56.3%
Taylor expanded in t around inf 20.8%
associate--l+25.3%
+-commutative25.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in x around 0 32.3%
associate--r+31.8%
associate--l+46.2%
+-commutative46.2%
associate-+r-54.6%
+-commutative54.6%
associate-+r-54.6%
+-commutative54.6%
associate--l+54.6%
Simplified54.6%
if 4.1e15 < z Initial program 84.7%
+-commutative84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+r+84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+l-47.7%
Simplified6.1%
Taylor expanded in t around inf 5.0%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in z around inf 29.2%
+-commutative29.2%
Simplified29.2%
Final simplification41.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 (+ 1.0 y))))
(if (<= z 7.6e+14)
(- (+ 1.0 (+ t_1 (sqrt (+ 1.0 z)))) (+ (sqrt y) (sqrt z)))
(+ (sqrt (+ 1.0 x)) (- t_1 (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 7.6e+14) {
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
} else {
tmp = sqrt((1.0 + x)) + (t_1 - (sqrt(x) + 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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 7.6d+14) then
tmp = (1.0d0 + (t_1 + sqrt((1.0d0 + z)))) - (sqrt(y) + sqrt(z))
else
tmp = sqrt((1.0d0 + x)) + (t_1 - (sqrt(x) + 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((1.0 + y));
double tmp;
if (z <= 7.6e+14) {
tmp = (1.0 + (t_1 + Math.sqrt((1.0 + z)))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = Math.sqrt((1.0 + x)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 7.6e+14: tmp = (1.0 + (t_1 + math.sqrt((1.0 + z)))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = math.sqrt((1.0 + x)) + (t_1 - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 7.6e+14) tmp = Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(1.0 + z)))) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(t_1 - Float64(sqrt(x) + 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((1.0 + y));
tmp = 0.0;
if (z <= 7.6e+14)
tmp = (1.0 + (t_1 + sqrt((1.0 + z)))) - (sqrt(y) + sqrt(z));
else
tmp = sqrt((1.0 + x)) + (t_1 - (sqrt(x) + 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[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 7.6e+14], N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 7.6 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + \left(t_1 + \sqrt{1 + z}\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 7.6e14Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r+95.2%
+-commutative95.2%
associate-+l-95.2%
Simplified56.3%
Taylor expanded in t around inf 20.8%
associate--l+25.3%
+-commutative25.3%
+-commutative25.3%
Simplified25.3%
Taylor expanded in x around 0 32.3%
if 7.6e14 < z Initial program 84.7%
+-commutative84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+r+84.7%
associate-+r+84.7%
+-commutative84.7%
associate-+l-47.7%
Simplified6.1%
Taylor expanded in t around inf 5.0%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in z around inf 29.2%
+-commutative29.2%
Simplified29.2%
Final simplification30.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 (+ 1.0 x))) (t_2 (+ (sqrt x) (sqrt y)))) (if (<= z 0.03) (- (+ t_1 2.0) t_2) (+ t_1 (- (sqrt (+ 1.0 y)) t_2)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 0.03) {
tmp = (t_1 + 2.0) - t_2;
} else {
tmp = t_1 + (sqrt((1.0 + y)) - t_2);
}
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((1.0d0 + x))
t_2 = sqrt(x) + sqrt(y)
if (z <= 0.03d0) then
tmp = (t_1 + 2.0d0) - t_2
else
tmp = t_1 + (sqrt((1.0d0 + y)) - t_2)
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((1.0 + x));
double t_2 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (z <= 0.03) {
tmp = (t_1 + 2.0) - t_2;
} else {
tmp = t_1 + (Math.sqrt((1.0 + y)) - t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 0.03: tmp = (t_1 + 2.0) - t_2 else: tmp = t_1 + (math.sqrt((1.0 + y)) - t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 0.03) tmp = Float64(Float64(t_1 + 2.0) - t_2); else tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - t_2)); 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((1.0 + x));
t_2 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (z <= 0.03)
tmp = (t_1 + 2.0) - t_2;
else
tmp = t_1 + (sqrt((1.0 + y)) - t_2);
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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 0.03], N[(N[(t$95$1 + 2.0), $MachinePrecision] - t$95$2), $MachinePrecision], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 0.03:\\
\;\;\;\;\left(t_1 + 2\right) - t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\sqrt{1 + y} - t_2\right)\\
\end{array}
\end{array}
if z < 0.029999999999999999Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-79.7%
associate-+l-70.4%
associate-+r-55.4%
Simplified55.4%
Taylor expanded in z around inf 10.2%
+-commutative10.2%
associate-+r-12.6%
+-commutative12.6%
associate-+l-10.2%
Simplified10.2%
sub-neg10.2%
associate--r-12.6%
associate--r-12.6%
Applied egg-rr12.6%
unsub-neg12.6%
associate--l+15.0%
associate-+l-15.8%
associate--r-17.8%
Simplified17.8%
Taylor expanded in t around 0 20.9%
associate-+r+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in y around 0 18.8%
if 0.029999999999999999 < z Initial program 84.1%
+-commutative84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+r+84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+l-49.7%
Simplified7.1%
Taylor expanded in t around inf 5.9%
associate--l+22.0%
+-commutative22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in z around inf 28.9%
+-commutative28.9%
Simplified28.9%
Final simplification24.4%
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 0.105) (- (+ (sqrt (+ 1.0 x)) 2.0) (+ (sqrt x) (sqrt y))) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.105) {
tmp = (sqrt((1.0 + x)) + 2.0) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - 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) :: tmp
if (z <= 0.105d0) then
tmp = (sqrt((1.0d0 + x)) + 2.0d0) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - 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 tmp;
if (z <= 0.105) {
tmp = (Math.sqrt((1.0 + x)) + 2.0) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.105: tmp = (math.sqrt((1.0 + x)) + 2.0) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.105) tmp = Float64(Float64(sqrt(Float64(1.0 + x)) + 2.0) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); 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 <= 0.105)
tmp = (sqrt((1.0 + x)) + 2.0) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 + (sqrt((1.0 + y)) - 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_] := If[LessEqual[z, 0.105], N[(N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.105:\\
\;\;\;\;\left(\sqrt{1 + x} + 2\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.104999999999999996Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-79.7%
associate-+l-70.4%
associate-+r-55.4%
Simplified55.4%
Taylor expanded in z around inf 10.2%
+-commutative10.2%
associate-+r-12.6%
+-commutative12.6%
associate-+l-10.2%
Simplified10.2%
sub-neg10.2%
associate--r-12.6%
associate--r-12.6%
Applied egg-rr12.6%
unsub-neg12.6%
associate--l+15.0%
associate-+l-15.8%
associate--r-17.8%
Simplified17.8%
Taylor expanded in t around 0 20.9%
associate-+r+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in y around 0 18.8%
if 0.104999999999999996 < z Initial program 84.1%
+-commutative84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+r+84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+l-49.7%
Simplified7.1%
Taylor expanded in t around inf 5.9%
associate--l+22.0%
+-commutative22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in z around inf 28.9%
+-commutative28.9%
Simplified28.9%
Taylor expanded in x around 0 26.1%
associate--l+51.9%
Simplified51.9%
Final simplification37.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (- (sqrt (+ 1.0 x)) (sqrt x)))) (if (<= y 5.0) (+ 1.0 t_1) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x)) - sqrt(x);
double tmp;
if (y <= 5.0) {
tmp = 1.0 + t_1;
} 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((1.0d0 + x)) - sqrt(x)
if (y <= 5.0d0) then
tmp = 1.0d0 + t_1
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((1.0 + x)) - Math.sqrt(x);
double tmp;
if (y <= 5.0) {
tmp = 1.0 + t_1;
} 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((1.0 + x)) - math.sqrt(x) tmp = 0 if y <= 5.0: tmp = 1.0 + t_1 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(1.0 + x)) - sqrt(x)) tmp = 0.0 if (y <= 5.0) tmp = Float64(1.0 + t_1); 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((1.0 + x)) - sqrt(x);
tmp = 0.0;
if (y <= 5.0)
tmp = 1.0 + t_1;
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[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.0], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x} - \sqrt{x}\\
\mathbf{if}\;y \leq 5:\\
\;\;\;\;1 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 5Initial program 97.4%
+-commutative97.4%
associate-+r+97.4%
+-commutative97.4%
associate-+r+97.4%
associate-+r+97.4%
+-commutative97.4%
associate-+l-80.5%
Simplified55.6%
Taylor expanded in t around inf 22.1%
associate--l+25.8%
+-commutative25.8%
+-commutative25.8%
Simplified25.8%
Taylor expanded in z around inf 22.5%
+-commutative22.5%
Simplified22.5%
Taylor expanded in y around 0 21.1%
associate--l+34.7%
Simplified34.7%
if 5 < y Initial program 83.8%
+-commutative83.8%
associate-+r+83.8%
+-commutative83.8%
associate-+r+83.8%
associate-+r+83.8%
+-commutative83.8%
associate-+l-62.8%
Simplified10.5%
Taylor expanded in t around inf 5.2%
associate--l+21.1%
+-commutative21.1%
+-commutative21.1%
Simplified21.1%
Taylor expanded in z around inf 20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in y around inf 20.2%
Final simplification26.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 (+ 1.0 y)))) (if (<= z 0.025) (- (+ t_1 2.0) (sqrt y)) (+ 1.0 (- t_1 (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 0.025) {
tmp = (t_1 + 2.0) - sqrt(y);
} else {
tmp = 1.0 + (t_1 - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 0.025d0) then
tmp = (t_1 + 2.0d0) - sqrt(y)
else
tmp = 1.0d0 + (t_1 - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 0.025) {
tmp = (t_1 + 2.0) - Math.sqrt(y);
} else {
tmp = 1.0 + (t_1 - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 0.025: tmp = (t_1 + 2.0) - math.sqrt(y) else: tmp = 1.0 + (t_1 - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 0.025) tmp = Float64(Float64(t_1 + 2.0) - sqrt(y)); else tmp = Float64(1.0 + Float64(t_1 - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 0.025)
tmp = (t_1 + 2.0) - sqrt(y);
else
tmp = 1.0 + (t_1 - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.025], N[(N[(t$95$1 + 2.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.025:\\
\;\;\;\;\left(t_1 + 2\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(t_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.025000000000000001Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-79.7%
associate-+l-70.4%
associate-+r-55.4%
Simplified55.4%
Taylor expanded in z around inf 10.2%
+-commutative10.2%
associate-+r-12.6%
+-commutative12.6%
associate-+l-10.2%
Simplified10.2%
sub-neg10.2%
associate--r-12.6%
associate--r-12.6%
Applied egg-rr12.6%
unsub-neg12.6%
associate--l+15.0%
associate-+l-15.8%
associate--r-17.8%
Simplified17.8%
Taylor expanded in t around 0 20.9%
associate-+r+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in x around 0 33.6%
if 0.025000000000000001 < z Initial program 84.1%
+-commutative84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+r+84.1%
associate-+r+84.1%
+-commutative84.1%
associate-+l-49.7%
Simplified7.1%
Taylor expanded in t around inf 5.9%
associate--l+22.0%
+-commutative22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in z around inf 28.9%
+-commutative28.9%
Simplified28.9%
Taylor expanded in x around 0 26.1%
associate--l+51.9%
Simplified51.9%
Final simplification43.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 (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
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((1.0d0 + y)) - sqrt(y))
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((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
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[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 89.7%
+-commutative89.7%
associate-+r+89.7%
+-commutative89.7%
associate-+r+89.7%
associate-+r+89.7%
+-commutative89.7%
associate-+l-70.5%
Simplified30.2%
Taylor expanded in t around inf 12.6%
associate--l+23.2%
+-commutative23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in x around 0 23.5%
associate--l+44.5%
Simplified44.5%
Final simplification44.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 (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - 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((1.0d0 + x)) - 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((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - 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[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 89.7%
+-commutative89.7%
associate-+r+89.7%
+-commutative89.7%
associate-+r+89.7%
associate-+r+89.7%
+-commutative89.7%
associate-+l-70.5%
Simplified30.2%
Taylor expanded in t around inf 12.6%
associate--l+23.2%
+-commutative23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 16.0%
Final simplification16.0%
(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 2024010
(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))))