
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ z 1.0)) (sqrt z)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (sqrt (+ 1.0 y))))
(if (<= t_1 5e-6)
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (/ 1.0 (+ (sqrt x) t_2)) (/ 1.0 (+ (sqrt y) t_3))))
(+
(+ (- t_3 (sqrt y)) (- t_2 (sqrt x)))
(+ t_1 (/ 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((z + 1.0)) - sqrt(z);
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((1.0 + y));
double tmp;
if (t_1 <= 5e-6) {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + t_2)) + (1.0 / (sqrt(y) + t_3)));
} else {
tmp = ((t_3 - sqrt(y)) + (t_2 - sqrt(x))) + (t_1 + (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) :: tmp
t_1 = sqrt((z + 1.0d0)) - sqrt(z)
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((1.0d0 + y))
if (t_1 <= 5d-6) then
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 / (sqrt(x) + t_2)) + (1.0d0 / (sqrt(y) + t_3)))
else
tmp = ((t_3 - sqrt(y)) + (t_2 - sqrt(x))) + (t_1 + (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((z + 1.0)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (t_1 <= 5e-6) {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 / (Math.sqrt(x) + t_2)) + (1.0 / (Math.sqrt(y) + t_3)));
} else {
tmp = ((t_3 - Math.sqrt(y)) + (t_2 - Math.sqrt(x))) + (t_1 + (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((z + 1.0)) - math.sqrt(z) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + y)) tmp = 0 if t_1 <= 5e-6: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 / (math.sqrt(x) + t_2)) + (1.0 / (math.sqrt(y) + t_3))) else: tmp = ((t_3 - math.sqrt(y)) + (t_2 - math.sqrt(x))) + (t_1 + (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 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + x)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (t_1 <= 5e-6) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(1.0 / Float64(sqrt(y) + t_3)))); else tmp = Float64(Float64(Float64(t_3 - sqrt(y)) + Float64(t_2 - sqrt(x))) + Float64(t_1 + 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((z + 1.0)) - sqrt(z);
t_2 = sqrt((1.0 + x));
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if (t_1 <= 5e-6)
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + t_2)) + (1.0 / (sqrt(y) + t_3)));
else
tmp = ((t_3 - sqrt(y)) + (t_2 - sqrt(x))) + (t_1 + (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[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 5e-6], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + 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{z + 1} - \sqrt{z}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\frac{1}{\sqrt{x} + t\_2} + \frac{1}{\sqrt{y} + t\_3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_3 - \sqrt{y}\right) + \left(t\_2 - \sqrt{x}\right)\right) + \left(t\_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) < 5.00000000000000041e-6Initial program 85.2%
associate-+l+85.2%
+-commutative85.2%
+-commutative85.2%
+-commutative85.2%
Simplified85.2%
flip--85.3%
add-sqr-sqrt66.1%
add-sqr-sqrt86.0%
Applied egg-rr86.0%
associate--l+88.5%
+-inverses88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
flip--88.7%
add-sqr-sqrt67.6%
+-commutative67.6%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
Taylor expanded in t around inf 51.9%
Taylor expanded in z around inf 56.9%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.1%
associate-+l+96.1%
+-commutative96.1%
+-commutative96.1%
+-commutative96.1%
Simplified96.1%
flip--96.3%
add-sqr-sqrt72.3%
add-sqr-sqrt96.6%
Applied egg-rr96.6%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
Final simplification74.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 (+ z 1.0)) (sqrt z)))
(t_2 (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))))
(if (<= t_1 0.0001)
(+ (* 0.5 (sqrt (/ 1.0 z))) (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_2))
(+ (+ 1.0 (- t_2 (sqrt x))) (+ t_1 (- (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((z + 1.0)) - sqrt(z);
double t_2 = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
double tmp;
if (t_1 <= 0.0001) {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_2);
} else {
tmp = (1.0 + (t_2 - sqrt(x))) + (t_1 + (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) :: tmp
t_1 = sqrt((z + 1.0d0)) - sqrt(z)
t_2 = 1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))
if (t_1 <= 0.0001d0) then
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + t_2)
else
tmp = (1.0d0 + (t_2 - sqrt(x))) + (t_1 + (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((z + 1.0)) - Math.sqrt(z);
double t_2 = 1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)));
double tmp;
if (t_1 <= 0.0001) {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_2);
} else {
tmp = (1.0 + (t_2 - Math.sqrt(x))) + (t_1 + (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((z + 1.0)) - math.sqrt(z) t_2 = 1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))) tmp = 0 if t_1 <= 0.0001: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_2) else: tmp = (1.0 + (t_2 - math.sqrt(x))) + (t_1 + (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 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) tmp = 0.0 if (t_1 <= 0.0001) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + t_2)); else tmp = Float64(Float64(1.0 + Float64(t_2 - sqrt(x))) + Float64(t_1 + 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((z + 1.0)) - sqrt(z);
t_2 = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
tmp = 0.0;
if (t_1 <= 0.0001)
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + t_2);
else
tmp = (1.0 + (t_2 - sqrt(x))) + (t_1 + (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[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0001], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + 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])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1} - \sqrt{z}\\
t_2 := \frac{1}{\sqrt{y} + \sqrt{1 + y}}\\
\mathbf{if}\;t\_1 \leq 0.0001:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(t\_2 - \sqrt{x}\right)\right) + \left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) < 1.00000000000000005e-4Initial program 85.0%
associate-+l+85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
flip--85.1%
add-sqr-sqrt65.7%
add-sqr-sqrt85.8%
Applied egg-rr85.8%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
flip--88.5%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
Taylor expanded in t around inf 51.9%
Taylor expanded in z around inf 56.9%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z)) Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
flip--96.8%
add-sqr-sqrt78.8%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in x around 0 52.4%
associate--l+52.4%
Simplified52.4%
Final simplification55.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 15500000.0)
(+
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 (- t_1 (+ (sqrt x) (sqrt y)))))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ (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 + y));
double tmp;
if (z <= 15500000.0) {
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (t_1 - (sqrt(x) + sqrt(y))));
} else {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 15500000.0d0) then
tmp = ((sqrt((z + 1.0d0)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (t_1 - (sqrt(x) + sqrt(y))))
else
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (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 + y));
double tmp;
if (z <= 15500000.0) {
tmp = ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (t_1 - (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (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 + y)) tmp = 0 if z <= 15500000.0: tmp = ((math.sqrt((z + 1.0)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (t_1 - (math.sqrt(x) + math.sqrt(y)))) else: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt(y) + 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 + y)) tmp = 0.0 if (z <= 15500000.0) tmp = Float64(Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(t_1 - Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(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 + y));
tmp = 0.0;
if (z <= 15500000.0)
tmp = ((sqrt((z + 1.0)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (t_1 - (sqrt(x) + sqrt(y))));
else
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 15500000.0], N[(N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 15500000:\\
\;\;\;\;\left(\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + t\_1}\right)\\
\end{array}
\end{array}
if z < 1.55e7Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 36.0%
associate--l+51.7%
Simplified51.7%
if 1.55e7 < z Initial program 85.0%
associate-+l+85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
flip--85.1%
add-sqr-sqrt65.7%
add-sqr-sqrt85.8%
Applied egg-rr85.8%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
flip--88.5%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
Taylor expanded in t around inf 51.9%
Taylor expanded in z around inf 56.9%
Final simplification54.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 59000000.0)
(+
t_1
(-
(+ (sqrt (+ z 1.0)) (- (- 1.0 (sqrt x)) (sqrt z)))
(+ (sqrt y) (* -0.5 (sqrt (/ 1.0 t))))))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ (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 + y));
double tmp;
if (z <= 59000000.0) {
tmp = t_1 + ((sqrt((z + 1.0)) + ((1.0 - sqrt(x)) - sqrt(z))) - (sqrt(y) + (-0.5 * sqrt((1.0 / t)))));
} else {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 59000000.0d0) then
tmp = t_1 + ((sqrt((z + 1.0d0)) + ((1.0d0 - sqrt(x)) - sqrt(z))) - (sqrt(y) + ((-0.5d0) * sqrt((1.0d0 / t)))))
else
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (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 + y));
double tmp;
if (z <= 59000000.0) {
tmp = t_1 + ((Math.sqrt((z + 1.0)) + ((1.0 - Math.sqrt(x)) - Math.sqrt(z))) - (Math.sqrt(y) + (-0.5 * Math.sqrt((1.0 / t)))));
} else {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (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 + y)) tmp = 0 if z <= 59000000.0: tmp = t_1 + ((math.sqrt((z + 1.0)) + ((1.0 - math.sqrt(x)) - math.sqrt(z))) - (math.sqrt(y) + (-0.5 * math.sqrt((1.0 / t))))) else: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt(y) + 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 + y)) tmp = 0.0 if (z <= 59000000.0) tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(z + 1.0)) + Float64(Float64(1.0 - sqrt(x)) - sqrt(z))) - Float64(sqrt(y) + Float64(-0.5 * sqrt(Float64(1.0 / t)))))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(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 + y));
tmp = 0.0;
if (z <= 59000000.0)
tmp = t_1 + ((sqrt((z + 1.0)) + ((1.0 - sqrt(x)) - sqrt(z))) - (sqrt(y) + (-0.5 * sqrt((1.0 / t)))));
else
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 59000000.0], N[(t$95$1 + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 59000000:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{z + 1} + \left(\left(1 - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + -0.5 \cdot \sqrt{\frac{1}{t}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + t\_1}\right)\\
\end{array}
\end{array}
if z < 5.9e7Initial program 96.5%
+-commutative96.5%
associate-+r+96.5%
associate-+r-76.2%
associate-+l-69.3%
associate-+r-55.4%
Simplified55.4%
Taylor expanded in t around inf 33.7%
Taylor expanded in x around 0 20.7%
if 5.9e7 < z Initial program 85.0%
associate-+l+85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
flip--85.1%
add-sqr-sqrt65.7%
add-sqr-sqrt85.8%
Applied egg-rr85.8%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
flip--88.5%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
Taylor expanded in t around inf 51.9%
Taylor expanded in z around inf 56.9%
Final simplification41.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 11800000.0)
(-
(+ (+ t_1 t_2) (/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0)))))
(+ (sqrt x) (sqrt y)))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (/ 1.0 (+ (sqrt x) t_1)) (/ 1.0 (+ (sqrt y) t_2)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 11800000.0) {
tmp = ((t_1 + t_2) + (1.0 / (sqrt(z) + sqrt((z + 1.0))))) - (sqrt(x) + sqrt(y));
} else {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (sqrt(y) + t_2)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (z <= 11800000.0d0) then
tmp = ((t_1 + t_2) + (1.0d0 / (sqrt(z) + sqrt((z + 1.0d0))))) - (sqrt(x) + sqrt(y))
else
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 / (sqrt(x) + t_1)) + (1.0d0 / (sqrt(y) + t_2)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 11800000.0) {
tmp = ((t_1 + t_2) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0))))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 / (Math.sqrt(x) + t_1)) + (1.0 / (Math.sqrt(y) + t_2)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 11800000.0: tmp = ((t_1 + t_2) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 / (math.sqrt(x) + t_1)) + (1.0 / (math.sqrt(y) + t_2))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 11800000.0) tmp = Float64(Float64(Float64(t_1 + t_2) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 1.0))))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(1.0 / Float64(sqrt(y) + t_2)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 11800000.0)
tmp = ((t_1 + t_2) + (1.0 / (sqrt(z) + sqrt((z + 1.0))))) - (sqrt(x) + sqrt(y));
else
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + t_1)) + (1.0 / (sqrt(y) + t_2)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 11800000.0], N[(N[(N[(t$95$1 + t$95$2), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $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 + y}\\
\mathbf{if}\;z \leq 11800000:\\
\;\;\;\;\left(\left(t\_1 + t\_2\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\frac{1}{\sqrt{x} + t\_1} + \frac{1}{\sqrt{y} + t\_2}\right)\\
\end{array}
\end{array}
if z < 1.18e7Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
flip--96.6%
add-sqr-sqrt96.5%
add-sqr-sqrt96.5%
Applied egg-rr96.5%
associate--l+96.5%
+-inverses96.5%
metadata-eval96.5%
Simplified96.5%
Taylor expanded in t around inf 23.8%
associate-+r+23.8%
+-commutative23.8%
Simplified23.8%
if 1.18e7 < z Initial program 85.0%
associate-+l+85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
flip--85.1%
add-sqr-sqrt65.7%
add-sqr-sqrt85.8%
Applied egg-rr85.8%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
flip--88.5%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
Taylor expanded in t around inf 51.9%
Taylor expanded in z around inf 56.9%
Final simplification42.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))))
(if (<= z 40000000.0)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (+ t_1 (/ 1.0 (+ 1.0 (sqrt x)))))
(+
(* 0.5 (sqrt (/ 1.0 z)))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
double tmp;
if (z <= 40000000.0) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + (t_1 + (1.0 / (1.0 + sqrt(x))));
} else {
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + 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 = 1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))
if (z <= 40000000.0d0) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + (t_1 + (1.0d0 / (1.0d0 + sqrt(x))))
else
tmp = (0.5d0 * sqrt((1.0d0 / z))) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + 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 = 1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)));
double tmp;
if (z <= 40000000.0) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (t_1 + (1.0 / (1.0 + Math.sqrt(x))));
} else {
tmp = (0.5 * Math.sqrt((1.0 / z))) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))) tmp = 0 if z <= 40000000.0: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + (t_1 + (1.0 / (1.0 + math.sqrt(x)))) else: tmp = (0.5 * math.sqrt((1.0 / z))) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) tmp = 0.0 if (z <= 40000000.0) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(t_1 + Float64(1.0 / Float64(1.0 + sqrt(x))))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
tmp = 0.0;
if (z <= 40000000.0)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + (t_1 + (1.0 / (1.0 + sqrt(x))));
else
tmp = (0.5 * sqrt((1.0 / z))) + ((1.0 / (sqrt(x) + sqrt((1.0 + 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[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 40000000.0], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(1.0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $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 := \frac{1}{\sqrt{y} + \sqrt{1 + y}}\\
\mathbf{if}\;z \leq 40000000:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(t\_1 + \frac{1}{1 + \sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{z}} + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_1\right)\\
\end{array}
\end{array}
if z < 4e7Initial program 96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
flip--96.8%
add-sqr-sqrt78.8%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
+-commutative97.5%
Simplified97.5%
flip--97.4%
add-sqr-sqrt80.0%
+-commutative80.0%
add-sqr-sqrt97.8%
+-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in t around inf 59.5%
Taylor expanded in x around 0 58.3%
if 4e7 < z Initial program 85.0%
associate-+l+85.0%
+-commutative85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
flip--85.1%
add-sqr-sqrt65.7%
add-sqr-sqrt85.8%
Applied egg-rr85.8%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
flip--88.5%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
Taylor expanded in t around inf 51.9%
Taylor expanded in z around inf 56.9%
Final simplification57.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 (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 y))))))
(if (<= z 2e+19)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) (+ t_1 (/ 1.0 (+ 1.0 (sqrt x)))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) t_1))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
double tmp;
if (z <= 2e+19) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + (t_1 + (1.0 / (1.0 + sqrt(x))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + 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 = 1.0d0 / (sqrt(y) + sqrt((1.0d0 + y)))
if (z <= 2d+19) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + (t_1 + (1.0d0 / (1.0d0 + sqrt(x))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + 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 = 1.0 / (Math.sqrt(y) + Math.sqrt((1.0 + y)));
double tmp;
if (z <= 2e+19) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + (t_1 + (1.0 / (1.0 + Math.sqrt(x))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt(y) + math.sqrt((1.0 + y))) tmp = 0 if z <= 2e+19: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + (t_1 + (1.0 / (1.0 + math.sqrt(x)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + y)))) tmp = 0.0 if (z <= 2e+19) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + Float64(t_1 + Float64(1.0 / Float64(1.0 + sqrt(x))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + 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 = 1.0 / (sqrt(y) + sqrt((1.0 + y)));
tmp = 0.0;
if (z <= 2e+19)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + (t_1 + (1.0 / (1.0 + sqrt(x))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + 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[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2e+19], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(1.0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{y} + \sqrt{1 + y}}\\
\mathbf{if}\;z \leq 2 \cdot 10^{+19}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + \left(t\_1 + \frac{1}{1 + \sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + t\_1\\
\end{array}
\end{array}
if z < 2e19Initial program 94.2%
associate-+l+94.2%
+-commutative94.2%
+-commutative94.2%
+-commutative94.2%
Simplified94.2%
flip--94.5%
add-sqr-sqrt76.7%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
associate--l+95.1%
+-inverses95.1%
metadata-eval95.1%
+-commutative95.1%
Simplified95.1%
flip--95.1%
add-sqr-sqrt78.1%
+-commutative78.1%
add-sqr-sqrt95.5%
+-commutative95.5%
Applied egg-rr95.5%
Taylor expanded in t around inf 58.5%
Taylor expanded in x around 0 57.5%
if 2e19 < z Initial program 86.2%
associate-+l+86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.3%
add-sqr-sqrt66.6%
add-sqr-sqrt87.1%
Applied egg-rr87.1%
associate--l+89.7%
+-inverses89.7%
metadata-eval89.7%
+-commutative89.7%
Simplified89.7%
flip--89.9%
add-sqr-sqrt68.2%
+-commutative68.2%
add-sqr-sqrt90.5%
+-commutative90.5%
Applied egg-rr90.5%
Taylor expanded in t around inf 52.2%
Taylor expanded in z around inf 53.0%
+-commutative53.0%
+-commutative53.0%
Simplified53.0%
Final simplification55.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 y))))
(if (<= z 1.6e+19)
(- (+ (sqrt (+ z 1.0)) (+ 1.0 t_1)) (+ (sqrt x) (+ (sqrt z) (sqrt y))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ (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 + y));
double tmp;
if (z <= 1.6e+19) {
tmp = (sqrt((z + 1.0)) + (1.0 + t_1)) - (sqrt(x) + (sqrt(z) + sqrt(y)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.6d+19) then
tmp = (sqrt((z + 1.0d0)) + (1.0d0 + t_1)) - (sqrt(x) + (sqrt(z) + sqrt(y)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (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 + y));
double tmp;
if (z <= 1.6e+19) {
tmp = (Math.sqrt((z + 1.0)) + (1.0 + t_1)) - (Math.sqrt(x) + (Math.sqrt(z) + Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (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 + y)) tmp = 0 if z <= 1.6e+19: tmp = (math.sqrt((z + 1.0)) + (1.0 + t_1)) - (math.sqrt(x) + (math.sqrt(z) + math.sqrt(y))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt(y) + 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 + y)) tmp = 0.0 if (z <= 1.6e+19) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) + Float64(1.0 + t_1)) - Float64(sqrt(x) + Float64(sqrt(z) + sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(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 + y));
tmp = 0.0;
if (z <= 1.6e+19)
tmp = (sqrt((z + 1.0)) + (1.0 + t_1)) - (sqrt(x) + (sqrt(z) + sqrt(y)));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.6e+19], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $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 1.6 \cdot 10^{+19}:\\
\;\;\;\;\left(\sqrt{z + 1} + \left(1 + t\_1\right)\right) - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + t\_1}\\
\end{array}
\end{array}
if z < 1.6e19Initial program 94.2%
+-commutative94.2%
associate-+r+94.2%
associate-+r-75.2%
associate-+l-68.8%
associate-+r-55.6%
Simplified55.6%
Taylor expanded in t around inf 23.5%
Taylor expanded in x around 0 20.3%
associate-+r+20.3%
Simplified20.3%
if 1.6e19 < z Initial program 86.2%
associate-+l+86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.3%
add-sqr-sqrt66.6%
add-sqr-sqrt87.1%
Applied egg-rr87.1%
associate--l+89.7%
+-inverses89.7%
metadata-eval89.7%
+-commutative89.7%
Simplified89.7%
flip--89.9%
add-sqr-sqrt68.2%
+-commutative68.2%
add-sqr-sqrt90.5%
+-commutative90.5%
Applied egg-rr90.5%
Taylor expanded in t around inf 52.2%
Taylor expanded in z around inf 53.0%
+-commutative53.0%
+-commutative53.0%
Simplified53.0%
Final simplification37.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.6e+19)
(+ 1.0 (- (+ t_1 (sqrt (+ z 1.0))) (+ (sqrt z) (+ (sqrt x) (sqrt y)))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ (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 + y));
double tmp;
if (z <= 1.6e+19) {
tmp = 1.0 + ((t_1 + sqrt((z + 1.0))) - (sqrt(z) + (sqrt(x) + sqrt(y))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.6d+19) then
tmp = 1.0d0 + ((t_1 + sqrt((z + 1.0d0))) - (sqrt(z) + (sqrt(x) + sqrt(y))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (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 + y));
double tmp;
if (z <= 1.6e+19) {
tmp = 1.0 + ((t_1 + Math.sqrt((z + 1.0))) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (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 + y)) tmp = 0 if z <= 1.6e+19: tmp = 1.0 + ((t_1 + math.sqrt((z + 1.0))) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt(y) + 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 + y)) tmp = 0.0 if (z <= 1.6e+19) tmp = Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(z + 1.0))) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(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 + y));
tmp = 0.0;
if (z <= 1.6e+19)
tmp = 1.0 + ((t_1 + sqrt((z + 1.0))) - (sqrt(z) + (sqrt(x) + sqrt(y))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.6e+19], N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $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 1.6 \cdot 10^{+19}:\\
\;\;\;\;1 + \left(\left(t\_1 + \sqrt{z + 1}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{y} + t\_1}\\
\end{array}
\end{array}
if z < 1.6e19Initial program 94.2%
+-commutative94.2%
associate-+r+94.2%
associate-+r-75.2%
associate-+l-68.8%
associate-+r-55.6%
Simplified55.6%
Taylor expanded in t around inf 23.5%
Taylor expanded in x around 0 20.3%
associate--l+26.4%
+-commutative26.4%
associate-+r+26.4%
+-commutative26.4%
Simplified26.4%
if 1.6e19 < z Initial program 86.2%
associate-+l+86.2%
+-commutative86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
flip--86.3%
add-sqr-sqrt66.6%
add-sqr-sqrt87.1%
Applied egg-rr87.1%
associate--l+89.7%
+-inverses89.7%
metadata-eval89.7%
+-commutative89.7%
Simplified89.7%
flip--89.9%
add-sqr-sqrt68.2%
+-commutative68.2%
add-sqr-sqrt90.5%
+-commutative90.5%
Applied egg-rr90.5%
Taylor expanded in t around inf 52.2%
Taylor expanded in z around inf 53.0%
+-commutative53.0%
+-commutative53.0%
Simplified53.0%
Final simplification40.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 90000000000000.0) (+ 1.0 (- (+ (sqrt (+ 1.0 y)) (* 0.5 x)) (+ (sqrt x) (sqrt y)))) (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (- (sqrt (+ z 1.0)) (sqrt z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 90000000000000.0) {
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * x)) - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (sqrt((z + 1.0)) - sqrt(z));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 90000000000000.0d0) then
tmp = 1.0d0 + ((sqrt((1.0d0 + y)) + (0.5d0 * x)) - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (sqrt((z + 1.0d0)) - sqrt(z))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 90000000000000.0) {
tmp = 1.0 + ((Math.sqrt((1.0 + y)) + (0.5 * x)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 90000000000000.0: tmp = 1.0 + ((math.sqrt((1.0 + y)) + (0.5 * x)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (math.sqrt((z + 1.0)) - math.sqrt(z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 90000000000000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * x)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 90000000000000.0)
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * x)) - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (sqrt((z + 1.0)) - sqrt(z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 90000000000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90000000000000:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot x\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \left(\sqrt{z + 1} - \sqrt{z}\right)\\
\end{array}
\end{array}
if y < 9e13Initial program 94.5%
+-commutative94.5%
associate-+r+94.5%
associate-+r-94.5%
associate-+l-94.5%
associate-+r-94.5%
Simplified73.6%
Taylor expanded in t around inf 19.9%
Taylor expanded in z around inf 21.4%
Taylor expanded in x around 0 21.2%
associate--l+21.2%
*-commutative21.2%
Simplified21.2%
if 9e13 < y Initial program 84.8%
associate-+l+84.8%
+-commutative84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
flip--84.8%
add-sqr-sqrt45.2%
add-sqr-sqrt85.1%
Applied egg-rr85.1%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
flip--88.2%
add-sqr-sqrt70.4%
+-commutative70.4%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
Taylor expanded in t around inf 52.4%
Taylor expanded in y around inf 50.1%
Final simplification34.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 x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ (sqrt y) (sqrt (+ 1.0 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(y) + sqrt((1.0 + 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(y) + sqrt((1.0d0 + 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(y) + Math.sqrt((1.0 + 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(y) + math.sqrt((1.0 + 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(1.0 / Float64(sqrt(y) + sqrt(Float64(1.0 + 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(y) + sqrt((1.0 + 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[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(1.0 + 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}} + \frac{1}{\sqrt{y} + \sqrt{1 + y}}
\end{array}
Initial program 89.9%
associate-+l+89.9%
+-commutative89.9%
+-commutative89.9%
+-commutative89.9%
Simplified89.9%
flip--90.1%
add-sqr-sqrt71.3%
add-sqr-sqrt90.8%
Applied egg-rr90.8%
associate--l+92.2%
+-inverses92.2%
metadata-eval92.2%
+-commutative92.2%
Simplified92.2%
flip--92.3%
add-sqr-sqrt72.9%
+-commutative72.9%
add-sqr-sqrt92.8%
+-commutative92.8%
Applied egg-rr92.8%
Taylor expanded in t around inf 55.1%
Taylor expanded in z around inf 36.7%
+-commutative36.7%
+-commutative36.7%
Simplified36.7%
Final simplification36.7%
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 50000000.0) (+ 1.0 (- (+ (sqrt (+ 1.0 y)) (* 0.5 x)) (+ (sqrt x) (sqrt y)))) (+ (sqrt (+ 1.0 x)) (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 50000000.0) {
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * x)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((1.0 + x)) + ((0.5 * sqrt((1.0 / y))) - 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 <= 50000000.0d0) then
tmp = 1.0d0 + ((sqrt((1.0d0 + y)) + (0.5d0 * x)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((1.0d0 + x)) + ((0.5d0 * sqrt((1.0d0 / y))) - 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 <= 50000000.0) {
tmp = 1.0 + ((Math.sqrt((1.0 + y)) + (0.5 * x)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((1.0 + x)) + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 50000000.0: tmp = 1.0 + ((math.sqrt((1.0 + y)) + (0.5 * x)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((1.0 + x)) + ((0.5 * math.sqrt((1.0 / y))) - 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 <= 50000000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(0.5 * x)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - 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 <= 50000000.0)
tmp = 1.0 + ((sqrt((1.0 + y)) + (0.5 * x)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((1.0 + x)) + ((0.5 * sqrt((1.0 / y))) - 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, 50000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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 50000000:\\
\;\;\;\;1 + \left(\left(\sqrt{1 + y} + 0.5 \cdot x\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 5e7Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r-95.2%
associate-+l-95.2%
associate-+r-95.1%
Simplified74.1%
Taylor expanded in t around inf 20.3%
Taylor expanded in z around inf 21.8%
Taylor expanded in x around 0 21.5%
associate--l+21.5%
*-commutative21.5%
Simplified21.5%
if 5e7 < y Initial program 84.4%
+-commutative84.4%
associate-+r+84.4%
associate-+r-42.5%
associate-+l-23.1%
associate-+r-10.5%
Simplified8.9%
Taylor expanded in t around inf 4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 27.7%
associate--l+27.7%
Simplified27.7%
Final simplification24.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 44000000.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))) (+ (sqrt (+ 1.0 x)) (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 44000000.0) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((1.0 + x)) + ((0.5 * sqrt((1.0 / y))) - 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 <= 44000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((1.0d0 + x)) + ((0.5d0 * sqrt((1.0d0 / y))) - 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 <= 44000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((1.0 + x)) + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 44000000.0: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((1.0 + x)) + ((0.5 * math.sqrt((1.0 / y))) - 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 <= 44000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - 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 <= 44000000.0)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((1.0 + x)) + ((0.5 * sqrt((1.0 / y))) - 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, 44000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $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 44000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 4.4e7Initial program 95.2%
+-commutative95.2%
associate-+r+95.2%
associate-+r-95.2%
associate-+l-95.2%
associate-+r-95.1%
Simplified74.1%
Taylor expanded in t around inf 20.3%
Taylor expanded in z around inf 21.8%
Taylor expanded in x around 0 19.3%
associate--l+19.4%
Simplified19.4%
if 4.4e7 < y Initial program 84.4%
+-commutative84.4%
associate-+r+84.4%
associate-+r-42.5%
associate-+l-23.1%
associate-+r-10.5%
Simplified8.9%
Taylor expanded in t around inf 4.7%
Taylor expanded in z around inf 5.4%
Taylor expanded in y around inf 27.7%
associate--l+27.7%
Simplified27.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 2.05e+15) (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))) (- (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 <= 2.05e+15) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.05d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.05e+15: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.05e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.05e+15)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.05e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.05 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.05e15Initial program 94.5%
+-commutative94.5%
associate-+r+94.5%
associate-+r-94.5%
associate-+l-94.5%
associate-+r-94.5%
Simplified73.6%
Taylor expanded in t around inf 19.9%
Taylor expanded in z around inf 21.4%
Taylor expanded in x around 0 19.1%
associate--l+19.1%
Simplified19.1%
if 2.05e15 < y Initial program 84.8%
+-commutative84.8%
associate-+r+84.8%
associate-+r-41.5%
associate-+l-21.5%
associate-+r-8.4%
Simplified7.2%
Taylor expanded in t around inf 4.7%
Taylor expanded in z around inf 5.2%
Taylor expanded in y around inf 27.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.3)
(- (+ 2.0 (* y (+ 0.5 (* y (- (* y 0.0625) 0.125))))) (+ (sqrt x) (sqrt y)))
(if (<= y 3.1e+29)
(+ 1.0 (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))
(- (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.3) {
tmp = (2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (sqrt(x) + sqrt(y));
} else if (y <= 3.1e+29) {
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.3d0) then
tmp = (2.0d0 + (y * (0.5d0 + (y * ((y * 0.0625d0) - 0.125d0))))) - (sqrt(x) + sqrt(y))
else if (y <= 3.1d+29) then
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / y))) - sqrt(x))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3) {
tmp = (2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (Math.sqrt(x) + Math.sqrt(y));
} else if (y <= 3.1e+29) {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.3: tmp = (2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (math.sqrt(x) + math.sqrt(y)) elif y <= 3.1e+29: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / y))) - math.sqrt(x)) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.3) tmp = Float64(Float64(2.0 + Float64(y * Float64(0.5 + Float64(y * Float64(Float64(y * 0.0625) - 0.125))))) - Float64(sqrt(x) + sqrt(y))); elseif (y <= 3.1e+29) tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - sqrt(x))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.3)
tmp = (2.0 + (y * (0.5 + (y * ((y * 0.0625) - 0.125))))) - (sqrt(x) + sqrt(y));
elseif (y <= 3.1e+29)
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.3], N[(N[(2.0 + N[(y * N[(0.5 + N[(y * N[(N[(y * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+29], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3:\\
\;\;\;\;\left(2 + y \cdot \left(0.5 + y \cdot \left(y \cdot 0.0625 - 0.125\right)\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+29}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.30000000000000004Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.8%
if 1.30000000000000004 < y < 3.0999999999999999e29Initial program 73.2%
+-commutative73.2%
associate-+r+73.2%
associate-+r-71.4%
associate-+l-71.4%
associate-+r-71.1%
Simplified57.6%
Taylor expanded in t around inf 22.3%
Taylor expanded in z around inf 22.6%
Taylor expanded in x around 0 21.8%
Taylor expanded in y around inf 24.7%
associate--l+24.7%
Simplified24.7%
if 3.0999999999999999e29 < y Initial program 85.8%
+-commutative85.8%
associate-+r+85.8%
associate-+r-40.4%
associate-+l-19.4%
associate-+r-5.7%
Simplified5.7%
Taylor expanded in t around inf 3.3%
Taylor expanded in z around inf 3.3%
Taylor expanded in y around inf 27.1%
Final simplification23.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.2)
(+ 2.0 (- (* y (+ 0.5 (* y -0.125))) (+ (sqrt x) (sqrt y))))
(if (<= y 7.5e+29)
(+ 1.0 (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))
(- (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.2) {
tmp = 2.0 + ((y * (0.5 + (y * -0.125))) - (sqrt(x) + sqrt(y)));
} else if (y <= 7.5e+29) {
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.2d0) then
tmp = 2.0d0 + ((y * (0.5d0 + (y * (-0.125d0)))) - (sqrt(x) + sqrt(y)))
else if (y <= 7.5d+29) then
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / y))) - sqrt(x))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.2) {
tmp = 2.0 + ((y * (0.5 + (y * -0.125))) - (Math.sqrt(x) + Math.sqrt(y)));
} else if (y <= 7.5e+29) {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.2: tmp = 2.0 + ((y * (0.5 + (y * -0.125))) - (math.sqrt(x) + math.sqrt(y))) elif y <= 7.5e+29: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / y))) - math.sqrt(x)) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.2) tmp = Float64(2.0 + Float64(Float64(y * Float64(0.5 + Float64(y * -0.125))) - Float64(sqrt(x) + sqrt(y)))); elseif (y <= 7.5e+29) tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - sqrt(x))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.2)
tmp = 2.0 + ((y * (0.5 + (y * -0.125))) - (sqrt(x) + sqrt(y)));
elseif (y <= 7.5e+29)
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.2], N[(2.0 + N[(N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+29], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2:\\
\;\;\;\;2 + \left(y \cdot \left(0.5 + y \cdot -0.125\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+29}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.19999999999999996Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.7%
associate--l+19.7%
*-commutative19.7%
Simplified19.7%
if 1.19999999999999996 < y < 7.49999999999999945e29Initial program 73.2%
+-commutative73.2%
associate-+r+73.2%
associate-+r-71.4%
associate-+l-71.4%
associate-+r-71.1%
Simplified57.6%
Taylor expanded in t around inf 22.3%
Taylor expanded in z around inf 22.6%
Taylor expanded in x around 0 21.8%
Taylor expanded in y around inf 24.7%
associate--l+24.7%
Simplified24.7%
if 7.49999999999999945e29 < y Initial program 85.8%
+-commutative85.8%
associate-+r+85.8%
associate-+r-40.4%
associate-+l-19.4%
associate-+r-5.7%
Simplified5.7%
Taylor expanded in t around inf 3.3%
Taylor expanded in z around inf 3.3%
Taylor expanded in y around inf 27.1%
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.0)
(- (+ 1.0 (+ 1.0 (* 0.5 y))) (+ (sqrt x) (sqrt y)))
(if (<= y 1.45e+30)
(+ 1.0 (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))
(- (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.0) {
tmp = (1.0 + (1.0 + (0.5 * y))) - (sqrt(x) + sqrt(y));
} else if (y <= 1.45e+30) {
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.0d0) then
tmp = (1.0d0 + (1.0d0 + (0.5d0 * y))) - (sqrt(x) + sqrt(y))
else if (y <= 1.45d+30) then
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / y))) - sqrt(x))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.0) {
tmp = (1.0 + (1.0 + (0.5 * y))) - (Math.sqrt(x) + Math.sqrt(y));
} else if (y <= 1.45e+30) {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.0: tmp = (1.0 + (1.0 + (0.5 * y))) - (math.sqrt(x) + math.sqrt(y)) elif y <= 1.45e+30: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / y))) - math.sqrt(x)) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.0) tmp = Float64(Float64(1.0 + Float64(1.0 + Float64(0.5 * y))) - Float64(sqrt(x) + sqrt(y))); elseif (y <= 1.45e+30) tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - sqrt(x))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.0)
tmp = (1.0 + (1.0 + (0.5 * y))) - (sqrt(x) + sqrt(y));
elseif (y <= 1.45e+30)
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.0], N[(N[(1.0 + N[(1.0 + N[(0.5 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+30], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\left(1 + \left(1 + 0.5 \cdot y\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+30}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.5%
*-commutative19.5%
Simplified19.5%
if 1 < y < 1.4499999999999999e30Initial program 73.2%
+-commutative73.2%
associate-+r+73.2%
associate-+r-71.4%
associate-+l-71.4%
associate-+r-71.1%
Simplified57.6%
Taylor expanded in t around inf 22.3%
Taylor expanded in z around inf 22.6%
Taylor expanded in x around 0 21.8%
Taylor expanded in y around inf 24.7%
associate--l+24.7%
Simplified24.7%
if 1.4499999999999999e30 < y Initial program 85.8%
+-commutative85.8%
associate-+r+85.8%
associate-+r-40.4%
associate-+l-19.4%
associate-+r-5.7%
Simplified5.7%
Taylor expanded in t around inf 3.3%
Taylor expanded in z around inf 3.3%
Taylor expanded in y around inf 27.1%
Final simplification23.2%
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.0)
(- (+ 2.0 (* 0.5 y)) (+ (sqrt x) (sqrt y)))
(if (<= y 1.8e+30)
(+ 1.0 (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))
(- (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.0) {
tmp = (2.0 + (0.5 * y)) - (sqrt(x) + sqrt(y));
} else if (y <= 1.8e+30) {
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.0d0) then
tmp = (2.0d0 + (0.5d0 * y)) - (sqrt(x) + sqrt(y))
else if (y <= 1.8d+30) then
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / y))) - sqrt(x))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.0) {
tmp = (2.0 + (0.5 * y)) - (Math.sqrt(x) + Math.sqrt(y));
} else if (y <= 1.8e+30) {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.0: tmp = (2.0 + (0.5 * y)) - (math.sqrt(x) + math.sqrt(y)) elif y <= 1.8e+30: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / y))) - math.sqrt(x)) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.0) tmp = Float64(Float64(2.0 + Float64(0.5 * y)) - Float64(sqrt(x) + sqrt(y))); elseif (y <= 1.8e+30) tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - sqrt(x))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.0)
tmp = (2.0 + (0.5 * y)) - (sqrt(x) + sqrt(y));
elseif (y <= 1.8e+30)
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.0], N[(N[(2.0 + N[(0.5 * y), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+30], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\left(2 + 0.5 \cdot y\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+30}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.5%
*-commutative19.5%
Simplified19.5%
if 1 < y < 1.8000000000000001e30Initial program 73.2%
+-commutative73.2%
associate-+r+73.2%
associate-+r-71.4%
associate-+l-71.4%
associate-+r-71.1%
Simplified57.6%
Taylor expanded in t around inf 22.3%
Taylor expanded in z around inf 22.6%
Taylor expanded in x around 0 21.8%
Taylor expanded in y around inf 24.7%
associate--l+24.7%
Simplified24.7%
if 1.8000000000000001e30 < y Initial program 85.8%
+-commutative85.8%
associate-+r+85.8%
associate-+r-40.4%
associate-+l-19.4%
associate-+r-5.7%
Simplified5.7%
Taylor expanded in t around inf 3.3%
Taylor expanded in z around inf 3.3%
Taylor expanded in y around inf 27.1%
Final simplification23.2%
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 0.08)
(- 2.0 (+ (sqrt x) (sqrt y)))
(if (<= y 1.15e+30)
(+ 1.0 (- (* 0.5 (sqrt (/ 1.0 y))) (sqrt x)))
(- (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 <= 0.08) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else if (y <= 1.15e+30) {
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.08d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else if (y <= 1.15d+30) then
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / y))) - sqrt(x))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.08) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else if (y <= 1.15e+30) {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / y))) - Math.sqrt(x));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.08: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) elif y <= 1.15e+30: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / y))) - math.sqrt(x)) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.08) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); elseif (y <= 1.15e+30) tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - sqrt(x))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.08)
tmp = 2.0 - (sqrt(x) + sqrt(y));
elseif (y <= 1.15e+30)
tmp = 1.0 + ((0.5 * sqrt((1.0 / y))) - sqrt(x));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.08], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e+30], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.08:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+30}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 0.0800000000000000017Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.2%
if 0.0800000000000000017 < y < 1.15e30Initial program 73.2%
+-commutative73.2%
associate-+r+73.2%
associate-+r-71.4%
associate-+l-71.4%
associate-+r-71.1%
Simplified57.6%
Taylor expanded in t around inf 22.3%
Taylor expanded in z around inf 22.6%
Taylor expanded in x around 0 21.8%
Taylor expanded in y around inf 24.7%
associate--l+24.7%
Simplified24.7%
if 1.15e30 < y Initial program 85.8%
+-commutative85.8%
associate-+r+85.8%
associate-+r-40.4%
associate-+l-19.4%
associate-+r-5.7%
Simplified5.7%
Taylor expanded in t around inf 3.3%
Taylor expanded in z around inf 3.3%
Taylor expanded in y around inf 27.1%
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 0.96) (- 2.0 (+ (sqrt x) (sqrt y))) (- (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 <= 0.96) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((1.0 + x)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.96d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = sqrt((1.0d0 + x)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.96) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.96: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.96) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.96)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = sqrt((1.0 + x)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.96], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.96:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 0.95999999999999996Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.2%
if 0.95999999999999996 < y Initial program 84.4%
+-commutative84.4%
associate-+r+84.4%
associate-+r-44.0%
associate-+l-25.4%
associate-+r-13.2%
Simplified11.7%
Taylor expanded in t around inf 5.5%
Taylor expanded in z around inf 5.5%
Taylor expanded in y around inf 26.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.0) (- 2.0 (+ (sqrt x) (sqrt y))) (- 1.0 (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.0) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.0d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.0) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.0: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.0) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.0)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = 1.0 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.0], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{x}\\
\end{array}
\end{array}
if y < 1Initial program 95.7%
+-commutative95.7%
associate-+r+95.7%
associate-+r-95.7%
associate-+l-95.7%
associate-+r-95.7%
Simplified73.8%
Taylor expanded in t around inf 20.1%
Taylor expanded in z around inf 22.3%
Taylor expanded in x around 0 19.8%
Taylor expanded in y around 0 19.2%
if 1 < y Initial program 84.4%
+-commutative84.4%
associate-+r+84.4%
associate-+r-44.0%
associate-+l-25.4%
associate-+r-13.2%
Simplified11.7%
Taylor expanded in t around inf 5.5%
Taylor expanded in z around inf 5.5%
Taylor expanded in x around 0 4.9%
Taylor expanded in y around inf 24.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 x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 89.9%
+-commutative89.9%
associate-+r+89.9%
associate-+r-69.4%
associate-+l-60.0%
associate-+r-53.8%
Simplified42.2%
Taylor expanded in t around inf 12.7%
Taylor expanded in z around inf 13.8%
Taylor expanded in x around 0 12.2%
Taylor expanded in y around inf 17.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -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[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 89.9%
+-commutative89.9%
associate-+r+89.9%
associate-+r-69.4%
associate-+l-60.0%
associate-+r-53.8%
Simplified42.2%
Taylor expanded in t around inf 12.7%
Taylor expanded in z around inf 13.8%
Taylor expanded in x around 0 12.2%
Taylor expanded in x around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
(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 2024130
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (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))))