
(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 14 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.005)
(+
(/ 1.0 (+ (sqrt x) t_1))
(+ (/ 1.0 (+ (sqrt z) t_2)) (/ 1.0 (+ t_4 (sqrt y)))))
(+
(- t_1 (sqrt x))
(+ (- t_4 (sqrt y)) (+ t_3 (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 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.005) {
tmp = (1.0 / (sqrt(x) + t_1)) + ((1.0 / (sqrt(z) + t_2)) + (1.0 / (t_4 + sqrt(y))));
} else {
tmp = (t_1 - sqrt(x)) + ((t_4 - sqrt(y)) + (t_3 + (1.0 / (sqrt(t) + sqrt((1.0 + 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.005d0) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((1.0d0 / (sqrt(z) + t_2)) + (1.0d0 / (t_4 + sqrt(y))))
else
tmp = (t_1 - sqrt(x)) + ((t_4 - sqrt(y)) + (t_3 + (1.0d0 / (sqrt(t) + sqrt((1.0d0 + 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.005) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((1.0 / (Math.sqrt(z) + t_2)) + (1.0 / (t_4 + Math.sqrt(y))));
} else {
tmp = (t_1 - Math.sqrt(x)) + ((t_4 - Math.sqrt(y)) + (t_3 + (1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + 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.005: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((1.0 / (math.sqrt(z) + t_2)) + (1.0 / (t_4 + math.sqrt(y)))) else: tmp = (t_1 - math.sqrt(x)) + ((t_4 - math.sqrt(y)) + (t_3 + (1.0 / (math.sqrt(t) + math.sqrt((1.0 + 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.005) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(1.0 / Float64(sqrt(z) + t_2)) + Float64(1.0 / Float64(t_4 + sqrt(y))))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(t_4 - sqrt(y)) + Float64(t_3 + Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + 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.005)
tmp = (1.0 / (sqrt(x) + t_1)) + ((1.0 / (sqrt(z) + t_2)) + (1.0 / (t_4 + sqrt(y))));
else
tmp = (t_1 - sqrt(x)) + ((t_4 - sqrt(y)) + (t_3 + (1.0 / (sqrt(t) + sqrt((1.0 + 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.005], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t_2 - \sqrt{z}\\
t_4 := \sqrt{1 + y}\\
\mathbf{if}\;t_3 \leq 0.005:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1} + \left(\frac{1}{\sqrt{z} + t_2} + \frac{1}{t_4 + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \sqrt{x}\right) + \left(\left(t_4 - \sqrt{y}\right) + \left(t_3 + \frac{1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.0050000000000000001Initial program 90.6%
associate-+l+90.6%
associate-+l+90.6%
+-commutative90.6%
+-commutative90.6%
+-commutative90.6%
Simplified90.6%
flip--91.0%
add-sqr-sqrt74.3%
add-sqr-sqrt91.4%
Applied egg-rr91.4%
+-commutative91.4%
associate--l+92.3%
+-inverses92.3%
metadata-eval92.3%
+-commutative92.3%
+-commutative92.3%
Simplified92.3%
flip--92.5%
add-sqr-sqrt78.6%
add-sqr-sqrt92.6%
Applied egg-rr92.6%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in t around inf 25.2%
+-commutative25.2%
+-commutative25.2%
associate-+r-46.3%
+-commutative46.3%
+-commutative46.3%
Simplified46.3%
flip--46.4%
add-sqr-sqrt27.3%
add-sqr-sqrt46.9%
Applied egg-rr46.9%
associate--l+48.4%
+-inverses48.4%
metadata-eval48.4%
+-commutative48.4%
+-commutative48.4%
Simplified48.4%
if 0.0050000000000000001 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--97.2%
add-sqr-sqrt76.9%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate--l+97.6%
+-inverses97.6%
metadata-eval97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Final simplification74.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 x))) (t_2 (sqrt (+ 1.0 z))) (t_3 (- t_2 (sqrt z))))
(if (<= t_3 0.9)
(+
(/ 1.0 (+ (sqrt x) t_1))
(+ (/ 1.0 (+ (sqrt z) t_2)) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(+
(- t_1 (sqrt x))
(+ 1.0 (+ t_3 (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 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 tmp;
if (t_3 <= 0.9) {
tmp = (1.0 / (sqrt(x) + t_1)) + ((1.0 / (sqrt(z) + t_2)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
} else {
tmp = (t_1 - sqrt(x)) + (1.0 + (t_3 + (1.0 / (sqrt(t) + sqrt((1.0 + t))))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
if (t_3 <= 0.9d0) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((1.0d0 / (sqrt(z) + t_2)) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))))
else
tmp = (t_1 - sqrt(x)) + (1.0d0 + (t_3 + (1.0d0 / (sqrt(t) + sqrt((1.0d0 + 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 tmp;
if (t_3 <= 0.9) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((1.0 / (Math.sqrt(z) + t_2)) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))));
} else {
tmp = (t_1 - Math.sqrt(x)) + (1.0 + (t_3 + (1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + 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) tmp = 0 if t_3 <= 0.9: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((1.0 / (math.sqrt(z) + t_2)) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) else: tmp = (t_1 - math.sqrt(x)) + (1.0 + (t_3 + (1.0 / (math.sqrt(t) + math.sqrt((1.0 + 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)) tmp = 0.0 if (t_3 <= 0.9) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(1.0 / Float64(sqrt(z) + t_2)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 + Float64(t_3 + Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + 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);
tmp = 0.0;
if (t_3 <= 0.9)
tmp = (1.0 / (sqrt(x) + t_1)) + ((1.0 / (sqrt(z) + t_2)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))));
else
tmp = (t_1 - sqrt(x)) + (1.0 + (t_3 + (1.0 / (sqrt(t) + sqrt((1.0 + 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]}, If[LessEqual[t$95$3, 0.9], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := t_2 - \sqrt{z}\\
\mathbf{if}\;t_3 \leq 0.9:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1} + \left(\frac{1}{\sqrt{z} + t_2} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \sqrt{x}\right) + \left(1 + \left(t_3 + \frac{1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.900000000000000022Initial program 90.7%
associate-+l+90.7%
associate-+l+90.8%
+-commutative90.8%
+-commutative90.8%
+-commutative90.8%
Simplified90.8%
flip--91.1%
add-sqr-sqrt74.8%
add-sqr-sqrt91.5%
Applied egg-rr91.5%
+-commutative91.5%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
+-commutative92.4%
Simplified92.4%
flip--92.6%
add-sqr-sqrt79.0%
add-sqr-sqrt92.7%
Applied egg-rr92.7%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in t around inf 26.3%
+-commutative26.3%
+-commutative26.3%
associate-+r-46.9%
+-commutative46.9%
+-commutative46.9%
Simplified46.9%
flip--47.0%
add-sqr-sqrt28.4%
add-sqr-sqrt47.5%
Applied egg-rr47.5%
associate--l+49.0%
+-inverses49.0%
metadata-eval49.0%
+-commutative49.0%
+-commutative49.0%
Simplified49.0%
if 0.900000000000000022 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--97.2%
add-sqr-sqrt77.1%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate--l+97.6%
+-inverses97.6%
metadata-eval97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in y around 0 58.1%
Final simplification53.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (+ (+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 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 (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (((1.0 / (sqrt(z) + sqrt((1.0 + 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 = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (((1.0d0 / (sqrt(z) + sqrt((1.0d0 + 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 (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + 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 (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (((1.0 / (math.sqrt(z) + math.sqrt((1.0 + 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(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + 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 = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (((1.0 / (sqrt(z) + sqrt((1.0 + 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[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $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]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)
\end{array}
Initial program 93.9%
associate-+l+93.9%
associate-+l+93.9%
+-commutative93.9%
+-commutative93.9%
+-commutative93.9%
Simplified93.9%
flip--94.1%
add-sqr-sqrt75.4%
add-sqr-sqrt94.7%
Applied egg-rr94.7%
+-commutative94.7%
associate--l+95.2%
+-inverses95.2%
metadata-eval95.2%
+-commutative95.2%
+-commutative95.2%
Simplified95.2%
flip--95.7%
add-sqr-sqrt78.7%
add-sqr-sqrt95.9%
Applied egg-rr95.9%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
Simplified97.3%
flip--53.6%
add-sqr-sqrt44.4%
add-sqr-sqrt53.8%
Applied egg-rr97.7%
associate--l+54.6%
+-inverses54.6%
metadata-eval54.6%
+-commutative54.6%
+-commutative54.6%
Simplified98.6%
Final simplification98.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= z 5.5e+18)
(+
(- t_1 (sqrt x))
(+
1.0
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))
(+ (/ 1.0 (+ (sqrt x) t_1)) (/ 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 t_1 = sqrt((1.0 + x));
double tmp;
if (z <= 5.5e+18) {
tmp = (t_1 - sqrt(x)) + (1.0 + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt(t) + sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (z <= 5.5d+18) then
tmp = (t_1 - sqrt(x)) + (1.0d0 + ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt(t) + sqrt((1.0d0 + t))))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + (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 t_1 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 5.5e+18) {
tmp = (t_1 - Math.sqrt(x)) + (1.0 + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (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): t_1 = math.sqrt((1.0 + x)) tmp = 0 if z <= 5.5e+18: tmp = (t_1 - math.sqrt(x)) + (1.0 + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + (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) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 5.5e+18) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t))))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + 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)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 5.5e+18)
tmp = (t_1 - sqrt(x)) + (1.0 + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt(t) + sqrt((1.0 + t))))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + (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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5.5e+18], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $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])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 5.5 \cdot 10^{+18}:\\
\;\;\;\;\left(t_1 - \sqrt{x}\right) + \left(1 + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\end{array}
\end{array}
if z < 5.5e18Initial program 96.1%
associate-+l+96.1%
associate-+l+96.1%
+-commutative96.1%
+-commutative96.1%
+-commutative96.1%
Simplified96.1%
flip--96.3%
add-sqr-sqrt76.2%
add-sqr-sqrt96.3%
Applied egg-rr96.3%
associate--l+96.7%
+-inverses96.7%
metadata-eval96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in y around 0 57.2%
if 5.5e18 < z Initial program 91.3%
associate-+l+91.3%
associate-+l+91.3%
+-commutative91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
flip--91.7%
add-sqr-sqrt75.3%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
+-commutative92.2%
associate--l+93.1%
+-inverses93.1%
metadata-eval93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
flip--93.3%
add-sqr-sqrt80.5%
add-sqr-sqrt93.4%
Applied egg-rr93.4%
associate--l+96.2%
+-inverses96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in t around inf 24.1%
+-commutative24.1%
+-commutative24.1%
associate-+r-46.3%
+-commutative46.3%
+-commutative46.3%
Simplified46.3%
Taylor expanded in z around inf 46.3%
+-commutative46.3%
Simplified46.3%
Final simplification52.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)) (sqrt z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= z 3.5e-8)
(+ (- t_2 (sqrt x)) (+ 1.0 (+ t_1 (/ 1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))
(+
(/ 1.0 (+ (sqrt x) t_2))
(+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + x));
double tmp;
if (z <= 3.5e-8) {
tmp = (t_2 - sqrt(x)) + (1.0 + (t_1 + (1.0 / (sqrt(t) + sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (sqrt(x) + t_2)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + x))
if (z <= 3.5d-8) then
tmp = (t_2 - sqrt(x)) + (1.0d0 + (t_1 + (1.0d0 / (sqrt(t) + sqrt((1.0d0 + t))))))
else
tmp = (1.0d0 / (sqrt(x) + t_2)) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 3.5e-8) {
tmp = (t_2 - Math.sqrt(x)) + (1.0 + (t_1 + (1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + x)) tmp = 0 if z <= 3.5e-8: tmp = (t_2 - math.sqrt(x)) + (1.0 + (t_1 + (1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) else: tmp = (1.0 / (math.sqrt(x) + t_2)) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 3.5e-8) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 + Float64(t_1 + Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t))))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 3.5e-8)
tmp = (t_2 - sqrt(x)) + (1.0 + (t_1 + (1.0 / (sqrt(t) + sqrt((1.0 + t))))));
else
tmp = (1.0 / (sqrt(x) + t_2)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3.5e-8], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 3.5 \cdot 10^{-8}:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(1 + \left(t_1 + \frac{1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_2} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + t_1\right)\\
\end{array}
\end{array}
if z < 3.50000000000000024e-8Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
+-commutative97.0%
Simplified97.0%
flip--97.1%
add-sqr-sqrt77.7%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate--l+97.6%
+-inverses97.6%
metadata-eval97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in y around 0 57.8%
if 3.50000000000000024e-8 < z Initial program 90.8%
associate-+l+90.8%
associate-+l+90.8%
+-commutative90.8%
+-commutative90.8%
+-commutative90.8%
Simplified90.8%
flip--91.2%
add-sqr-sqrt74.2%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
+-commutative91.6%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
+-commutative92.4%
Simplified92.4%
flip--92.6%
add-sqr-sqrt79.2%
add-sqr-sqrt92.7%
Applied egg-rr92.7%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in t around inf 26.9%
+-commutative26.9%
+-commutative26.9%
associate-+r-47.3%
+-commutative47.3%
+-commutative47.3%
Simplified47.3%
Final simplification52.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= t 4e+16)
(-
(+ 1.0 (+ (sqrt (+ 1.0 t)) (+ t_2 t_1)))
(+ (sqrt t) (+ (sqrt z) (sqrt y))))
(+ (sqrt (+ 1.0 x)) (+ (- t_2 (sqrt y)) (- (- t_1 (sqrt z)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + y));
double tmp;
if (t <= 4e+16) {
tmp = (1.0 + (sqrt((1.0 + t)) + (t_2 + t_1))) - (sqrt(t) + (sqrt(z) + sqrt(y)));
} else {
tmp = sqrt((1.0 + x)) + ((t_2 - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
if (t <= 4d+16) then
tmp = (1.0d0 + (sqrt((1.0d0 + t)) + (t_2 + t_1))) - (sqrt(t) + (sqrt(z) + sqrt(y)))
else
tmp = sqrt((1.0d0 + x)) + ((t_2 - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (t <= 4e+16) {
tmp = (1.0 + (Math.sqrt((1.0 + t)) + (t_2 + t_1))) - (Math.sqrt(t) + (Math.sqrt(z) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((1.0 + x)) + ((t_2 - Math.sqrt(y)) + ((t_1 - Math.sqrt(z)) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if t <= 4e+16: tmp = (1.0 + (math.sqrt((1.0 + t)) + (t_2 + t_1))) - (math.sqrt(t) + (math.sqrt(z) + math.sqrt(y))) else: tmp = math.sqrt((1.0 + x)) + ((t_2 - math.sqrt(y)) + ((t_1 - math.sqrt(z)) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (t <= 4e+16) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(t_2 + t_1))) - Float64(sqrt(t) + Float64(sqrt(z) + sqrt(y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(t_2 - sqrt(y)) + Float64(Float64(t_1 - sqrt(z)) - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (t <= 4e+16)
tmp = (1.0 + (sqrt((1.0 + t)) + (t_2 + t_1))) - (sqrt(t) + (sqrt(z) + sqrt(y)));
else
tmp = sqrt((1.0 + x)) + ((t_2 - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 4e+16], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;t \leq 4 \cdot 10^{+16}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + t} + \left(t_2 + t_1\right)\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(t_2 - \sqrt{y}\right) + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if t < 4e16Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
associate-+r-75.4%
associate-+l-47.8%
+-commutative47.8%
+-commutative47.8%
associate--l+47.8%
Simplified47.2%
Taylor expanded in x around 0 18.6%
if 4e16 < t Initial program 90.7%
associate-+l+90.7%
+-commutative90.7%
associate-+r-71.4%
associate-+l-57.7%
+-commutative57.7%
+-commutative57.7%
associate--l+57.7%
Simplified21.0%
Taylor expanded in t around inf 55.2%
associate--l+57.7%
+-commutative57.7%
Simplified57.7%
Final simplification36.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 z))))
(if (<= t 4e+16)
(+ 1.0 (+ (sqrt (+ 1.0 t)) (- (+ 1.0 t_1) (+ (sqrt z) (sqrt t)))))
(+
(sqrt (+ 1.0 x))
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- (- t_1 (sqrt z)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 4e+16) {
tmp = 1.0 + (sqrt((1.0 + t)) + ((1.0 + t_1) - (sqrt(z) + sqrt(t))));
} else {
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 4d+16) then
tmp = 1.0d0 + (sqrt((1.0d0 + t)) + ((1.0d0 + t_1) - (sqrt(z) + sqrt(t))))
else
tmp = sqrt((1.0d0 + x)) + ((sqrt((1.0d0 + y)) - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 4e+16) {
tmp = 1.0 + (Math.sqrt((1.0 + t)) + ((1.0 + t_1) - (Math.sqrt(z) + Math.sqrt(t))));
} else {
tmp = Math.sqrt((1.0 + x)) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + ((t_1 - Math.sqrt(z)) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 4e+16: tmp = 1.0 + (math.sqrt((1.0 + t)) + ((1.0 + t_1) - (math.sqrt(z) + math.sqrt(t)))) else: tmp = math.sqrt((1.0 + x)) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + ((t_1 - math.sqrt(z)) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 4e+16) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(Float64(1.0 + t_1) - Float64(sqrt(z) + sqrt(t))))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(Float64(t_1 - sqrt(z)) - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 4e+16)
tmp = 1.0 + (sqrt((1.0 + t)) + ((1.0 + t_1) - (sqrt(z) + sqrt(t))));
else
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 4e+16], N[(1.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 4 \cdot 10^{+16}:\\
\;\;\;\;1 + \left(\sqrt{1 + t} + \left(\left(1 + t_1\right) - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if t < 4e16Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
associate-+r-75.4%
associate-+l-47.8%
+-commutative47.8%
+-commutative47.8%
associate--l+47.8%
Simplified47.2%
Taylor expanded in x around 0 18.6%
associate--l+40.2%
associate--l+54.5%
+-commutative54.5%
+-commutative54.5%
+-commutative54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in y around 0 45.4%
if 4e16 < t Initial program 90.7%
associate-+l+90.7%
+-commutative90.7%
associate-+r-71.4%
associate-+l-57.7%
+-commutative57.7%
+-commutative57.7%
associate--l+57.7%
Simplified21.0%
Taylor expanded in t around inf 55.2%
associate--l+57.7%
+-commutative57.7%
Simplified57.7%
Final simplification51.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= t 4e+16)
(+ 1.0 (+ (sqrt (+ 1.0 t)) (- (+ 1.0 t_1) (+ (sqrt z) (sqrt t)))))
(+ 1.0 (+ (/ 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 tmp;
if (t <= 4e+16) {
tmp = 1.0 + (sqrt((1.0 + t)) + ((1.0 + t_1) - (sqrt(z) + sqrt(t))));
} else {
tmp = 1.0 + ((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) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 4d+16) then
tmp = 1.0d0 + (sqrt((1.0d0 + t)) + ((1.0d0 + t_1) - (sqrt(z) + sqrt(t))))
else
tmp = 1.0d0 + ((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 tmp;
if (t <= 4e+16) {
tmp = 1.0 + (Math.sqrt((1.0 + t)) + ((1.0 + t_1) - (Math.sqrt(z) + Math.sqrt(t))));
} else {
tmp = 1.0 + ((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)) tmp = 0 if t <= 4e+16: tmp = 1.0 + (math.sqrt((1.0 + t)) + ((1.0 + t_1) - (math.sqrt(z) + math.sqrt(t)))) else: tmp = 1.0 + ((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)) tmp = 0.0 if (t <= 4e+16) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(Float64(1.0 + t_1) - Float64(sqrt(z) + sqrt(t))))); else tmp = Float64(1.0 + Float64(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));
tmp = 0.0;
if (t <= 4e+16)
tmp = 1.0 + (sqrt((1.0 + t)) + ((1.0 + t_1) - (sqrt(z) + sqrt(t))));
else
tmp = 1.0 + ((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]}, If[LessEqual[t, 4e+16], N[(1.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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 4 \cdot 10^{+16}:\\
\;\;\;\;1 + \left(\sqrt{1 + t} + \left(\left(1 + t_1\right) - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(t_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 4e16Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
associate-+r-75.4%
associate-+l-47.8%
+-commutative47.8%
+-commutative47.8%
associate--l+47.8%
Simplified47.2%
Taylor expanded in x around 0 18.6%
associate--l+40.2%
associate--l+54.5%
+-commutative54.5%
+-commutative54.5%
+-commutative54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in y around 0 45.4%
if 4e16 < t Initial program 90.7%
associate-+l+90.7%
associate-+l+90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
flip--91.0%
add-sqr-sqrt77.4%
add-sqr-sqrt91.9%
Applied egg-rr91.9%
+-commutative91.9%
associate--l+92.9%
+-inverses92.9%
metadata-eval92.9%
+-commutative92.9%
+-commutative92.9%
Simplified92.9%
flip--93.1%
add-sqr-sqrt76.6%
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 76.3%
+-commutative76.3%
+-commutative76.3%
associate-+r-95.8%
+-commutative95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in x around 0 36.4%
associate--l+57.9%
+-commutative57.9%
+-commutative57.9%
associate-+r-57.6%
+-commutative57.6%
+-commutative57.6%
Simplified57.6%
Final simplification51.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 6.2e-22)
(- 2.0 (- (sqrt z) (sqrt (+ 1.0 z))))
(if (<= y 5e+20)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt x) 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));
double tmp;
if (y <= 6.2e-22) {
tmp = 2.0 - (sqrt(z) - sqrt((1.0 + z)));
} else if (y <= 5e+20) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + 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))
if (y <= 6.2d-22) then
tmp = 2.0d0 - (sqrt(z) - sqrt((1.0d0 + z)))
else if (y <= 5d+20) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + 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));
double tmp;
if (y <= 6.2e-22) {
tmp = 2.0 - (Math.sqrt(z) - Math.sqrt((1.0 + z)));
} else if (y <= 5e+20) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + 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)) tmp = 0 if y <= 6.2e-22: tmp = 2.0 - (math.sqrt(z) - math.sqrt((1.0 + z))) elif y <= 5e+20: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 6.2e-22) tmp = Float64(2.0 - Float64(sqrt(z) - sqrt(Float64(1.0 + z)))); elseif (y <= 5e+20) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + 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));
tmp = 0.0;
if (y <= 6.2e-22)
tmp = 2.0 - (sqrt(z) - sqrt((1.0 + z)));
elseif (y <= 5e+20)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + 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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6.2e-22], N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+20], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 6.2 \cdot 10^{-22}:\\
\;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+20}:\\
\;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\end{array}
\end{array}
if y < 6.20000000000000025e-22Initial program 97.8%
associate-+l+97.8%
+-commutative97.8%
associate-+r-59.3%
associate-+l-53.2%
+-commutative53.2%
+-commutative53.2%
associate--l+53.2%
Simplified36.4%
Taylor expanded in t around inf 26.0%
+-commutative26.0%
+-commutative26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in y around 0 22.3%
associate--r+21.9%
associate--l+25.4%
+-commutative25.4%
Simplified25.4%
Taylor expanded in x around 0 32.4%
associate--l+59.4%
Simplified59.4%
if 6.20000000000000025e-22 < y < 5e20Initial program 82.8%
associate-+l+82.8%
+-commutative82.8%
associate-+r-60.3%
associate-+l-48.8%
+-commutative48.8%
+-commutative48.8%
associate--l+48.8%
Simplified39.0%
Taylor expanded in t around inf 16.2%
+-commutative16.2%
+-commutative16.2%
+-commutative16.2%
Simplified16.2%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
if 5e20 < y Initial program 91.7%
associate-+l+91.7%
+-commutative91.7%
associate-+r-91.7%
associate-+l-52.0%
+-commutative52.0%
+-commutative52.0%
associate--l+52.0%
Simplified33.5%
Taylor expanded in t around inf 22.3%
+-commutative22.3%
+-commutative22.3%
+-commutative22.3%
Simplified22.3%
Taylor expanded in z around inf 21.6%
+-commutative21.6%
Simplified21.6%
Taylor expanded in y around inf 21.2%
flip--21.2%
add-sqr-sqrt21.3%
add-sqr-sqrt21.7%
Applied egg-rr21.7%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
+-commutative23.8%
Simplified23.8%
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
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 2.9e-24)
(+ 1.0 (+ t_2 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (sqrt y)))))
(if (<= y 1e+21)
(+ t_1 (- t_2 (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt x) 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));
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 2.9e-24) {
tmp = 1.0 + (t_2 + (sqrt((1.0 + z)) - (sqrt(z) + sqrt(y))));
} else if (y <= 1e+21) {
tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (y <= 2.9d-24) then
tmp = 1.0d0 + (t_2 + (sqrt((1.0d0 + z)) - (sqrt(z) + sqrt(y))))
else if (y <= 1d+21) then
tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + 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));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 2.9e-24) {
tmp = 1.0 + (t_2 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + Math.sqrt(y))));
} else if (y <= 1e+21) {
tmp = t_1 + (t_2 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + 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)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if y <= 2.9e-24: tmp = 1.0 + (t_2 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + math.sqrt(y)))) elif y <= 1e+21: tmp = t_1 + (t_2 - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 2.9e-24) tmp = Float64(1.0 + Float64(t_2 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + sqrt(y))))); elseif (y <= 1e+21) tmp = Float64(t_1 + Float64(t_2 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + 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));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 2.9e-24)
tmp = 1.0 + (t_2 + (sqrt((1.0 + z)) - (sqrt(z) + sqrt(y))));
elseif (y <= 1e+21)
tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + 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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.9e-24], N[(1.0 + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+21], N[(t$95$1 + N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 2.9 \cdot 10^{-24}:\\
\;\;\;\;1 + \left(t_2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 10^{+21}:\\
\;\;\;\;t_1 + \left(t_2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\end{array}
\end{array}
if y < 2.8999999999999999e-24Initial program 97.8%
associate-+l+97.8%
associate-+l+97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--98.2%
add-sqr-sqrt78.7%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
+-commutative98.5%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
+-commutative98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in t around inf 39.9%
Taylor expanded in x around 0 32.4%
associate-+r+32.4%
associate--l+59.4%
associate-+r+59.4%
+-commutative59.4%
Simplified59.4%
if 2.8999999999999999e-24 < y < 1e21Initial program 82.8%
associate-+l+82.8%
+-commutative82.8%
associate-+r-60.3%
associate-+l-48.8%
+-commutative48.8%
+-commutative48.8%
associate--l+48.8%
Simplified39.0%
Taylor expanded in t around inf 16.2%
+-commutative16.2%
+-commutative16.2%
+-commutative16.2%
Simplified16.2%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
if 1e21 < y Initial program 91.7%
associate-+l+91.7%
+-commutative91.7%
associate-+r-91.7%
associate-+l-52.0%
+-commutative52.0%
+-commutative52.0%
associate--l+52.0%
Simplified33.5%
Taylor expanded in t around inf 22.3%
+-commutative22.3%
+-commutative22.3%
+-commutative22.3%
Simplified22.3%
Taylor expanded in z around inf 21.6%
+-commutative21.6%
Simplified21.6%
Taylor expanded in y around inf 21.2%
flip--21.2%
add-sqr-sqrt21.3%
add-sqr-sqrt21.7%
Applied egg-rr21.7%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
+-commutative23.8%
Simplified23.8%
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 (<= y 1.1e-22)
(- 2.0 (- (sqrt z) (sqrt (+ 1.0 z))))
(if (<= y 8.5e+20)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.1e-22) {
tmp = 2.0 - (sqrt(z) - sqrt((1.0 + z)));
} else if (y <= 8.5e+20) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.1d-22) then
tmp = 2.0d0 - (sqrt(z) - sqrt((1.0d0 + z)))
else if (y <= 8.5d+20) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.1e-22) {
tmp = 2.0 - (Math.sqrt(z) - Math.sqrt((1.0 + z)));
} else if (y <= 8.5e+20) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.1e-22: tmp = 2.0 - (math.sqrt(z) - math.sqrt((1.0 + z))) elif y <= 8.5e+20: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.1e-22) tmp = Float64(2.0 - Float64(sqrt(z) - sqrt(Float64(1.0 + z)))); elseif (y <= 8.5e+20) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.1e-22)
tmp = 2.0 - (sqrt(z) - sqrt((1.0 + z)));
elseif (y <= 8.5e+20)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.1e-22], N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e+20], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-22}:\\
\;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+20}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 1.1e-22Initial program 97.8%
associate-+l+97.8%
+-commutative97.8%
associate-+r-59.3%
associate-+l-53.2%
+-commutative53.2%
+-commutative53.2%
associate--l+53.2%
Simplified36.4%
Taylor expanded in t around inf 26.0%
+-commutative26.0%
+-commutative26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in y around 0 22.3%
associate--r+21.9%
associate--l+25.4%
+-commutative25.4%
Simplified25.4%
Taylor expanded in x around 0 32.4%
associate--l+59.4%
Simplified59.4%
if 1.1e-22 < y < 8.5e20Initial program 82.8%
associate-+l+82.8%
+-commutative82.8%
associate-+r-60.3%
associate-+l-48.8%
+-commutative48.8%
+-commutative48.8%
associate--l+48.8%
Simplified39.0%
Taylor expanded in t around inf 16.2%
+-commutative16.2%
+-commutative16.2%
+-commutative16.2%
Simplified16.2%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in x around 0 32.4%
associate--l+32.3%
Simplified32.3%
if 8.5e20 < y Initial program 91.7%
associate-+l+91.7%
+-commutative91.7%
associate-+r-91.7%
associate-+l-52.0%
+-commutative52.0%
+-commutative52.0%
associate--l+52.0%
Simplified33.5%
Taylor expanded in t around inf 22.3%
+-commutative22.3%
+-commutative22.3%
+-commutative22.3%
Simplified22.3%
Taylor expanded in z around inf 21.6%
+-commutative21.6%
Simplified21.6%
Taylor expanded in y around inf 21.2%
flip--21.2%
add-sqr-sqrt21.3%
add-sqr-sqrt21.7%
Applied egg-rr21.7%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
+-commutative23.8%
Simplified23.8%
Final simplification41.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 5.5e+18) (- 2.0 (- (sqrt z) (sqrt (+ 1.0 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 <= 5.5e+18) {
tmp = 2.0 - (sqrt(z) - sqrt((1.0 + 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 <= 5.5d+18) then
tmp = 2.0d0 - (sqrt(z) - sqrt((1.0d0 + 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 <= 5.5e+18) {
tmp = 2.0 - (Math.sqrt(z) - Math.sqrt((1.0 + 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 <= 5.5e+18: tmp = 2.0 - (math.sqrt(z) - math.sqrt((1.0 + 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 <= 5.5e+18) tmp = Float64(2.0 - Float64(sqrt(z) - sqrt(Float64(1.0 + 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 <= 5.5e+18)
tmp = 2.0 - (sqrt(z) - sqrt((1.0 + 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, 5.5e+18], N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + 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 5.5 \cdot 10^{+18}:\\
\;\;\;\;2 - \left(\sqrt{z} - \sqrt{1 + z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 5.5e18Initial program 96.1%
associate-+l+96.1%
+-commutative96.1%
associate-+r-79.6%
associate-+l-56.2%
+-commutative56.2%
+-commutative56.2%
associate--l+56.2%
Simplified35.5%
Taylor expanded in t around inf 26.0%
+-commutative26.0%
+-commutative26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in y around 0 34.9%
associate--r+34.4%
associate--l+48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in x around 0 46.7%
associate--l+46.7%
Simplified46.7%
if 5.5e18 < z Initial program 91.3%
associate-+l+91.3%
+-commutative91.3%
associate-+r-66.5%
associate-+l-47.7%
+-commutative47.7%
+-commutative47.7%
associate--l+47.7%
Simplified35.2%
Taylor expanded in t around inf 20.7%
+-commutative20.7%
+-commutative20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in z around inf 29.2%
+-commutative29.2%
Simplified29.2%
Taylor expanded in x around 0 35.3%
associate--l+62.1%
Simplified62.1%
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 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.9%
associate-+l+93.9%
+-commutative93.9%
associate-+r-73.6%
associate-+l-52.3%
+-commutative52.3%
+-commutative52.3%
associate--l+52.3%
Simplified35.4%
Taylor expanded in t around inf 23.6%
+-commutative23.6%
+-commutative23.6%
+-commutative23.6%
Simplified23.6%
Taylor expanded in z around inf 20.3%
+-commutative20.3%
Simplified20.3%
Taylor expanded in x around 0 27.8%
associate--l+47.5%
Simplified47.5%
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 (- (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.9%
associate-+l+93.9%
+-commutative93.9%
associate-+r-73.6%
associate-+l-52.3%
+-commutative52.3%
+-commutative52.3%
associate--l+52.3%
Simplified35.4%
Taylor expanded in t around inf 23.6%
+-commutative23.6%
+-commutative23.6%
+-commutative23.6%
Simplified23.6%
Taylor expanded in z around inf 20.3%
+-commutative20.3%
Simplified20.3%
Taylor expanded in y around inf 15.3%
Final simplification15.3%
(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 2023293
(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))))