
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 1.7e+30)
(+
t_2
(-
(+ (sqrt (+ z 1.0)) (- (- t_1 (sqrt x)) (sqrt z)))
(+ (sqrt y) (/ -1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))
(+ (/ 1.0 (+ (sqrt x) t_1)) (/ 1.0 (+ t_2 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = t_2 + ((sqrt((z + 1.0)) + ((t_1 - sqrt(x)) - sqrt(z))) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + (1.0 / (t_2 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (z <= 1.7d+30) then
tmp = t_2 + ((sqrt((z + 1.0d0)) + ((t_1 - sqrt(x)) - sqrt(z))) - (sqrt(y) + ((-1.0d0) / (sqrt(t) + sqrt((1.0d0 + t))))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + (1.0d0 / (t_2 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = t_2 + ((Math.sqrt((z + 1.0)) + ((t_1 - Math.sqrt(x)) - Math.sqrt(z))) - (Math.sqrt(y) + (-1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (1.0 / (t_2 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 1.7e+30: tmp = t_2 + ((math.sqrt((z + 1.0)) + ((t_1 - math.sqrt(x)) - math.sqrt(z))) - (math.sqrt(y) + (-1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + (1.0 / (t_2 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 1.7e+30) tmp = Float64(t_2 + Float64(Float64(sqrt(Float64(z + 1.0)) + Float64(Float64(t_1 - sqrt(x)) - sqrt(z))) - Float64(sqrt(y) + Float64(-1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t))))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(1.0 / Float64(t_2 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 1.7e+30)
tmp = t_2 + ((sqrt((z + 1.0)) + ((t_1 - sqrt(x)) - sqrt(z))) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + (1.0 / (t_2 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.7e+30], N[(t$95$2 + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 1.7 \cdot 10^{+30}:\\
\;\;\;\;t\_2 + \left(\left(\sqrt{z + 1} + \left(\left(t\_1 - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \frac{1}{t\_2 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 1.7000000000000001e30Initial program 94.7%
+-commutative94.7%
associate-+r+94.7%
associate-+r-79.9%
associate-+l-72.7%
associate-+r-57.3%
Simplified57.1%
flip--57.1%
add-sqr-sqrt49.3%
add-sqr-sqrt57.3%
+-commutative57.3%
+-commutative57.3%
Applied egg-rr57.3%
associate--r+57.5%
+-inverses57.5%
metadata-eval57.5%
+-commutative57.5%
Simplified57.5%
if 1.7000000000000001e30 < z Initial program 87.7%
associate-+l+87.7%
associate-+l+87.7%
+-commutative87.7%
+-commutative87.7%
associate-+l-87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--88.1%
add-sqr-sqrt69.8%
+-commutative69.8%
add-sqr-sqrt88.8%
+-commutative88.8%
Applied egg-rr88.8%
associate--l+90.3%
+-inverses90.3%
metadata-eval90.3%
Simplified90.3%
flip--90.4%
add-sqr-sqrt72.0%
add-sqr-sqrt90.4%
Applied egg-rr90.4%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in z around inf 92.5%
Taylor expanded in t around inf 58.4%
Final simplification57.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.7e+30)
(+
t_1
(-
(- (+ 1.0 (sqrt (+ z 1.0))) (sqrt z))
(+ (sqrt y) (/ -1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = t_1 + (((1.0 + sqrt((z + 1.0))) - sqrt(z)) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.7d+30) then
tmp = t_1 + (((1.0d0 + sqrt((z + 1.0d0))) - sqrt(z)) - (sqrt(y) + ((-1.0d0) / (sqrt(t) + sqrt((1.0d0 + t))))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (t_1 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = t_1 + (((1.0 + Math.sqrt((z + 1.0))) - Math.sqrt(z)) - (Math.sqrt(y) + (-1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (t_1 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 1.7e+30: tmp = t_1 + (((1.0 + math.sqrt((z + 1.0))) - math.sqrt(z)) - (math.sqrt(y) + (-1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (t_1 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 1.7e+30) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 + sqrt(Float64(z + 1.0))) - sqrt(z)) - Float64(sqrt(y) + Float64(-1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t))))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(t_1 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 1.7e+30)
tmp = t_1 + (((1.0 + sqrt((z + 1.0))) - sqrt(z)) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.7e+30], N[(t$95$1 + N[(N[(N[(1.0 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 1.7 \cdot 10^{+30}:\\
\;\;\;\;t\_1 + \left(\left(\left(1 + \sqrt{z + 1}\right) - \sqrt{z}\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{t\_1 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 1.7000000000000001e30Initial program 94.7%
+-commutative94.7%
associate-+r+94.7%
associate-+r-79.9%
associate-+l-72.7%
associate-+r-57.3%
Simplified57.1%
Taylor expanded in x around 0 35.8%
flip--57.1%
add-sqr-sqrt49.3%
add-sqr-sqrt57.3%
+-commutative57.3%
+-commutative57.3%
Applied egg-rr35.8%
associate--r+57.5%
+-inverses57.5%
metadata-eval57.5%
+-commutative57.5%
Simplified35.8%
if 1.7000000000000001e30 < z Initial program 87.7%
associate-+l+87.7%
associate-+l+87.7%
+-commutative87.7%
+-commutative87.7%
associate-+l-87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--88.1%
add-sqr-sqrt69.8%
+-commutative69.8%
add-sqr-sqrt88.8%
+-commutative88.8%
Applied egg-rr88.8%
associate--l+90.3%
+-inverses90.3%
metadata-eval90.3%
Simplified90.3%
flip--90.4%
add-sqr-sqrt72.0%
add-sqr-sqrt90.4%
Applied egg-rr90.4%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in z around inf 92.5%
Taylor expanded in t around inf 58.4%
Final simplification46.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.7e+30)
(+
t_1
(+
(- (+ 1.0 (sqrt (+ z 1.0))) (sqrt z))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (sqrt y))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = t_1 + (((1.0 + sqrt((z + 1.0))) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.7d+30) then
tmp = t_1 + (((1.0d0 + sqrt((z + 1.0d0))) - sqrt(z)) + ((sqrt((1.0d0 + t)) - sqrt(t)) - sqrt(y)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (t_1 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = t_1 + (((1.0 + Math.sqrt((z + 1.0))) - Math.sqrt(z)) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (t_1 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 1.7e+30: tmp = t_1 + (((1.0 + math.sqrt((z + 1.0))) - math.sqrt(z)) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) - math.sqrt(y))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (t_1 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 1.7e+30) tmp = Float64(t_1 + Float64(Float64(Float64(1.0 + sqrt(Float64(z + 1.0))) - sqrt(z)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(t_1 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 1.7e+30)
tmp = t_1 + (((1.0 + sqrt((z + 1.0))) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y)));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.7e+30], N[(t$95$1 + N[(N[(N[(1.0 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $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[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 1.7 \cdot 10^{+30}:\\
\;\;\;\;t\_1 + \left(\left(\left(1 + \sqrt{z + 1}\right) - \sqrt{z}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{t\_1 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 1.7000000000000001e30Initial program 94.7%
+-commutative94.7%
associate-+r+94.7%
associate-+r-79.9%
associate-+l-72.7%
associate-+r-57.3%
Simplified57.1%
Taylor expanded in x around 0 35.8%
if 1.7000000000000001e30 < z Initial program 87.7%
associate-+l+87.7%
associate-+l+87.7%
+-commutative87.7%
+-commutative87.7%
associate-+l-87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--88.1%
add-sqr-sqrt69.8%
+-commutative69.8%
add-sqr-sqrt88.8%
+-commutative88.8%
Applied egg-rr88.8%
associate--l+90.3%
+-inverses90.3%
metadata-eval90.3%
Simplified90.3%
flip--90.4%
add-sqr-sqrt72.0%
add-sqr-sqrt90.4%
Applied egg-rr90.4%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in z around inf 92.5%
Taylor expanded in t around inf 58.4%
Final simplification46.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.7e+30)
(+
(+ t_1 (+ 1.0 (- (sqrt (+ z 1.0)) (sqrt z))))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (sqrt y)))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = (t_1 + (1.0 + (sqrt((z + 1.0)) - sqrt(z)))) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.7d+30) then
tmp = (t_1 + (1.0d0 + (sqrt((z + 1.0d0)) - sqrt(z)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) - sqrt(y))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (t_1 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 1.7e+30) {
tmp = (t_1 + (1.0 + (Math.sqrt((z + 1.0)) - Math.sqrt(z)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - Math.sqrt(y));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (t_1 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 1.7e+30: tmp = (t_1 + (1.0 + (math.sqrt((z + 1.0)) - math.sqrt(z)))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) - math.sqrt(y)) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (t_1 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 1.7e+30) tmp = Float64(Float64(t_1 + Float64(1.0 + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(t_1 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 1.7e+30)
tmp = (t_1 + (1.0 + (sqrt((z + 1.0)) - sqrt(z)))) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.7e+30], N[(N[(t$95$1 + N[(1.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $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[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 1.7 \cdot 10^{+30}:\\
\;\;\;\;\left(t\_1 + \left(1 + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{t\_1 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 1.7000000000000001e30Initial program 94.7%
+-commutative94.7%
associate-+r+94.7%
associate-+r-79.9%
associate-+l-72.7%
associate-+r-57.3%
Simplified57.1%
Taylor expanded in x around 0 35.8%
associate-+r-35.8%
associate--l+35.8%
Applied egg-rr35.8%
if 1.7000000000000001e30 < z Initial program 87.7%
associate-+l+87.7%
associate-+l+87.7%
+-commutative87.7%
+-commutative87.7%
associate-+l-87.7%
+-commutative87.7%
+-commutative87.7%
Simplified87.7%
flip--88.1%
add-sqr-sqrt69.8%
+-commutative69.8%
add-sqr-sqrt88.8%
+-commutative88.8%
Applied egg-rr88.8%
associate--l+90.3%
+-inverses90.3%
metadata-eval90.3%
Simplified90.3%
flip--90.4%
add-sqr-sqrt72.0%
add-sqr-sqrt90.4%
Applied egg-rr90.4%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in z around inf 92.5%
Taylor expanded in t around inf 58.4%
Final simplification46.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 9e-24)
(+ t_1 (- 2.0 (+ (sqrt y) (/ -1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))
(if (<= z 2.8e+14)
(+ t_1 (+ (sqrt (+ z 1.0)) (- 1.0 (+ (sqrt z) (sqrt y)))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (/ 1.0 (+ t_1 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 9e-24) {
tmp = t_1 + (2.0 - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
} else if (z <= 2.8e+14) {
tmp = t_1 + (sqrt((z + 1.0)) + (1.0 - (sqrt(z) + sqrt(y))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 9d-24) then
tmp = t_1 + (2.0d0 - (sqrt(y) + ((-1.0d0) / (sqrt(t) + sqrt((1.0d0 + t))))))
else if (z <= 2.8d+14) then
tmp = t_1 + (sqrt((z + 1.0d0)) + (1.0d0 - (sqrt(z) + sqrt(y))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (t_1 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 9e-24) {
tmp = t_1 + (2.0 - (Math.sqrt(y) + (-1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
} else if (z <= 2.8e+14) {
tmp = t_1 + (Math.sqrt((z + 1.0)) + (1.0 - (Math.sqrt(z) + Math.sqrt(y))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (t_1 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 9e-24: tmp = t_1 + (2.0 - (math.sqrt(y) + (-1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) elif z <= 2.8e+14: tmp = t_1 + (math.sqrt((z + 1.0)) + (1.0 - (math.sqrt(z) + math.sqrt(y)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (t_1 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 9e-24) tmp = Float64(t_1 + Float64(2.0 - Float64(sqrt(y) + Float64(-1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + t))))))); elseif (z <= 2.8e+14) tmp = Float64(t_1 + Float64(sqrt(Float64(z + 1.0)) + Float64(1.0 - Float64(sqrt(z) + sqrt(y))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(t_1 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 9e-24)
tmp = t_1 + (2.0 - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + t))))));
elseif (z <= 2.8e+14)
tmp = t_1 + (sqrt((z + 1.0)) + (1.0 - (sqrt(z) + sqrt(y))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (t_1 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 9e-24], N[(t$95$1 + N[(2.0 - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e+14], N[(t$95$1 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(N[Sqrt[z], $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[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 9 \cdot 10^{-24}:\\
\;\;\;\;t\_1 + \left(2 - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\right)\right)\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+14}:\\
\;\;\;\;t\_1 + \left(\sqrt{z + 1} + \left(1 - \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{t\_1 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 8.9999999999999995e-24Initial program 98.0%
+-commutative98.0%
associate-+r+98.0%
associate-+r-84.3%
associate-+l-75.5%
associate-+r-59.4%
Simplified59.4%
Taylor expanded in x around 0 38.0%
Taylor expanded in z around 0 38.0%
flip--59.4%
add-sqr-sqrt50.6%
add-sqr-sqrt59.4%
+-commutative59.4%
+-commutative59.4%
Applied egg-rr38.0%
associate--r+59.7%
+-inverses59.7%
metadata-eval59.7%
+-commutative59.7%
Simplified38.0%
if 8.9999999999999995e-24 < z < 2.8e14Initial program 86.4%
+-commutative86.4%
associate-+r+86.4%
associate-+r-63.6%
associate-+l-63.3%
associate-+r-44.2%
Simplified44.2%
Taylor expanded in x around 0 27.0%
Taylor expanded in t around inf 14.5%
+-commutative14.5%
associate--l+14.5%
+-commutative14.5%
Simplified14.5%
if 2.8e14 < z Initial program 86.5%
associate-+l+86.5%
associate-+l+86.5%
+-commutative86.5%
+-commutative86.5%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.9%
add-sqr-sqrt68.4%
+-commutative68.4%
add-sqr-sqrt87.4%
+-commutative87.4%
Applied egg-rr87.4%
associate--l+88.9%
+-inverses88.9%
metadata-eval88.9%
Simplified88.9%
flip--89.0%
add-sqr-sqrt71.8%
add-sqr-sqrt89.0%
Applied egg-rr89.0%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in z around inf 90.9%
Taylor expanded in t around inf 58.1%
Final simplification46.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 9e-24)
(+ t_1 (+ 2.0 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= z 3.8e+14)
(+ t_1 (+ (sqrt (+ z 1.0)) (- 1.0 (+ (sqrt z) (sqrt y)))))
(+ (sqrt (+ 1.0 x)) (- (- t_1 (sqrt y)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 9e-24) {
tmp = t_1 + (2.0 + (sqrt((1.0 + t)) - sqrt(t)));
} else if (z <= 3.8e+14) {
tmp = t_1 + (sqrt((z + 1.0)) + (1.0 - (sqrt(z) + sqrt(y))));
} else {
tmp = sqrt((1.0 + x)) + ((t_1 - sqrt(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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 9d-24) then
tmp = t_1 + (2.0d0 + (sqrt((1.0d0 + t)) - sqrt(t)))
else if (z <= 3.8d+14) then
tmp = t_1 + (sqrt((z + 1.0d0)) + (1.0d0 - (sqrt(z) + sqrt(y))))
else
tmp = sqrt((1.0d0 + x)) + ((t_1 - sqrt(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 t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 9e-24) {
tmp = t_1 + (2.0 + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else if (z <= 3.8e+14) {
tmp = t_1 + (Math.sqrt((z + 1.0)) + (1.0 - (Math.sqrt(z) + Math.sqrt(y))));
} else {
tmp = Math.sqrt((1.0 + x)) + ((t_1 - Math.sqrt(y)) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 9e-24: tmp = t_1 + (2.0 + (math.sqrt((1.0 + t)) - math.sqrt(t))) elif z <= 3.8e+14: tmp = t_1 + (math.sqrt((z + 1.0)) + (1.0 - (math.sqrt(z) + math.sqrt(y)))) else: tmp = math.sqrt((1.0 + x)) + ((t_1 - math.sqrt(y)) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 9e-24) tmp = Float64(t_1 + Float64(2.0 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); elseif (z <= 3.8e+14) tmp = Float64(t_1 + Float64(sqrt(Float64(z + 1.0)) + Float64(1.0 - Float64(sqrt(z) + sqrt(y))))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(t_1 - sqrt(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)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 9e-24)
tmp = t_1 + (2.0 + (sqrt((1.0 + t)) - sqrt(t)));
elseif (z <= 3.8e+14)
tmp = t_1 + (sqrt((z + 1.0)) + (1.0 - (sqrt(z) + sqrt(y))));
else
tmp = sqrt((1.0 + x)) + ((t_1 - sqrt(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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 9e-24], N[(t$95$1 + N[(2.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+14], N[(t$95$1 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 9 \cdot 10^{-24}:\\
\;\;\;\;t\_1 + \left(2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+14}:\\
\;\;\;\;t\_1 + \left(\sqrt{z + 1} + \left(1 - \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(t\_1 - \sqrt{y}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 8.9999999999999995e-24Initial program 98.0%
+-commutative98.0%
associate-+r+98.0%
associate-+r-84.3%
associate-+l-75.5%
associate-+r-59.4%
Simplified59.4%
Taylor expanded in x around 0 38.0%
Taylor expanded in z around 0 38.0%
Taylor expanded in y around 0 33.5%
if 8.9999999999999995e-24 < z < 3.8e14Initial program 86.4%
+-commutative86.4%
associate-+r+86.4%
associate-+r-63.6%
associate-+l-63.3%
associate-+r-44.2%
Simplified44.2%
Taylor expanded in x around 0 27.0%
Taylor expanded in t around inf 14.5%
+-commutative14.5%
associate--l+14.5%
+-commutative14.5%
Simplified14.5%
if 3.8e14 < z Initial program 86.5%
+-commutative86.5%
associate-+r+86.5%
associate-+r-70.8%
associate-+l-58.3%
associate-+r-58.3%
Simplified35.6%
Taylor expanded in t around inf 5.1%
associate--l+22.0%
associate--l+31.2%
+-commutative31.2%
associate-+r+31.2%
Simplified31.2%
Taylor expanded in z around inf 37.9%
+-commutative37.9%
Simplified37.9%
+-commutative37.9%
*-un-lft-identity37.9%
fma-define37.9%
Applied egg-rr37.9%
fma-undefine37.9%
*-lft-identity37.9%
associate--r+38.3%
Simplified38.3%
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
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 1.05e-20)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0)
(if (<= y 2.2e+17)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt x) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.05e-20) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else if (y <= 2.2e+17) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.05d-20) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else if (y <= 2.2d+17) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.05e-20) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2.2e+17) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.05e-20: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 elif y <= 2.2e+17: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.05e-20) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); elseif (y <= 2.2e+17) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.05e-20)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
elseif (y <= 2.2e+17)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.05e-20], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.2e+17], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.05 \cdot 10^{-20}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+17}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 1.0499999999999999e-20Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-96.9%
associate-+l-96.9%
associate-+r-96.9%
Simplified74.7%
Taylor expanded in x around 0 55.8%
Taylor expanded in t around inf 50.2%
Taylor expanded in y around 0 32.3%
associate-+r-62.8%
Simplified62.8%
if 1.0499999999999999e-20 < y < 2.2e17Initial program 88.4%
+-commutative88.4%
associate-+r+88.4%
associate-+r-88.4%
associate-+l-88.6%
associate-+r-88.6%
Simplified79.8%
Taylor expanded in t around inf 21.6%
associate--l+24.6%
associate--l+25.0%
+-commutative25.0%
associate-+r+25.0%
Simplified25.0%
Taylor expanded in z around inf 11.1%
+-commutative11.1%
Simplified11.1%
if 2.2e17 < y Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-49.2%
associate-+l-25.2%
associate-+r-6.6%
Simplified6.6%
Taylor expanded in t around inf 4.2%
associate--l+22.4%
associate--l+17.0%
+-commutative17.0%
associate-+r+17.0%
Simplified17.0%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 21.7%
flip--22.0%
add-sqr-sqrt22.3%
add-sqr-sqrt22.7%
Applied egg-rr22.7%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
+-commutative25.0%
Simplified25.0%
Final simplification43.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 9e-24)
(+ t_1 (+ 2.0 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= z 2.8e+14)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0)
(+ (sqrt (+ 1.0 x)) (- (- t_1 (sqrt y)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 9e-24) {
tmp = t_1 + (2.0 + (sqrt((1.0 + t)) - sqrt(t)));
} else if (z <= 2.8e+14) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else {
tmp = sqrt((1.0 + x)) + ((t_1 - sqrt(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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 9d-24) then
tmp = t_1 + (2.0d0 + (sqrt((1.0d0 + t)) - sqrt(t)))
else if (z <= 2.8d+14) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else
tmp = sqrt((1.0d0 + x)) + ((t_1 - sqrt(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 t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 9e-24) {
tmp = t_1 + (2.0 + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else if (z <= 2.8e+14) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else {
tmp = Math.sqrt((1.0 + x)) + ((t_1 - Math.sqrt(y)) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 9e-24: tmp = t_1 + (2.0 + (math.sqrt((1.0 + t)) - math.sqrt(t))) elif z <= 2.8e+14: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 else: tmp = math.sqrt((1.0 + x)) + ((t_1 - math.sqrt(y)) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 9e-24) tmp = Float64(t_1 + Float64(2.0 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); elseif (z <= 2.8e+14) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(t_1 - sqrt(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)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 9e-24)
tmp = t_1 + (2.0 + (sqrt((1.0 + t)) - sqrt(t)));
elseif (z <= 2.8e+14)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
else
tmp = sqrt((1.0 + x)) + ((t_1 - sqrt(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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 9e-24], N[(t$95$1 + N[(2.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e+14], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 9 \cdot 10^{-24}:\\
\;\;\;\;t\_1 + \left(2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+14}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(t\_1 - \sqrt{y}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 8.9999999999999995e-24Initial program 98.0%
+-commutative98.0%
associate-+r+98.0%
associate-+r-84.3%
associate-+l-75.5%
associate-+r-59.4%
Simplified59.4%
Taylor expanded in x around 0 38.0%
Taylor expanded in z around 0 38.0%
Taylor expanded in y around 0 33.5%
if 8.9999999999999995e-24 < z < 2.8e14Initial program 86.4%
+-commutative86.4%
associate-+r+86.4%
associate-+r-63.6%
associate-+l-63.3%
associate-+r-44.2%
Simplified44.2%
Taylor expanded in x around 0 27.0%
Taylor expanded in t around inf 14.5%
Taylor expanded in y around 0 31.6%
associate-+r-31.6%
Simplified31.6%
if 2.8e14 < z Initial program 86.5%
+-commutative86.5%
associate-+r+86.5%
associate-+r-70.8%
associate-+l-58.3%
associate-+r-58.3%
Simplified35.6%
Taylor expanded in t around inf 5.1%
associate--l+22.0%
associate--l+31.2%
+-commutative31.2%
associate-+r+31.2%
Simplified31.2%
Taylor expanded in z around inf 37.9%
+-commutative37.9%
Simplified37.9%
+-commutative37.9%
*-un-lft-identity37.9%
fma-define37.9%
Applied egg-rr37.9%
fma-undefine37.9%
*-lft-identity37.9%
associate--r+38.3%
Simplified38.3%
Final simplification35.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 2.4e+17) (- (+ (sqrt (+ 1.0 y)) (+ 1.0 (- (sqrt (+ z 1.0)) (sqrt z)))) (sqrt y)) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.4e+17) {
tmp = (sqrt((1.0 + y)) + (1.0 + (sqrt((z + 1.0)) - sqrt(z)))) - sqrt(y);
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.4d+17) then
tmp = (sqrt((1.0d0 + y)) + (1.0d0 + (sqrt((z + 1.0d0)) - sqrt(z)))) - sqrt(y)
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.4e+17) {
tmp = (Math.sqrt((1.0 + y)) + (1.0 + (Math.sqrt((z + 1.0)) - Math.sqrt(z)))) - Math.sqrt(y);
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.4e+17: tmp = (math.sqrt((1.0 + y)) + (1.0 + (math.sqrt((z + 1.0)) - math.sqrt(z)))) - math.sqrt(y) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.4e+17) tmp = Float64(Float64(sqrt(Float64(1.0 + y)) + Float64(1.0 + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))) - sqrt(y)); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.4e+17)
tmp = (sqrt((1.0 + y)) + (1.0 + (sqrt((z + 1.0)) - sqrt(z)))) - sqrt(y);
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.4e+17], N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4 \cdot 10^{+17}:\\
\;\;\;\;\left(\sqrt{1 + y} + \left(1 + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 2.4e17Initial program 95.8%
+-commutative95.8%
associate-+r+95.8%
associate-+r-95.8%
associate-+l-95.9%
associate-+r-95.9%
Simplified75.3%
Taylor expanded in x around 0 56.6%
Taylor expanded in t around inf 50.4%
+-rgt-identity50.4%
associate-+r-50.4%
associate--l+60.4%
Applied egg-rr60.4%
if 2.4e17 < y Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-49.2%
associate-+l-25.2%
associate-+r-6.6%
Simplified6.6%
Taylor expanded in t around inf 4.2%
associate--l+22.4%
associate--l+17.0%
+-commutative17.0%
associate-+r+17.0%
Simplified17.0%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 21.7%
flip--22.0%
add-sqr-sqrt22.3%
add-sqr-sqrt22.7%
Applied egg-rr22.7%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
+-commutative25.0%
Simplified25.0%
Final simplification45.3%
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.9e-21)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0)
(if (<= y 2.2e+17)
(+ 1.0 (- (sqrt (+ 1.0 y)) (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.9e-21) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else if (y <= 2.2e+17) {
tmp = 1.0 + (sqrt((1.0 + y)) - 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.9d-21) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else if (y <= 2.2d+17) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - 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.9e-21) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2.2e+17) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - 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.9e-21: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 elif y <= 2.2e+17: tmp = 1.0 + (math.sqrt((1.0 + y)) - 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.9e-21) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); elseif (y <= 2.2e+17) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - 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.9e-21)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
elseif (y <= 2.2e+17)
tmp = 1.0 + (sqrt((1.0 + y)) - 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.9e-21], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.2e+17], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $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 2.9 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.9e-21Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-96.9%
associate-+l-96.9%
associate-+r-96.9%
Simplified74.7%
Taylor expanded in x around 0 55.8%
Taylor expanded in t around inf 50.2%
Taylor expanded in y around 0 32.3%
associate-+r-62.8%
Simplified62.8%
if 2.9e-21 < y < 2.2e17Initial program 88.4%
+-commutative88.4%
associate-+r+88.4%
associate-+r-88.4%
associate-+l-88.6%
associate-+r-88.6%
Simplified79.8%
Taylor expanded in t around inf 21.6%
associate--l+24.6%
associate--l+25.0%
+-commutative25.0%
associate-+r+25.0%
Simplified25.0%
Taylor expanded in z around inf 11.1%
+-commutative11.1%
Simplified11.1%
Taylor expanded in x around 0 31.4%
associate--l+31.4%
Simplified31.4%
if 2.2e17 < y Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-49.2%
associate-+l-25.2%
associate-+r-6.6%
Simplified6.6%
Taylor expanded in t around inf 4.2%
associate--l+22.4%
associate--l+17.0%
+-commutative17.0%
associate-+r+17.0%
Simplified17.0%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 21.7%
Final simplification43.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 4.2e-21)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0)
(if (<= y 2.5e+17)
(- (+ 1.0 (sqrt (+ 1.0 y))) (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 <= 4.2e-21) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else if (y <= 2.5e+17) {
tmp = (1.0 + sqrt((1.0 + y))) - 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 <= 4.2d-21) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else if (y <= 2.5d+17) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - 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 <= 4.2e-21) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2.5e+17) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - 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 <= 4.2e-21: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 elif y <= 2.5e+17: tmp = (1.0 + math.sqrt((1.0 + y))) - 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 <= 4.2e-21) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); elseif (y <= 2.5e+17) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - 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 <= 4.2e-21)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
elseif (y <= 2.5e+17)
tmp = (1.0 + sqrt((1.0 + y))) - 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, 4.2e-21], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.5e+17], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $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 4.2 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 4.20000000000000025e-21Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-96.9%
associate-+l-96.9%
associate-+r-96.9%
Simplified74.7%
Taylor expanded in x around 0 55.8%
Taylor expanded in t around inf 50.2%
Taylor expanded in y around 0 32.3%
associate-+r-62.8%
Simplified62.8%
if 4.20000000000000025e-21 < y < 2.5e17Initial program 88.4%
+-commutative88.4%
associate-+r+88.4%
associate-+r-88.4%
associate-+l-88.6%
associate-+r-88.6%
Simplified79.8%
Taylor expanded in t around inf 21.6%
associate--l+24.6%
associate--l+25.0%
+-commutative25.0%
associate-+r+25.0%
Simplified25.0%
Taylor expanded in z around inf 11.1%
+-commutative11.1%
Simplified11.1%
Taylor expanded in x around 0 31.4%
if 2.5e17 < y Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-49.2%
associate-+l-25.2%
associate-+r-6.6%
Simplified6.6%
Taylor expanded in t around inf 4.2%
associate--l+22.4%
associate--l+17.0%
+-commutative17.0%
associate-+r+17.0%
Simplified17.0%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 21.7%
Final simplification43.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.3e-20)
(+ (- (sqrt (+ z 1.0)) (sqrt z)) 2.0)
(if (<= y 2.3e+17)
(- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.3e-20) {
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
} else if (y <= 2.3e+17) {
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.3d-20) then
tmp = (sqrt((z + 1.0d0)) - sqrt(z)) + 2.0d0
else if (y <= 2.3d+17) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - sqrt(y)
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.3e-20) {
tmp = (Math.sqrt((z + 1.0)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2.3e+17) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y);
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.3e-20: tmp = (math.sqrt((z + 1.0)) - math.sqrt(z)) + 2.0 elif y <= 2.3e+17: tmp = (1.0 + math.sqrt((1.0 + y))) - math.sqrt(y) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.3e-20) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) + 2.0); elseif (y <= 2.3e+17) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y)); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.3e-20)
tmp = (sqrt((z + 1.0)) - sqrt(z)) + 2.0;
elseif (y <= 2.3e+17)
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.3e-20], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.3e+17], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-20}:\\
\;\;\;\;\left(\sqrt{z + 1} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 2.2999999999999999e-20Initial program 96.9%
+-commutative96.9%
associate-+r+96.9%
associate-+r-96.9%
associate-+l-96.9%
associate-+r-96.9%
Simplified74.7%
Taylor expanded in x around 0 55.8%
Taylor expanded in t around inf 50.2%
Taylor expanded in y around 0 32.3%
associate-+r-62.8%
Simplified62.8%
if 2.2999999999999999e-20 < y < 2.3e17Initial program 88.4%
+-commutative88.4%
associate-+r+88.4%
associate-+r-88.4%
associate-+l-88.6%
associate-+r-88.6%
Simplified79.8%
Taylor expanded in t around inf 21.6%
associate--l+24.6%
associate--l+25.0%
+-commutative25.0%
associate-+r+25.0%
Simplified25.0%
Taylor expanded in z around inf 11.1%
+-commutative11.1%
Simplified11.1%
Taylor expanded in x around 0 31.4%
if 2.3e17 < y Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-49.2%
associate-+l-25.2%
associate-+r-6.6%
Simplified6.6%
Taylor expanded in t around inf 4.2%
associate--l+22.4%
associate--l+17.0%
+-commutative17.0%
associate-+r+17.0%
Simplified17.0%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 21.7%
flip--22.0%
add-sqr-sqrt22.3%
add-sqr-sqrt22.7%
Applied egg-rr22.7%
associate--l+25.0%
+-inverses25.0%
metadata-eval25.0%
+-commutative25.0%
Simplified25.0%
Final simplification44.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 2.55e+17) (+ 1.0 (- (sqrt (+ 1.0 y)) (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.55e+17) {
tmp = 1.0 + (sqrt((1.0 + y)) - 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.55d+17) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - 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.55e+17) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - 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.55e+17: tmp = 1.0 + (math.sqrt((1.0 + y)) - 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.55e+17) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - 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.55e+17)
tmp = 1.0 + (sqrt((1.0 + y)) - 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.55e+17], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $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 2.55 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.55e17Initial program 95.8%
+-commutative95.8%
associate-+r+95.8%
associate-+r-95.8%
associate-+l-95.9%
associate-+r-95.9%
Simplified75.3%
Taylor expanded in t around inf 21.4%
associate--l+26.3%
associate--l+38.7%
+-commutative38.7%
associate-+r+38.7%
Simplified38.7%
Taylor expanded in z around inf 28.7%
+-commutative28.7%
Simplified28.7%
Taylor expanded in x around 0 48.6%
associate--l+48.6%
Simplified48.6%
if 2.55e17 < y Initial program 85.2%
+-commutative85.2%
associate-+r+85.2%
associate-+r-49.2%
associate-+l-25.2%
associate-+r-6.6%
Simplified6.6%
Taylor expanded in t around inf 4.2%
associate--l+22.4%
associate--l+17.0%
+-commutative17.0%
associate-+r+17.0%
Simplified17.0%
Taylor expanded in z around inf 21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 21.7%
Final simplification37.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + x)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 91.3%
+-commutative91.3%
associate-+r+91.3%
associate-+r-76.0%
associate-+l-65.8%
associate-+r-57.8%
Simplified46.1%
Taylor expanded in t around inf 14.1%
associate--l+24.7%
associate--l+29.4%
+-commutative29.4%
associate-+r+29.4%
Simplified29.4%
Taylor expanded in z around inf 25.6%
+-commutative25.6%
Simplified25.6%
Taylor expanded in y around inf 15.6%
Final simplification15.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 2024039
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:herbie-target
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))