
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (sqrt (+ 1.0 y))))
(if (<= t_3 0.04)
(+
(+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_4 (sqrt y))))
(/ 1.0 (+ t_2 (sqrt z))))
(+
(+ (- t_1 (sqrt x)) (- t_4 (sqrt y)))
(+ t_3 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))))))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 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((1.0 + y));
double tmp;
if (t_3 <= 0.04) {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_4 + sqrt(y)))) + (1.0 / (t_2 + sqrt(z)));
} else {
tmp = ((t_1 - sqrt(x)) + (t_4 - sqrt(y))) + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((1.0d0 + y))
if (t_3 <= 0.04d0) then
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_4 + sqrt(y)))) + (1.0d0 / (t_2 + sqrt(z)))
else
tmp = ((t_1 - sqrt(x)) + (t_4 - sqrt(y))) + (t_3 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((1.0 + y));
double tmp;
if (t_3 <= 0.04) {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_4 + Math.sqrt(y)))) + (1.0 / (t_2 + Math.sqrt(z)));
} else {
tmp = ((t_1 - Math.sqrt(x)) + (t_4 - Math.sqrt(y))) + (t_3 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
}
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 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((1.0 + y)) tmp = 0 if t_3 <= 0.04: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_4 + math.sqrt(y)))) + (1.0 / (t_2 + math.sqrt(z))) else: tmp = ((t_1 - math.sqrt(x)) + (t_4 - math.sqrt(y))) + (t_3 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) 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 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (t_3 <= 0.04) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_4 + sqrt(y)))) + Float64(1.0 / Float64(t_2 + sqrt(z)))); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + Float64(t_4 - sqrt(y))) + Float64(t_3 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((1.0 + y));
tmp = 0.0;
if (t_3 <= 0.04)
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_4 + sqrt(y)))) + (1.0 / (t_2 + sqrt(z)));
else
tmp = ((t_1 - sqrt(x)) + (t_4 - sqrt(y))) + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.04], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t_2 - \sqrt{z}\\
t_4 := \sqrt{1 + y}\\
\mathbf{if}\;t_3 \leq 0.04:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_4 + \sqrt{y}}\right) + \frac{1}{t_2 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t_1 - \sqrt{x}\right) + \left(t_4 - \sqrt{y}\right)\right) + \left(t_3 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.0400000000000000008Initial program 89.1%
associate-+l+89.1%
associate-+l-66.1%
associate-+l-89.1%
sub-neg89.1%
sub-neg89.1%
+-commutative89.1%
+-commutative89.1%
+-commutative89.1%
Simplified89.1%
flip--89.1%
add-sqr-sqrt70.7%
+-commutative70.7%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
Simplified90.8%
flip--90.8%
add-sqr-sqrt78.5%
add-sqr-sqrt90.8%
Applied egg-rr90.8%
associate--l+92.8%
+-inverses92.8%
metadata-eval92.8%
Simplified92.8%
flip--92.8%
add-sqr-sqrt54.7%
add-sqr-sqrt93.4%
Applied egg-rr93.4%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
Taylor expanded in t around inf 57.4%
if 0.0400000000000000008 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.9%
associate-+l+97.9%
associate-+l-75.8%
associate-+l-97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
flip--97.9%
add-sqr-sqrt77.9%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate--l+98.1%
+-inverses98.1%
metadata-eval98.1%
Simplified98.1%
Final simplification78.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 x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (sqrt (+ 1.0 y))))
(if (<= t_3 0.04)
(+
(+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_4 (sqrt y))))
(/ 1.0 (+ t_2 (sqrt z))))
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(+ t_3 (+ (- t_1 (sqrt x)) (- t_4 (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 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((1.0 + y));
double tmp;
if (t_3 <= 0.04) {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_4 + sqrt(y)))) + (1.0 / (t_2 + sqrt(z)));
} else {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (t_3 + ((t_1 - sqrt(x)) + (t_4 - 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) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((1.0d0 + y))
if (t_3 <= 0.04d0) then
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_4 + sqrt(y)))) + (1.0d0 / (t_2 + sqrt(z)))
else
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + (t_3 + ((t_1 - sqrt(x)) + (t_4 - 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 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((1.0 + y));
double tmp;
if (t_3 <= 0.04) {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_4 + Math.sqrt(y)))) + (1.0 / (t_2 + Math.sqrt(z)));
} else {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (t_3 + ((t_1 - Math.sqrt(x)) + (t_4 - 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 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((1.0 + y)) tmp = 0 if t_3 <= 0.04: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_4 + math.sqrt(y)))) + (1.0 / (t_2 + math.sqrt(z))) else: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (t_3 + ((t_1 - math.sqrt(x)) + (t_4 - 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 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (t_3 <= 0.04) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_4 + sqrt(y)))) + Float64(1.0 / Float64(t_2 + sqrt(z)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(t_3 + Float64(Float64(t_1 - sqrt(x)) + Float64(t_4 - 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 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((1.0 + y));
tmp = 0.0;
if (t_3 <= 0.04)
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_4 + sqrt(y)))) + (1.0 / (t_2 + sqrt(z)));
else
tmp = (sqrt((1.0 + t)) - sqrt(t)) + (t_3 + ((t_1 - sqrt(x)) + (t_4 - 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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.04], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - 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 + z}\\
t_3 := t_2 - \sqrt{z}\\
t_4 := \sqrt{1 + y}\\
\mathbf{if}\;t_3 \leq 0.04:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_4 + \sqrt{y}}\right) + \frac{1}{t_2 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t_3 + \left(\left(t_1 - \sqrt{x}\right) + \left(t_4 - \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.0400000000000000008Initial program 89.1%
associate-+l+89.1%
associate-+l-66.1%
associate-+l-89.1%
sub-neg89.1%
sub-neg89.1%
+-commutative89.1%
+-commutative89.1%
+-commutative89.1%
Simplified89.1%
flip--89.1%
add-sqr-sqrt70.7%
+-commutative70.7%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
Simplified90.8%
flip--90.8%
add-sqr-sqrt78.5%
add-sqr-sqrt90.8%
Applied egg-rr90.8%
associate--l+92.8%
+-inverses92.8%
metadata-eval92.8%
Simplified92.8%
flip--92.8%
add-sqr-sqrt54.7%
add-sqr-sqrt93.4%
Applied egg-rr93.4%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
Taylor expanded in t around inf 57.4%
if 0.0400000000000000008 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.9%
Final simplification78.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 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))) (+ (/ 1.0 (+ (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)))) + ((1.0 / (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)))) + ((1.0d0 / (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)))) + ((1.0 / (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)))) + ((1.0 / (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(1.0 / 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)))) + ((1.0 / (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[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $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(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
Initial program 93.6%
associate-+l+93.6%
associate-+l-71.1%
associate-+l-93.6%
sub-neg93.6%
sub-neg93.6%
+-commutative93.6%
+-commutative93.6%
+-commutative93.6%
Simplified93.6%
flip--93.7%
add-sqr-sqrt72.2%
+-commutative72.2%
add-sqr-sqrt93.9%
+-commutative93.9%
Applied egg-rr93.9%
associate--l+94.8%
+-inverses94.8%
metadata-eval94.8%
Simplified94.8%
flip--94.9%
add-sqr-sqrt76.3%
add-sqr-sqrt95.1%
Applied egg-rr95.1%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
flip--96.3%
add-sqr-sqrt77.7%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
associate--l+97.8%
+-inverses97.8%
metadata-eval97.8%
Simplified97.8%
Final simplification97.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 x)) (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z)))))
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 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - 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 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - 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 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
}
[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 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z)))
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 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))) 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 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - 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[(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 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $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 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)
\end{array}
Initial program 93.6%
associate-+l+93.6%
associate-+l-71.1%
associate-+l-93.6%
sub-neg93.6%
sub-neg93.6%
+-commutative93.6%
+-commutative93.6%
+-commutative93.6%
Simplified93.6%
flip--93.7%
add-sqr-sqrt72.2%
+-commutative72.2%
add-sqr-sqrt93.9%
+-commutative93.9%
Applied egg-rr93.9%
associate--l+94.8%
+-inverses94.8%
metadata-eval94.8%
Simplified94.8%
flip--94.9%
add-sqr-sqrt76.3%
add-sqr-sqrt95.1%
Applied egg-rr95.1%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
Final simplification96.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))) (t_2 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(if (<= y 1e-10)
(+
(+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ (- t_1 (sqrt x)) (- (+ 1.0 (* y 0.5)) (sqrt y))))
(+
(+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (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 = 1.0 / (sqrt((1.0 + z)) + sqrt(z));
double tmp;
if (y <= 1e-10) {
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 - sqrt(x)) + ((1.0 + (y * 0.5)) - sqrt(y)));
} else {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + 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 = 1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))
if (y <= 1d-10) then
tmp = (t_2 + (sqrt((1.0d0 + t)) - sqrt(t))) + ((t_1 - sqrt(x)) + ((1.0d0 + (y * 0.5d0)) - sqrt(y)))
else
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + 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 = 1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z));
double tmp;
if (y <= 1e-10) {
tmp = (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((t_1 - Math.sqrt(x)) + ((1.0 + (y * 0.5)) - Math.sqrt(y)));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + 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 = 1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)) tmp = 0 if y <= 1e-10: tmp = (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((t_1 - math.sqrt(x)) + ((1.0 + (y * 0.5)) - math.sqrt(y))) else: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + 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 = Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) tmp = 0.0 if (y <= 1e-10) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 + Float64(y * 0.5)) - sqrt(y)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + 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 = 1.0 / (sqrt((1.0 + z)) + sqrt(z));
tmp = 0.0;
if (y <= 1e-10)
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 - sqrt(x)) + ((1.0 + (y * 0.5)) - sqrt(y)));
else
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + 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[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1e-10], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + 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] + t$95$2), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\
\mathbf{if}\;y \leq 10^{-10}:\\
\;\;\;\;\left(t_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(t_1 - \sqrt{x}\right) + \left(\left(1 + y \cdot 0.5\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + t_2\\
\end{array}
\end{array}
if y < 1.00000000000000004e-10Initial program 98.8%
associate-+l+98.8%
associate-+l-57.7%
associate-+l-98.8%
sub-neg98.8%
sub-neg98.8%
+-commutative98.8%
+-commutative98.8%
+-commutative98.8%
Simplified98.8%
flip--99.0%
add-sqr-sqrt82.2%
add-sqr-sqrt99.3%
Applied egg-rr99.0%
associate--l+99.6%
+-inverses99.6%
metadata-eval99.6%
Simplified99.3%
Taylor expanded in y around 0 99.3%
*-commutative99.3%
Simplified99.3%
if 1.00000000000000004e-10 < y Initial program 87.7%
associate-+l+87.7%
associate-+l-86.4%
associate-+l-87.7%
sub-neg87.7%
sub-neg87.7%
+-commutative87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--87.9%
add-sqr-sqrt68.7%
+-commutative68.7%
add-sqr-sqrt88.1%
+-commutative88.1%
Applied egg-rr88.1%
associate--l+89.8%
+-inverses89.8%
metadata-eval89.8%
Simplified89.8%
flip--90.1%
add-sqr-sqrt50.2%
add-sqr-sqrt90.6%
Applied egg-rr90.6%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
Simplified93.2%
flip--93.2%
add-sqr-sqrt72.5%
add-sqr-sqrt93.5%
Applied egg-rr93.5%
associate--l+95.8%
+-inverses95.8%
metadata-eval95.8%
Simplified95.8%
Taylor expanded in t around inf 58.0%
Final simplification80.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 x))))
(if (<= t 4100000.0)
(+ (- t_2 (sqrt x)) (+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (sqrt t))))
(+
(+ (/ 1.0 (+ t_2 (sqrt x))) (/ 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 t_2 = sqrt((1.0 + x));
double tmp;
if (t <= 4100000.0) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
} else {
tmp = ((1.0 / (t_2 + sqrt(x))) + (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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
if (t <= 4100000.0d0) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - sqrt(t)))
else
tmp = ((1.0d0 / (t_2 + sqrt(x))) + (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 t_2 = Math.sqrt((1.0 + x));
double tmp;
if (t <= 4100000.0) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) - Math.sqrt(t)));
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(x))) + (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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if t <= 4100000.0: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 + math.sqrt((1.0 + t))) - math.sqrt(t))) else: tmp = ((1.0 / (t_2 + math.sqrt(x))) + (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)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (t <= 4100000.0) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - sqrt(t)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (t <= 4100000.0)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
else
tmp = ((1.0 / (t_2 + sqrt(x))) + (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]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 4100000.0], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + 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[(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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;t \leq 4100000:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 + \sqrt{1 + t}\right) - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t_2 + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \frac{1}{t_1 + \sqrt{z}}\\
\end{array}
\end{array}
if t < 4.1e6Initial program 98.5%
associate-+l+98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+r-60.6%
Simplified40.9%
Taylor expanded in y around 0 42.3%
associate--l+60.1%
Simplified60.1%
Taylor expanded in z around 0 37.9%
if 4.1e6 < t Initial program 89.2%
associate-+l+89.2%
associate-+l-67.8%
associate-+l-89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
flip--89.1%
add-sqr-sqrt75.6%
+-commutative75.6%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
flip--91.1%
add-sqr-sqrt70.3%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate--l+93.6%
+-inverses93.6%
metadata-eval93.6%
Simplified93.6%
flip--93.6%
add-sqr-sqrt72.4%
add-sqr-sqrt93.8%
Applied egg-rr93.8%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
Taylor expanded in t around inf 95.9%
Final simplification68.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 z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= t 15000000.0)
(+
(- t_2 (sqrt x))
(+ 1.0 (+ (+ t_1 (sqrt (+ 1.0 t))) (/ (- z t) (- (sqrt t) (sqrt z))))))
(+
(+ (/ 1.0 (+ t_2 (sqrt x))) (/ 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 t_2 = sqrt((1.0 + x));
double tmp;
if (t <= 15000000.0) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) + ((z - t) / (sqrt(t) - sqrt(z)))));
} else {
tmp = ((1.0 / (t_2 + sqrt(x))) + (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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
if (t <= 15000000.0d0) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) + ((z - t) / (sqrt(t) - sqrt(z)))))
else
tmp = ((1.0d0 / (t_2 + sqrt(x))) + (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 t_2 = Math.sqrt((1.0 + x));
double tmp;
if (t <= 15000000.0) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) + ((z - t) / (Math.sqrt(t) - Math.sqrt(z)))));
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(x))) + (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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if t <= 15000000.0: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 + math.sqrt((1.0 + t))) + ((z - t) / (math.sqrt(t) - math.sqrt(z))))) else: tmp = ((1.0 / (t_2 + math.sqrt(x))) + (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)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (t <= 15000000.0) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) + Float64(Float64(z - t) / Float64(sqrt(t) - sqrt(z)))))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (t <= 15000000.0)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) + ((z - t) / (sqrt(t) - sqrt(z)))));
else
tmp = ((1.0 / (t_2 + sqrt(x))) + (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]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 15000000.0], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(z - t), $MachinePrecision] / N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + 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[(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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;t \leq 15000000:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 + \sqrt{1 + t}\right) + \frac{z - t}{\sqrt{t} - \sqrt{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t_2 + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \frac{1}{t_1 + \sqrt{z}}\\
\end{array}
\end{array}
if t < 1.5e7Initial program 98.5%
associate-+l+98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+r-60.6%
Simplified40.9%
Taylor expanded in y around 0 42.3%
associate--l+60.1%
Simplified60.1%
flip-+58.8%
add-sqr-sqrt58.8%
add-sqr-sqrt51.4%
Applied egg-rr51.4%
if 1.5e7 < t Initial program 89.2%
associate-+l+89.2%
associate-+l-67.8%
associate-+l-89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
flip--89.1%
add-sqr-sqrt75.6%
+-commutative75.6%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
flip--91.1%
add-sqr-sqrt70.3%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate--l+93.6%
+-inverses93.6%
metadata-eval93.6%
Simplified93.6%
flip--93.6%
add-sqr-sqrt72.4%
add-sqr-sqrt93.8%
Applied egg-rr93.8%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
Taylor expanded in t around inf 95.9%
Final simplification74.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))) (t_2 (sqrt (+ 1.0 x))))
(if (<= t 210000000.0)
(+ (- t_2 (sqrt x)) (+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (sqrt t))))
(+
(/ 1.0 (+ t_1 (sqrt z)))
(+ (/ 1.0 (+ t_2 (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 t_2 = sqrt((1.0 + x));
double tmp;
if (t <= 210000000.0) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
} else {
tmp = (1.0 / (t_1 + sqrt(z))) + ((1.0 / (t_2 + 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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
if (t <= 210000000.0d0) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - sqrt(t)))
else
tmp = (1.0d0 / (t_1 + sqrt(z))) + ((1.0d0 / (t_2 + 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 t_2 = Math.sqrt((1.0 + x));
double tmp;
if (t <= 210000000.0) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) - Math.sqrt(t)));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(z))) + ((1.0 / (t_2 + 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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if t <= 210000000.0: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 + math.sqrt((1.0 + t))) - math.sqrt(t))) else: tmp = (1.0 / (t_1 + math.sqrt(z))) + ((1.0 / (t_2 + 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)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (t <= 210000000.0) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - sqrt(t)))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(Float64(1.0 / Float64(t_2 + 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (t <= 210000000.0)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
else
tmp = (1.0 / (t_1 + sqrt(z))) + ((1.0 / (t_2 + 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]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 210000000.0], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;t \leq 210000000:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 + \sqrt{1 + t}\right) - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{z}} + \left(\frac{1}{t_2 + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 2.1e8Initial program 98.5%
associate-+l+98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+r-60.6%
Simplified40.9%
Taylor expanded in y around 0 42.3%
associate--l+60.1%
Simplified60.1%
Taylor expanded in z around 0 37.9%
if 2.1e8 < t Initial program 89.2%
associate-+l+89.2%
associate-+l-67.8%
associate-+l-89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
flip--89.1%
add-sqr-sqrt75.6%
+-commutative75.6%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in t around inf 90.7%
flip--93.6%
add-sqr-sqrt72.4%
add-sqr-sqrt93.8%
Applied egg-rr90.9%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified93.0%
Final simplification66.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))) (t_2 (sqrt (+ 1.0 x))))
(if (<= t 6900000.0)
(+ (- t_2 (sqrt x)) (+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (sqrt t))))
(+
(+ (/ 1.0 (+ t_2 (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (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 + x));
double tmp;
if (t <= 6900000.0) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
} else {
tmp = ((1.0 / (t_2 + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + 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 + x))
if (t <= 6900000.0d0) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - sqrt(t)))
else
tmp = ((1.0d0 / (t_2 + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + 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 + x));
double tmp;
if (t <= 6900000.0) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) - Math.sqrt(t)));
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + 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 + x)) tmp = 0 if t <= 6900000.0: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 + math.sqrt((1.0 + t))) - math.sqrt(t))) else: tmp = ((1.0 / (t_2 + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + 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 + x)) tmp = 0.0 if (t <= 6900000.0) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - sqrt(t)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + 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 + x));
tmp = 0.0;
if (t <= 6900000.0)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
else
tmp = ((1.0 / (t_2 + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + 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 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 6900000.0], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + 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[(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 + x}\\
\mathbf{if}\;t \leq 6900000:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 + \sqrt{1 + t}\right) - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t_2 + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(t_1 - \sqrt{z}\right)\\
\end{array}
\end{array}
if t < 6.9e6Initial program 98.5%
associate-+l+98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+r-60.6%
Simplified40.9%
Taylor expanded in y around 0 42.3%
associate--l+60.1%
Simplified60.1%
Taylor expanded in z around 0 37.9%
if 6.9e6 < t Initial program 89.2%
associate-+l+89.2%
associate-+l-67.8%
associate-+l-89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
flip--89.1%
add-sqr-sqrt75.6%
+-commutative75.6%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
flip--91.1%
add-sqr-sqrt70.3%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate--l+93.6%
+-inverses93.6%
metadata-eval93.6%
Simplified93.6%
Taylor expanded in t around inf 93.5%
Final simplification66.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= t 6900000.0)
(+ (- t_2 (sqrt x)) (+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (sqrt t))))
(+
(- t_1 (sqrt z))
(+ (/ 1.0 (+ t_2 (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 t_2 = sqrt((1.0 + x));
double tmp;
if (t <= 6900000.0) {
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (t_2 + 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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
if (t <= 6900000.0d0) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - sqrt(t)))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (t_2 + 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 t_2 = Math.sqrt((1.0 + x));
double tmp;
if (t <= 6900000.0) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + ((t_1 + Math.sqrt((1.0 + t))) - Math.sqrt(t)));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (t_2 + 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)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if t <= 6900000.0: tmp = (t_2 - math.sqrt(x)) + (1.0 + ((t_1 + math.sqrt((1.0 + t))) - math.sqrt(t))) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (t_2 + 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)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (t <= 6900000.0) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - sqrt(t)))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(t_2 + 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));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (t <= 6900000.0)
tmp = (t_2 - sqrt(x)) + (1.0 + ((t_1 + sqrt((1.0 + t))) - sqrt(t)));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (t_2 + 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]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 6900000.0], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + 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}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;t \leq 6900000:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(\left(t_1 + \sqrt{1 + t}\right) - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \sqrt{z}\right) + \left(\frac{1}{t_2 + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 6.9e6Initial program 98.5%
associate-+l+98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+l+98.5%
+-commutative98.5%
associate-+r-60.6%
Simplified40.9%
Taylor expanded in y around 0 42.3%
associate--l+60.1%
Simplified60.1%
Taylor expanded in z around 0 37.9%
if 6.9e6 < t Initial program 89.2%
associate-+l+89.2%
associate-+l-67.8%
associate-+l-89.2%
sub-neg89.2%
sub-neg89.2%
+-commutative89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
flip--89.1%
add-sqr-sqrt75.6%
+-commutative75.6%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in t around inf 90.7%
Final simplification65.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 y))))
(if (<= z 9.6e+17)
(+ 1.0 (+ (sqrt (+ 1.0 z)) (- t_1 (+ (sqrt y) (sqrt z)))))
(+ (/ 1.0 (+ (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 <= 9.6e+17) {
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(y) + sqrt(z))));
} else {
tmp = (1.0 / (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 <= 9.6d+17) then
tmp = 1.0d0 + (sqrt((1.0d0 + z)) + (t_1 - (sqrt(y) + sqrt(z))))
else
tmp = (1.0d0 / (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 <= 9.6e+17) {
tmp = 1.0 + (Math.sqrt((1.0 + z)) + (t_1 - (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = (1.0 / (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 <= 9.6e+17: tmp = 1.0 + (math.sqrt((1.0 + z)) + (t_1 - (math.sqrt(y) + math.sqrt(z)))) else: tmp = (1.0 / (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 <= 9.6e+17) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(t_1 - Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(1.0 / 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 <= 9.6e+17)
tmp = 1.0 + (sqrt((1.0 + z)) + (t_1 - (sqrt(y) + sqrt(z))));
else
tmp = (1.0 / (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, 9.6e+17], 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[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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 9.6 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(\sqrt{1 + z} + \left(t_1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(t_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 9.6e17Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
associate-+l+96.8%
+-commutative96.8%
associate-+r-96.8%
Simplified38.8%
Taylor expanded in t around inf 17.7%
associate--l+21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in x around 0 33.4%
associate--l+48.6%
+-commutative48.6%
+-commutative48.6%
associate--l+53.1%
Simplified53.1%
if 9.6e17 < z Initial program 90.1%
associate-+l+90.1%
associate-+l-66.7%
associate-+l-90.1%
sub-neg90.1%
sub-neg90.1%
+-commutative90.1%
+-commutative90.1%
+-commutative90.1%
Simplified90.1%
flip--90.0%
add-sqr-sqrt71.6%
+-commutative71.6%
add-sqr-sqrt90.3%
+-commutative90.3%
Applied egg-rr90.3%
associate--l+91.8%
+-inverses91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in t around inf 53.6%
Taylor expanded in z around inf 40.6%
+-commutative40.6%
+-commutative40.6%
associate-+r-53.6%
+-commutative53.6%
+-commutative53.6%
Simplified53.6%
Final simplification53.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 (<= y 1.9e-20)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 8e+15)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (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 (y <= 1.9e-20) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 8e+15) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (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 (y <= 1.9d-20) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 8d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (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 (y <= 1.9e-20) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 8e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (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 y <= 1.9e-20: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 8e+15: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (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 (y <= 1.9e-20) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 8e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / 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 (y <= 1.9e-20)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 8e+15)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (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[y, 1.9e-20], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 8e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-20}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.8999999999999999e-20Initial program 98.7%
associate-+l+98.7%
associate-+l+98.7%
+-commutative98.7%
associate-+l+98.7%
+-commutative98.7%
associate-+r-57.7%
Simplified40.5%
Taylor expanded in t around inf 14.7%
associate--l+19.0%
+-commutative19.0%
Simplified19.0%
Taylor expanded in x around 0 31.2%
associate--l+46.6%
+-commutative46.6%
+-commutative46.6%
associate--l+46.6%
Simplified46.6%
Taylor expanded in y around 0 31.2%
associate--l+59.6%
Simplified59.6%
if 1.8999999999999999e-20 < y < 8e15Initial program 92.0%
associate-+l+92.0%
associate-+l+92.0%
+-commutative92.0%
associate-+l+92.0%
+-commutative92.0%
associate-+r-51.9%
Simplified16.5%
Taylor expanded in t around inf 41.9%
associate--l+46.7%
+-commutative46.7%
Simplified46.7%
Taylor expanded in z around inf 27.9%
Taylor expanded in x around 0 43.1%
associate--l+43.3%
Simplified43.3%
if 8e15 < y Initial program 87.5%
associate-+l+87.5%
associate-+l+87.5%
+-commutative87.5%
associate-+l+87.5%
+-commutative87.5%
associate-+r-68.9%
Simplified10.5%
Taylor expanded in t around inf 4.1%
associate--l+20.1%
+-commutative20.1%
Simplified20.1%
Taylor expanded in z around inf 19.5%
Taylor expanded in y around inf 19.9%
flip--19.9%
add-sqr-sqrt20.2%
add-sqr-sqrt19.9%
div-inv19.9%
associate--l+22.7%
Applied egg-rr22.7%
+-inverses22.7%
metadata-eval22.7%
*-lft-identity22.7%
+-commutative22.7%
Simplified22.7%
Final simplification43.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)) (sqrt x)))) (if (<= y 1.4) (+ 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 <= 1.4) {
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 <= 1.4d0) 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 <= 1.4) {
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 <= 1.4: 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 <= 1.4) 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 <= 1.4)
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, 1.4], 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 1.4:\\
\;\;\;\;1 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 1.3999999999999999Initial program 98.8%
associate-+l+98.8%
associate-+l+98.8%
+-commutative98.8%
associate-+l+98.8%
+-commutative98.8%
associate-+r-57.6%
Simplified40.0%
Taylor expanded in t around inf 15.7%
associate--l+19.9%
+-commutative19.9%
Simplified19.9%
Taylor expanded in z around inf 25.8%
Taylor expanded in y around 0 25.4%
associate--l+41.2%
Simplified41.2%
if 1.3999999999999999 < y Initial program 87.4%
associate-+l+87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-67.8%
Simplified10.3%
Taylor expanded in t around inf 6.5%
associate--l+22.0%
+-commutative22.0%
Simplified22.0%
Taylor expanded in z around inf 20.0%
Taylor expanded in y around inf 19.7%
Final simplification31.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 (<= y 1.95e-20) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0) (+ 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 (y <= 1.95e-20) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} 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 (y <= 1.95d-20) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
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 (y <= 1.95e-20) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} 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 y <= 1.95e-20: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 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 (y <= 1.95e-20) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); 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 (y <= 1.95e-20)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
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[y, 1.95e-20], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $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}\;y \leq 1.95 \cdot 10^{-20}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 1.95000000000000004e-20Initial program 98.7%
associate-+l+98.7%
associate-+l+98.7%
+-commutative98.7%
associate-+l+98.7%
+-commutative98.7%
associate-+r-57.7%
Simplified40.5%
Taylor expanded in t around inf 14.7%
associate--l+19.0%
+-commutative19.0%
Simplified19.0%
Taylor expanded in x around 0 31.2%
associate--l+46.6%
+-commutative46.6%
+-commutative46.6%
associate--l+46.6%
Simplified46.6%
Taylor expanded in y around 0 31.2%
associate--l+59.6%
Simplified59.6%
if 1.95000000000000004e-20 < y Initial program 88.0%
associate-+l+88.0%
associate-+l+88.0%
+-commutative88.0%
associate-+l+88.0%
+-commutative88.0%
associate-+r-67.1%
Simplified11.1%
Taylor expanded in t around inf 8.1%
associate--l+23.0%
+-commutative23.0%
Simplified23.0%
Taylor expanded in z around inf 20.4%
Taylor expanded in x around 0 9.3%
associate--l+46.2%
Simplified46.2%
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 (+ 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 93.6%
associate-+l+93.6%
associate-+l+93.6%
+-commutative93.6%
associate-+l+93.6%
+-commutative93.6%
associate-+r-62.2%
Simplified26.5%
Taylor expanded in t around inf 11.6%
associate--l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in z around inf 23.2%
Taylor expanded in x around 0 30.5%
associate--l+48.1%
Simplified48.1%
Final simplification48.1%
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 93.6%
associate-+l+93.6%
associate-+l+93.6%
+-commutative93.6%
associate-+l+93.6%
+-commutative93.6%
associate-+r-62.2%
Simplified26.5%
Taylor expanded in t around inf 11.6%
associate--l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in z around inf 23.2%
Taylor expanded in y around inf 14.7%
Final simplification14.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)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 93.6%
associate-+l+93.6%
associate-+l+93.6%
+-commutative93.6%
associate-+l+93.6%
+-commutative93.6%
associate-+r-62.2%
Simplified26.5%
Taylor expanded in t around inf 11.6%
associate--l+20.9%
+-commutative20.9%
Simplified20.9%
Taylor expanded in z around inf 23.2%
Taylor expanded in y around inf 14.7%
Taylor expanded in x around 0 35.0%
Final simplification35.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 2023310
(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))))