
(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 16 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 z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 6e+30)
(+
(+ 1.0 (- t_2 (sqrt y)))
(+ (/ 1.0 (+ t_1 (sqrt z))) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))
(+
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (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((1.0 + z));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 6e+30) {
tmp = (1.0 + (t_2 - sqrt(y))) + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
} else {
tmp = ((1.0 / (sqrt((1.0 + x)) + 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((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
if (z <= 6d+30) then
tmp = (1.0d0 + (t_2 - sqrt(y))) + ((1.0d0 / (t_1 + sqrt(z))) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
else
tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + 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((1.0 + z));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 6e+30) {
tmp = (1.0 + (t_2 - Math.sqrt(y))) + ((1.0 / (t_1 + Math.sqrt(z))) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
} else {
tmp = ((1.0 / (Math.sqrt((1.0 + x)) + 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((1.0 + z)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 6e+30: tmp = (1.0 + (t_2 - math.sqrt(y))) + ((1.0 / (t_1 + math.sqrt(z))) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) else: tmp = ((1.0 / (math.sqrt((1.0 + x)) + 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(1.0 + z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 6e+30) tmp = Float64(Float64(1.0 + Float64(t_2 - sqrt(y))) + Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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((1.0 + z));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 6e+30)
tmp = (1.0 + (t_2 - sqrt(y))) + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
else
tmp = ((1.0 / (sqrt((1.0 + x)) + 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[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 6e+30], N[(N[(1.0 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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] + 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{1 + z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 6 \cdot 10^{+30}:\\
\;\;\;\;\left(1 + \left(t\_2 - \sqrt{y}\right)\right) + \left(\frac{1}{t\_1 + \sqrt{z}} + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{t\_2 + \sqrt{y}}\right) + \left(t\_1 - \sqrt{z}\right)\\
\end{array}
\end{array}
if z < 5.99999999999999956e30Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--97.6%
add-sqr-sqrt97.0%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate--l+98.9%
+-inverses98.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in x around 0 57.6%
flip--57.5%
add-sqr-sqrt45.0%
+-commutative45.0%
add-sqr-sqrt57.7%
+-commutative57.7%
Applied egg-rr57.7%
+-commutative57.7%
+-commutative57.7%
associate--l+57.8%
+-inverses57.8%
metadata-eval57.8%
+-commutative57.8%
Simplified57.8%
if 5.99999999999999956e30 < z Initial program 94.2%
associate-+l+94.2%
sub-neg94.2%
sub-neg94.2%
+-commutative94.2%
+-commutative94.2%
+-commutative94.2%
Simplified94.2%
flip--94.3%
add-sqr-sqrt71.4%
+-commutative71.4%
add-sqr-sqrt94.6%
+-commutative94.6%
Applied egg-rr94.6%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
flip--96.0%
add-sqr-sqrt80.1%
add-sqr-sqrt96.7%
Applied egg-rr96.7%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in t around inf 48.2%
Final simplification53.7%
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(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(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[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $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{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
Initial program 95.6%
associate-+l+95.6%
sub-neg95.6%
sub-neg95.6%
+-commutative95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
flip--95.6%
add-sqr-sqrt72.5%
+-commutative72.5%
add-sqr-sqrt95.8%
+-commutative95.8%
Applied egg-rr95.8%
associate--l+96.4%
+-inverses96.4%
metadata-eval96.4%
Simplified96.4%
flip--96.4%
add-sqr-sqrt79.4%
add-sqr-sqrt96.8%
Applied egg-rr96.8%
associate--l+97.1%
+-inverses97.1%
metadata-eval97.1%
Simplified97.1%
Final simplification97.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 z))) (t_2 (- (sqrt (+ 1.0 y)) (sqrt y))))
(if (<= z 6e+31)
(+ (+ 1.0 t_2) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_1 (sqrt z)))))
(+ (- t_1 (sqrt z)) (+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) 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 + z));
double t_2 = sqrt((1.0 + y)) - sqrt(y);
double tmp;
if (z <= 6e+31) {
tmp = (1.0 + t_2) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + 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 + z))
t_2 = sqrt((1.0d0 + y)) - sqrt(y)
if (z <= 6d+31) then
tmp = (1.0d0 + t_2) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + 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 + z));
double t_2 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double tmp;
if (z <= 6e+31) {
tmp = (1.0 + t_2) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + 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 + z)) t_2 = math.sqrt((1.0 + y)) - math.sqrt(y) tmp = 0 if z <= 6e+31: tmp = (1.0 + t_2) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + 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 + z)) t_2 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) tmp = 0.0 if (z <= 6e+31) tmp = Float64(Float64(1.0 + t_2) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + 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 + z));
t_2 = sqrt((1.0 + y)) - sqrt(y);
tmp = 0.0;
if (z <= 6e+31)
tmp = (1.0 + t_2) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z))));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 6e+31], N[(N[(1.0 + t$95$2), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $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 + z}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;z \leq 6 \cdot 10^{+31}:\\
\;\;\;\;\left(1 + t\_2\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + t\_2\right)\\
\end{array}
\end{array}
if z < 5.99999999999999978e31Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
flip--97.5%
add-sqr-sqrt96.9%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in x around 0 57.7%
if 5.99999999999999978e31 < z Initial program 94.3%
associate-+l+94.3%
sub-neg94.3%
sub-neg94.3%
+-commutative94.3%
+-commutative94.3%
+-commutative94.3%
Simplified94.3%
flip--94.4%
add-sqr-sqrt71.3%
+-commutative71.3%
add-sqr-sqrt94.7%
+-commutative94.7%
Applied egg-rr94.7%
associate--l+96.2%
+-inverses96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in t around inf 47.1%
Final simplification53.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 7.8e+30)
(+
(+ 1.0 (- t_2 (sqrt y)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_1 (sqrt z)))))
(+
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (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((1.0 + z));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 7.8e+30) {
tmp = (1.0 + (t_2 - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = ((1.0 / (sqrt((1.0 + x)) + 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((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
if (z <= 7.8d+30) then
tmp = (1.0d0 + (t_2 - sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + 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((1.0 + z));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 7.8e+30) {
tmp = (1.0 + (t_2 - Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = ((1.0 / (Math.sqrt((1.0 + x)) + 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((1.0 + z)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 7.8e+30: tmp = (1.0 + (t_2 - math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = ((1.0 / (math.sqrt((1.0 + x)) + 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(1.0 + z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 7.8e+30) tmp = Float64(Float64(1.0 + Float64(t_2 - sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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((1.0 + z));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 7.8e+30)
tmp = (1.0 + (t_2 - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z))));
else
tmp = ((1.0 / (sqrt((1.0 + x)) + 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[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 7.8e+30], N[(N[(1.0 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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] + 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{1 + z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 7.8 \cdot 10^{+30}:\\
\;\;\;\;\left(1 + \left(t\_2 - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{t\_2 + \sqrt{y}}\right) + \left(t\_1 - \sqrt{z}\right)\\
\end{array}
\end{array}
if z < 7.80000000000000021e30Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--97.6%
add-sqr-sqrt97.0%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate--l+98.9%
+-inverses98.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in x around 0 57.6%
if 7.80000000000000021e30 < z Initial program 94.2%
associate-+l+94.2%
sub-neg94.2%
sub-neg94.2%
+-commutative94.2%
+-commutative94.2%
+-commutative94.2%
Simplified94.2%
flip--94.3%
add-sqr-sqrt71.4%
+-commutative71.4%
add-sqr-sqrt94.6%
+-commutative94.6%
Applied egg-rr94.6%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
flip--96.0%
add-sqr-sqrt80.1%
add-sqr-sqrt96.7%
Applied egg-rr96.7%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in t around inf 48.2%
Final simplification53.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 z))))
(if (<= t 3.7e+14)
(+ 1.0 (+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (+ (sqrt z) (sqrt t)))))
(+
(- t_1 (sqrt z))
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(- (sqrt (+ 1.0 y)) (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 + z));
double tmp;
if (t <= 3.7e+14) {
tmp = 1.0 + (1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(z) + sqrt(t))));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 3.7d+14) then
tmp = 1.0d0 + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - (sqrt(z) + sqrt(t))))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (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 t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 3.7e+14) {
tmp = 1.0 + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) - (Math.sqrt(z) + Math.sqrt(t))));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (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): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 3.7e+14: tmp = 1.0 + (1.0 + ((t_1 + math.sqrt((1.0 + t))) - (math.sqrt(z) + math.sqrt(t)))) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (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) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 3.7e+14) tmp = Float64(1.0 + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - Float64(sqrt(z) + sqrt(t))))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + 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)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 3.7e+14)
tmp = 1.0 + (1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(z) + sqrt(t))));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3.7e+14], N[(1.0 + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 3.7 \cdot 10^{+14}:\\
\;\;\;\;1 + \left(1 + \left(\left(t\_1 + \sqrt{1 + t}\right) - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 3.7e14Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-77.4%
associate-+l-59.0%
associate-+r-55.5%
Simplified43.3%
Taylor expanded in y around 0 17.7%
associate--l+36.0%
+-commutative36.0%
+-commutative36.0%
associate--l+36.0%
+-commutative36.0%
+-commutative36.0%
associate-+l+36.0%
Simplified36.0%
Taylor expanded in x around 0 35.8%
associate--l+39.7%
Simplified39.7%
if 3.7e14 < t Initial program 93.9%
associate-+l+93.9%
sub-neg93.9%
sub-neg93.9%
+-commutative93.9%
+-commutative93.9%
+-commutative93.9%
Simplified93.9%
flip--93.9%
add-sqr-sqrt71.0%
+-commutative71.0%
add-sqr-sqrt94.0%
+-commutative94.0%
Applied egg-rr94.0%
associate--l+95.0%
+-inverses95.0%
metadata-eval95.0%
Simplified95.0%
Taylor expanded in t around inf 95.0%
Final simplification63.0%
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 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) (+ 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 ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (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 = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (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 ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (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 ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (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(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + 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 = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (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[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)
\end{array}
Initial program 95.6%
associate-+l+95.6%
sub-neg95.6%
sub-neg95.6%
+-commutative95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 58.9%
Final simplification58.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 (+ 1.0 z))))
(if (<= t 3900000000000.0)
(+ 1.0 (+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (+ (sqrt z) (sqrt t)))))
(+ (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))) (/ 1.0 (+ 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((1.0 + z));
double tmp;
if (t <= 3900000000000.0) {
tmp = 1.0 + (1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(z) + sqrt(t))));
} else {
tmp = (1.0 + (sqrt((1.0 + y)) - sqrt(y))) + (1.0 / (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) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 3900000000000.0d0) then
tmp = 1.0d0 + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - (sqrt(z) + sqrt(t))))
else
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))) + (1.0d0 / (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((1.0 + z));
double tmp;
if (t <= 3900000000000.0) {
tmp = 1.0 + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) - (Math.sqrt(z) + Math.sqrt(t))));
} else {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + (1.0 / (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((1.0 + z)) tmp = 0 if t <= 3900000000000.0: tmp = 1.0 + (1.0 + ((t_1 + math.sqrt((1.0 + t))) - (math.sqrt(z) + math.sqrt(t)))) else: tmp = (1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))) + (1.0 / (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(1.0 + z)) tmp = 0.0 if (t <= 3900000000000.0) tmp = Float64(1.0 + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - Float64(sqrt(z) + sqrt(t))))); else tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(1.0 / 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((1.0 + z));
tmp = 0.0;
if (t <= 3900000000000.0)
tmp = 1.0 + (1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(z) + sqrt(t))));
else
tmp = (1.0 + (sqrt((1.0 + y)) - sqrt(y))) + (1.0 / (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[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3900000000000.0], N[(1.0 + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 3900000000000:\\
\;\;\;\;1 + \left(1 + \left(\left(t\_1 + \sqrt{1 + t}\right) - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \frac{1}{t\_1 + \sqrt{z}}\\
\end{array}
\end{array}
if t < 3.9e12Initial program 97.0%
+-commutative97.0%
associate-+r+97.0%
associate-+r-77.5%
associate-+l-58.9%
associate-+r-55.4%
Simplified43.1%
Taylor expanded in y around 0 17.8%
associate--l+36.1%
+-commutative36.1%
+-commutative36.1%
associate--l+36.1%
+-commutative36.1%
+-commutative36.1%
associate-+l+36.1%
Simplified36.1%
Taylor expanded in x around 0 35.9%
associate--l+39.8%
Simplified39.8%
if 3.9e12 < t Initial program 93.7%
associate-+l+93.7%
sub-neg93.7%
sub-neg93.7%
+-commutative93.7%
+-commutative93.7%
+-commutative93.7%
Simplified93.7%
flip--94.7%
add-sqr-sqrt78.5%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
associate--l+96.1%
+-inverses96.1%
metadata-eval96.1%
Simplified96.1%
Taylor expanded in x around 0 57.9%
Taylor expanded in t around inf 57.9%
+-commutative57.9%
Simplified57.9%
Final simplification47.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 y))))
(if (<= z 8e+18)
(+ 1.0 (+ (sqrt (+ 1.0 z)) (- t_1 (+ (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 <= 8e+18) {
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (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 <= 8d+18) then
tmp = 1.0d0 + (sqrt((1.0d0 + z)) + (t_1 - (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 <= 8e+18) {
tmp = 1.0 + (Math.sqrt((1.0 + z)) + (t_1 - (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 <= 8e+18: tmp = 1.0 + (math.sqrt((1.0 + z)) + (t_1 - (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 <= 8e+18) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(t_1 - 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 <= 8e+18)
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (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, 8e+18], N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $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 8 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(\sqrt{1 + z} + \left(t\_1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 8e18Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-78.2%
associate-+l-69.7%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in t around inf 17.8%
associate--l+22.1%
associate--l+22.1%
+-commutative22.1%
associate-+r+22.1%
Simplified22.1%
Taylor expanded in x around 0 33.3%
associate--l+44.5%
+-commutative44.5%
associate--l+53.0%
+-commutative53.0%
Simplified53.0%
if 8e18 < z Initial program 94.0%
+-commutative94.0%
associate-+r+94.0%
associate-+r-73.9%
associate-+l-60.5%
associate-+r-60.5%
Simplified33.4%
Taylor expanded in t around inf 3.4%
associate--l+20.0%
associate--l+24.7%
+-commutative24.7%
associate-+r+24.7%
Simplified24.7%
Taylor expanded in z around inf 31.5%
Final simplification43.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 8e+18) (+ 1.0 (+ 1.0 (- (sqrt (+ 1.0 z)) (sqrt z)))) (+ (sqrt (+ 1.0 x)) (- (sqrt (+ 1.0 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 <= 8e+18) {
tmp = 1.0 + (1.0 + (sqrt((1.0 + z)) - sqrt(z)));
} else {
tmp = sqrt((1.0 + x)) + (sqrt((1.0 + y)) - (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) :: tmp
if (z <= 8d+18) then
tmp = 1.0d0 + (1.0d0 + (sqrt((1.0d0 + z)) - sqrt(z)))
else
tmp = sqrt((1.0d0 + x)) + (sqrt((1.0d0 + y)) - (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 tmp;
if (z <= 8e+18) {
tmp = 1.0 + (1.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else {
tmp = Math.sqrt((1.0 + x)) + (Math.sqrt((1.0 + 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 <= 8e+18: tmp = 1.0 + (1.0 + (math.sqrt((1.0 + z)) - math.sqrt(z))) else: tmp = math.sqrt((1.0 + x)) + (math.sqrt((1.0 + 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 <= 8e+18) tmp = Float64(1.0 + Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(sqrt(Float64(1.0 + 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 <= 8e+18)
tmp = 1.0 + (1.0 + (sqrt((1.0 + z)) - sqrt(z)));
else
tmp = sqrt((1.0 + x)) + (sqrt((1.0 + 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, 8e+18], N[(1.0 + N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $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 8 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(1 + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 8e18Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-78.2%
associate-+l-69.7%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in y around 0 17.6%
associate--l+34.1%
+-commutative34.1%
+-commutative34.1%
associate--l+36.3%
+-commutative36.3%
+-commutative36.3%
associate-+l+36.3%
Simplified36.3%
Taylor expanded in x around 0 33.4%
associate--l+43.3%
Simplified43.3%
Taylor expanded in t around inf 47.8%
if 8e18 < z Initial program 94.0%
+-commutative94.0%
associate-+r+94.0%
associate-+r-73.9%
associate-+l-60.5%
associate-+r-60.5%
Simplified33.4%
Taylor expanded in t around inf 3.4%
associate--l+20.0%
associate--l+24.7%
+-commutative24.7%
associate-+r+24.7%
Simplified24.7%
Taylor expanded in z around inf 31.5%
Final simplification40.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 8e+18) (+ 1.0 (+ 1.0 (- (sqrt (+ 1.0 z)) (sqrt z)))) (+ 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 <= 8e+18) {
tmp = 1.0 + (1.0 + (sqrt((1.0 + z)) - sqrt(z)));
} 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 <= 8d+18) then
tmp = 1.0d0 + (1.0d0 + (sqrt((1.0d0 + z)) - sqrt(z)))
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 <= 8e+18) {
tmp = 1.0 + (1.0 + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} 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 <= 8e+18: tmp = 1.0 + (1.0 + (math.sqrt((1.0 + z)) - math.sqrt(z))) 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 <= 8e+18) tmp = Float64(1.0 + Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); 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 <= 8e+18)
tmp = 1.0 + (1.0 + (sqrt((1.0 + z)) - sqrt(z)));
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, 8e+18], N[(1.0 + N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $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 8 \cdot 10^{+18}:\\
\;\;\;\;1 + \left(1 + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 8e18Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-78.2%
associate-+l-69.7%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in y around 0 17.6%
associate--l+34.1%
+-commutative34.1%
+-commutative34.1%
associate--l+36.3%
+-commutative36.3%
+-commutative36.3%
associate-+l+36.3%
Simplified36.3%
Taylor expanded in x around 0 33.4%
associate--l+43.3%
Simplified43.3%
Taylor expanded in t around inf 47.8%
if 8e18 < z Initial program 94.0%
+-commutative94.0%
associate-+r+94.0%
associate-+r-73.9%
associate-+l-60.5%
associate-+r-60.5%
Simplified33.4%
Taylor expanded in t around inf 3.4%
associate--l+20.0%
associate--l+24.7%
+-commutative24.7%
associate-+r+24.7%
Simplified24.7%
Taylor expanded in z around inf 31.5%
Taylor expanded in x around 0 30.1%
associate--l+51.7%
Simplified51.7%
Final simplification49.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 1.95) (+ 1.0 (+ 1.0 (- (+ 1.0 (* z 0.5)) (sqrt z)))) (+ 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 <= 1.95) {
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - sqrt(z)));
} 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 <= 1.95d0) then
tmp = 1.0d0 + (1.0d0 + ((1.0d0 + (z * 0.5d0)) - sqrt(z)))
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 <= 1.95) {
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - Math.sqrt(z)));
} 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 <= 1.95: tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - math.sqrt(z))) 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 <= 1.95) tmp = Float64(1.0 + Float64(1.0 + Float64(Float64(1.0 + Float64(z * 0.5)) - sqrt(z)))); 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 <= 1.95)
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - sqrt(z)));
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, 1.95], N[(1.0 + N[(1.0 + N[(N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $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 1.95:\\
\;\;\;\;1 + \left(1 + \left(\left(1 + z \cdot 0.5\right) - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.94999999999999996Initial program 98.8%
+-commutative98.8%
associate-+r+98.8%
associate-+r-80.6%
associate-+l-71.6%
associate-+r-59.7%
Simplified59.7%
Taylor expanded in y around 0 18.4%
associate--l+34.6%
+-commutative34.6%
+-commutative34.6%
associate--l+37.4%
+-commutative37.4%
+-commutative37.4%
associate-+l+37.4%
Simplified37.4%
Taylor expanded in x around 0 33.8%
associate--l+45.2%
Simplified45.2%
Taylor expanded in z around 0 45.2%
Taylor expanded in t around inf 47.5%
if 1.94999999999999996 < z Initial program 92.3%
+-commutative92.3%
associate-+r+92.3%
associate-+r-71.8%
associate-+l-59.3%
associate-+r-58.8%
Simplified33.9%
Taylor expanded in t around inf 3.4%
associate--l+19.5%
associate--l+23.8%
+-commutative23.8%
associate-+r+23.8%
Simplified23.8%
Taylor expanded in z around inf 30.1%
Taylor expanded in x around 0 29.6%
associate--l+50.3%
Simplified50.3%
Final simplification48.9%
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 6.6) (+ 1.0 (+ 1.0 (- (+ 1.0 (* z 0.5)) (sqrt z)))) (- (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.6) {
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - sqrt(z)));
} else {
tmp = sqrt((1.0 + x)) - 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 (z <= 6.6d0) then
tmp = 1.0d0 + (1.0d0 + ((1.0d0 + (z * 0.5d0)) - sqrt(z)))
else
tmp = sqrt((1.0d0 + x)) - 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 (z <= 6.6) {
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - Math.sqrt(z)));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 6.6: tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - math.sqrt(z))) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 6.6) tmp = Float64(1.0 + Float64(1.0 + Float64(Float64(1.0 + Float64(z * 0.5)) - sqrt(z)))); else tmp = Float64(sqrt(Float64(1.0 + x)) - 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 (z <= 6.6)
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - sqrt(z)));
else
tmp = sqrt((1.0 + x)) - 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[z, 6.6], N[(1.0 + N[(1.0 + N[(N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.6:\\
\;\;\;\;1 + \left(1 + \left(\left(1 + z \cdot 0.5\right) - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if z < 6.5999999999999996Initial program 98.8%
+-commutative98.8%
associate-+r+98.8%
associate-+r-80.6%
associate-+l-71.6%
associate-+r-59.7%
Simplified59.7%
Taylor expanded in y around 0 18.4%
associate--l+34.6%
+-commutative34.6%
+-commutative34.6%
associate--l+37.4%
+-commutative37.4%
+-commutative37.4%
associate-+l+37.4%
Simplified37.4%
Taylor expanded in x around 0 33.8%
associate--l+45.2%
Simplified45.2%
Taylor expanded in z around 0 45.2%
Taylor expanded in t around inf 47.5%
if 6.5999999999999996 < z Initial program 92.3%
+-commutative92.3%
associate-+r+92.3%
associate-+r-71.8%
associate-+l-59.3%
associate-+r-58.8%
Simplified33.9%
Taylor expanded in t around inf 3.4%
associate--l+19.5%
associate--l+23.8%
+-commutative23.8%
associate-+r+23.8%
Simplified23.8%
Taylor expanded in z around inf 30.1%
Taylor expanded in y around inf 19.6%
Final simplification34.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 0.56) (+ 1.0 (+ 3.0 (- (* z 0.5) (sqrt z)))) (+ 1.0 (+ 1.0 (- (+ 1.0 (* z 0.5)) (sqrt z))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.56) {
tmp = 1.0 + (3.0 + ((z * 0.5) - sqrt(z)));
} else {
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - 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) :: tmp
if (t <= 0.56d0) then
tmp = 1.0d0 + (3.0d0 + ((z * 0.5d0) - sqrt(z)))
else
tmp = 1.0d0 + (1.0d0 + ((1.0d0 + (z * 0.5d0)) - 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 tmp;
if (t <= 0.56) {
tmp = 1.0 + (3.0 + ((z * 0.5) - Math.sqrt(z)));
} else {
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 0.56: tmp = 1.0 + (3.0 + ((z * 0.5) - math.sqrt(z))) else: tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 0.56) tmp = Float64(1.0 + Float64(3.0 + Float64(Float64(z * 0.5) - sqrt(z)))); else tmp = Float64(1.0 + Float64(1.0 + Float64(Float64(1.0 + Float64(z * 0.5)) - sqrt(z)))); 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 (t <= 0.56)
tmp = 1.0 + (3.0 + ((z * 0.5) - sqrt(z)));
else
tmp = 1.0 + (1.0 + ((1.0 + (z * 0.5)) - 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_] := If[LessEqual[t, 0.56], N[(1.0 + N[(3.0 + N[(N[(z * 0.5), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(1.0 + N[(N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.56:\\
\;\;\;\;1 + \left(3 + \left(z \cdot 0.5 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(1 + \left(\left(1 + z \cdot 0.5\right) - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 0.56000000000000005Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-78.9%
associate-+l-60.0%
associate-+r-56.4%
Simplified44.0%
Taylor expanded in y around 0 18.3%
associate--l+36.4%
+-commutative36.4%
+-commutative36.4%
associate--l+36.4%
+-commutative36.4%
+-commutative36.4%
associate-+l+36.4%
Simplified36.4%
Taylor expanded in x around 0 36.3%
associate--l+40.5%
Simplified40.5%
Taylor expanded in z around 0 21.2%
Taylor expanded in t around 0 20.8%
associate--l+20.8%
*-commutative20.8%
Simplified20.8%
if 0.56000000000000005 < t Initial program 93.0%
+-commutative93.0%
associate-+r+93.0%
associate-+r-73.1%
associate-+l-72.6%
associate-+r-62.8%
Simplified51.1%
Taylor expanded in y around 0 3.9%
associate--l+42.0%
+-commutative42.0%
+-commutative42.0%
associate--l+36.6%
+-commutative36.6%
+-commutative36.6%
associate-+l+36.6%
Simplified36.6%
Taylor expanded in x around 0 41.4%
associate--l+47.3%
Simplified47.3%
Taylor expanded in z around 0 35.5%
Taylor expanded in t around inf 21.9%
Final simplification21.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 (+ 3.0 (- (* z 0.5) (sqrt z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (3.0 + ((z * 0.5) - sqrt(z)));
}
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 + (3.0d0 + ((z * 0.5d0) - sqrt(z)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (3.0 + ((z * 0.5) - Math.sqrt(z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (3.0 + ((z * 0.5) - math.sqrt(z)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(3.0 + Float64(Float64(z * 0.5) - sqrt(z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (3.0 + ((z * 0.5) - sqrt(z)));
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[(3.0 + N[(N[(z * 0.5), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(3 + \left(z \cdot 0.5 - \sqrt{z}\right)\right)
\end{array}
Initial program 95.6%
+-commutative95.6%
associate-+r+95.6%
associate-+r-76.3%
associate-+l-65.6%
associate-+r-59.3%
Simplified47.2%
Taylor expanded in y around 0 11.9%
associate--l+38.9%
+-commutative38.9%
+-commutative38.9%
associate--l+36.5%
+-commutative36.5%
+-commutative36.5%
associate-+l+36.5%
Simplified36.5%
Taylor expanded in x around 0 38.6%
associate--l+43.5%
Simplified43.5%
Taylor expanded in z around 0 27.6%
Taylor expanded in t around 0 17.1%
associate--l+17.1%
*-commutative17.1%
Simplified17.1%
Final simplification17.1%
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 (+ 1.0 (* z 0.5))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (1.0 + (z * 0.5));
}
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 + (1.0d0 + (z * 0.5d0))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (1.0 + (z * 0.5));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (1.0 + (z * 0.5))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(1.0 + Float64(z * 0.5))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (1.0 + (z * 0.5));
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[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(1 + z \cdot 0.5\right)
\end{array}
Initial program 95.6%
+-commutative95.6%
associate-+r+95.6%
associate-+r-76.3%
associate-+l-65.6%
associate-+r-59.3%
Simplified47.2%
Taylor expanded in y around 0 11.9%
associate--l+38.9%
+-commutative38.9%
+-commutative38.9%
associate--l+36.5%
+-commutative36.5%
+-commutative36.5%
associate-+l+36.5%
Simplified36.5%
Taylor expanded in x around 0 38.6%
associate--l+43.5%
Simplified43.5%
Taylor expanded in z around 0 27.6%
Taylor expanded in z around inf 26.0%
*-commutative26.0%
Simplified26.0%
Final simplification26.0%
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 z))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - z;
}
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 - z
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - z;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - z
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - z) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - z;
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 - z), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - z
\end{array}
Initial program 95.6%
+-commutative95.6%
associate-+r+95.6%
associate-+r-76.3%
associate-+l-65.6%
associate-+r-59.3%
Simplified47.2%
Taylor expanded in y around 0 11.9%
associate--l+38.9%
+-commutative38.9%
+-commutative38.9%
associate--l+36.5%
+-commutative36.5%
+-commutative36.5%
associate-+l+36.5%
Simplified36.5%
flip-+20.9%
add-sqr-sqrt16.0%
add-sqr-sqrt13.0%
Applied egg-rr13.0%
associate--r+13.2%
+-commutative13.2%
associate--l+13.5%
metadata-eval13.5%
Simplified13.5%
Taylor expanded in z around inf 15.1%
mul-1-neg15.1%
*-commutative15.1%
distribute-rgt-neg-in15.1%
Simplified15.1%
Taylor expanded in x around 0 12.9%
neg-mul-112.9%
Simplified12.9%
Final simplification12.9%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024062
(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))))