
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_4 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_3 5e-5)
(+ (/ 1.0 (+ (sqrt x) t_2)) (* 0.5 (sqrt (/ 1.0 y))))
(+
(- t_2 (sqrt x))
(+
t_3
(/ (+ (* (+ 1.0 (- t t)) t_1) (* t_4 (+ z (- 1.0 z)))) (* t_1 t_4)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) + sqrt(z);
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((y + 1.0)) - sqrt(y);
double t_4 = sqrt((1.0 + t)) + sqrt(t);
double tmp;
if (t_3 <= 5e-5) {
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * sqrt((1.0 / y)));
} else {
tmp = (t_2 - sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_1) + (t_4 * (z + (1.0 - z)))) / (t_1 * t_4)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) + sqrt(z)
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((y + 1.0d0)) - sqrt(y)
t_4 = sqrt((1.0d0 + t)) + sqrt(t)
if (t_3 <= 5d-5) then
tmp = (1.0d0 / (sqrt(x) + t_2)) + (0.5d0 * sqrt((1.0d0 / y)))
else
tmp = (t_2 - sqrt(x)) + (t_3 + ((((1.0d0 + (t - t)) * t_1) + (t_4 * (z + (1.0d0 - z)))) / (t_1 * t_4)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) + Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_4 = Math.sqrt((1.0 + t)) + Math.sqrt(t);
double tmp;
if (t_3 <= 5e-5) {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (0.5 * Math.sqrt((1.0 / y)));
} else {
tmp = (t_2 - Math.sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_1) + (t_4 * (z + (1.0 - z)))) / (t_1 * t_4)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) + math.sqrt(z) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((y + 1.0)) - math.sqrt(y) t_4 = math.sqrt((1.0 + t)) + math.sqrt(t) tmp = 0 if t_3 <= 5e-5: tmp = (1.0 / (math.sqrt(x) + t_2)) + (0.5 * math.sqrt((1.0 / y))) else: tmp = (t_2 - math.sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_1) + (t_4 * (z + (1.0 - z)))) / (t_1 * t_4))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) + sqrt(z)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_4 = Float64(sqrt(Float64(1.0 + t)) + sqrt(t)) tmp = 0.0 if (t_3 <= 5e-5) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); else tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(t_3 + Float64(Float64(Float64(Float64(1.0 + Float64(t - t)) * t_1) + Float64(t_4 * Float64(z + Float64(1.0 - z)))) / Float64(t_1 * t_4)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) + sqrt(z);
t_2 = sqrt((1.0 + x));
t_3 = sqrt((y + 1.0)) - sqrt(y);
t_4 = sqrt((1.0 + t)) + sqrt(t);
tmp = 0.0;
if (t_3 <= 5e-5)
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * sqrt((1.0 / y)));
else
tmp = (t_2 - sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_1) + (t_4 * (z + (1.0 - z)))) / (t_1 * t_4)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 5e-5], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[(N[(N[(1.0 + N[(t - t), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(t$95$4 * N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} + \sqrt{z}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{y + 1} - \sqrt{y}\\
t_4 := \sqrt{1 + t} + \sqrt{t}\\
\mathbf{if}\;t\_3 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(t\_3 + \frac{\left(1 + \left(t - t\right)\right) \cdot t\_1 + t\_4 \cdot \left(z + \left(1 - z\right)\right)}{t\_1 \cdot t\_4}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000024e-5Initial program 86.8%
associate-+l+86.8%
associate-+l+86.8%
+-commutative86.8%
+-commutative86.8%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.6%
Taylor expanded in z around inf 20.5%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.1%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-83.1%
+-commutative83.1%
+-commutative83.1%
Simplified83.1%
associate--r-96.7%
flip--96.7%
flip--96.7%
frac-add96.6%
Applied egg-rr97.7%
Final simplification59.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 x))) (t_2 (- (sqrt (+ y 1.0)) (sqrt y))))
(if (<= t_2 5e-5)
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (sqrt (/ 1.0 y))))
(+
(+ (- t_1 (sqrt x)) t_2)
(+
(/ (+ z (- 1.0 z)) (+ (sqrt (+ 1.0 z)) (sqrt z)))
(- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double tmp;
if (t_2 <= 5e-5) {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
} else {
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0 - z)) / (sqrt((1.0 + z)) + sqrt(z))) + (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((1.0d0 + x))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
if (t_2 <= 5d-5) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * sqrt((1.0d0 / y)))
else
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0d0 - z)) / (sqrt((1.0d0 + z)) + sqrt(z))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double tmp;
if (t_2 <= 5e-5) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * Math.sqrt((1.0 / y)));
} else {
tmp = ((t_1 - Math.sqrt(x)) + t_2) + (((z + (1.0 - z)) / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) tmp = 0 if t_2 <= 5e-5: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * math.sqrt((1.0 / y))) else: tmp = ((t_1 - math.sqrt(x)) + t_2) + (((z + (1.0 - z)) / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) tmp = 0.0 if (t_2 <= 5e-5) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + t_2) + Float64(Float64(Float64(z + Float64(1.0 - z)) / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((y + 1.0)) - sqrt(y);
tmp = 0.0;
if (t_2 <= 5e-5)
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
else
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0 - z)) / (sqrt((1.0 + z)) + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e-5], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[(N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
\mathbf{if}\;t\_2 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + t\_2\right) + \left(\frac{z + \left(1 - z\right)}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000024e-5Initial program 86.8%
associate-+l+86.8%
associate-+l+86.8%
+-commutative86.8%
+-commutative86.8%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.6%
Taylor expanded in z around inf 20.5%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.1%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--27.2%
add-sqr-sqrt21.0%
+-commutative21.0%
add-sqr-sqrt27.2%
associate--l+27.2%
Applied egg-rr96.7%
Final simplification59.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (- (sqrt (+ y 1.0)) (sqrt y))))
(if (<= t_2 5e-5)
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (sqrt (/ 1.0 y))))
(+
(+ (- t_1 (sqrt x)) t_2)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double tmp;
if (t_2 <= 5e-5) {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
} else {
tmp = ((t_1 - sqrt(x)) + t_2) + ((sqrt((1.0 + z)) - sqrt(z)) + (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) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
if (t_2 <= 5d-5) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * sqrt((1.0d0 / y)))
else
tmp = ((t_1 - sqrt(x)) + t_2) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double tmp;
if (t_2 <= 5e-5) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * Math.sqrt((1.0 / y)));
} else {
tmp = ((t_1 - Math.sqrt(x)) + t_2) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) tmp = 0 if t_2 <= 5e-5: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * math.sqrt((1.0 / y))) else: tmp = ((t_1 - math.sqrt(x)) + t_2) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) tmp = 0.0 if (t_2 <= 5e-5) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + t_2) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((y + 1.0)) - sqrt(y);
tmp = 0.0;
if (t_2 <= 5e-5)
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
else
tmp = ((t_1 - sqrt(x)) + t_2) + ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e-5], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
\mathbf{if}\;t\_2 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + t\_2\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000024e-5Initial program 86.8%
associate-+l+86.8%
associate-+l+86.8%
+-commutative86.8%
+-commutative86.8%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.6%
Taylor expanded in z around inf 20.5%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.1%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
flip--96.7%
div-inv96.7%
add-sqr-sqrt77.9%
add-sqr-sqrt96.9%
associate--l+97.8%
Applied egg-rr97.8%
+-inverses97.8%
metadata-eval97.8%
*-lft-identity97.8%
+-commutative97.8%
Simplified97.8%
Final simplification59.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 290000000.0)
(+
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (+ 1.0 (- (* x 0.5) (sqrt x))))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 290000000.0) {
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 + ((x * 0.5) - sqrt(x)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 290000000.0d0) then
tmp = ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 + ((x * 0.5d0) - sqrt(x)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 290000000.0) {
tmp = ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 + ((x * 0.5) - Math.sqrt(x)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 290000000.0: tmp = ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 + ((x * 0.5) - math.sqrt(x)))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 290000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x)))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 290000000.0)
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 + ((x * 0.5) - sqrt(x)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 290000000.0], N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 290000000:\\
\;\;\;\;\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 2.9e8Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 52.6%
associate--l+27.1%
Simplified52.6%
if 2.9e8 < y Initial program 86.9%
associate-+l+86.9%
associate-+l+86.9%
+-commutative86.9%
+-commutative86.9%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.8%
Taylor expanded in z around inf 20.6%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.3%
+-commutative23.3%
Applied egg-rr23.3%
+-inverses23.3%
metadata-eval23.3%
*-lft-identity23.3%
+-commutative23.3%
Simplified23.3%
Taylor expanded in y around inf 25.2%
Final simplification38.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))))
(if (<= y 3.4e-30)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(- (- (+ 1.0 t_1) (sqrt x)) (sqrt y)))
(if (<= y 15500000.0)
(+
(+ 1.0 (- (* x 0.5) (sqrt x)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (* 0.5 (sqrt (/ 1.0 z)))))
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 3.4e-30) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + (((1.0 + t_1) - sqrt(x)) - sqrt(y));
} else if (y <= 15500000.0) {
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + (0.5 * sqrt((1.0 / z))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 3.4d-30) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t)))) + (((1.0d0 + t_1) - sqrt(x)) - sqrt(y))
else if (y <= 15500000.0d0) then
tmp = (1.0d0 + ((x * 0.5d0) - sqrt(x))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (0.5d0 * sqrt((1.0d0 / z))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 3.4e-30) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))) + (((1.0 + t_1) - Math.sqrt(x)) - Math.sqrt(y));
} else if (y <= 15500000.0) {
tmp = (1.0 + ((x * 0.5) - Math.sqrt(x))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (0.5 * Math.sqrt((1.0 / z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 3.4e-30: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) + (((1.0 + t_1) - math.sqrt(x)) - math.sqrt(y)) elif y <= 15500000.0: tmp = (1.0 + ((x * 0.5) - math.sqrt(x))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (0.5 * math.sqrt((1.0 / z)))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 3.4e-30) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))) + Float64(Float64(Float64(1.0 + t_1) - sqrt(x)) - sqrt(y))); elseif (y <= 15500000.0) tmp = Float64(Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(0.5 * sqrt(Float64(1.0 / z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 3.4e-30)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + (((1.0 + t_1) - sqrt(x)) - sqrt(y));
elseif (y <= 15500000.0)
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + (0.5 * sqrt((1.0 / z))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.4e-30], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t$95$1), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 15500000.0], N[(N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 3.4 \cdot 10^{-30}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) + \left(\left(\left(1 + t\_1\right) - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 15500000:\\
\;\;\;\;\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 3.4000000000000003e-30Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.1%
div-inv97.1%
add-sqr-sqrt78.8%
add-sqr-sqrt97.3%
associate--l+98.0%
Applied egg-rr98.0%
+-inverses98.0%
metadata-eval98.0%
*-lft-identity98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in y around 0 64.9%
associate--r+64.8%
Simplified64.8%
if 3.4000000000000003e-30 < y < 1.55e7Initial program 94.8%
associate-+l+94.8%
associate-+l+94.8%
+-commutative94.8%
+-commutative94.8%
associate-+l-77.0%
+-commutative77.0%
+-commutative77.0%
Simplified77.0%
Taylor expanded in t around inf 64.1%
Taylor expanded in x around 0 36.9%
associate--l+36.9%
Simplified36.9%
Taylor expanded in z around inf 15.7%
if 1.55e7 < y Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
associate-+l-71.5%
+-commutative71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in t around inf 38.5%
Taylor expanded in z around inf 20.5%
flip--20.9%
div-inv20.9%
add-sqr-sqrt21.0%
+-commutative21.0%
add-sqr-sqrt20.9%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.0%
Final simplification40.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 z))) (t_2 (sqrt (+ 1.0 x))))
(if (<= y 1.5e-60)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- t_1 (sqrt z)))
(+ (- t_2 (sqrt x)) (- 1.0 (sqrt y))))
(if (<= y 280000000.0)
(+
(+ 1.0 (- (* x 0.5) (sqrt x)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (/ (+ z (- 1.0 z)) (+ t_1 (sqrt z)))))
(+ (/ 1.0 (+ (sqrt x) t_2)) (* 0.5 (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + x));
double tmp;
if (y <= 1.5e-60) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z))) + ((t_2 - sqrt(x)) + (1.0 - sqrt(y)));
} else if (y <= 280000000.0) {
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + ((z + (1.0 - z)) / (t_1 + sqrt(z))));
} else {
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
if (y <= 1.5d-60) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (t_1 - sqrt(z))) + ((t_2 - sqrt(x)) + (1.0d0 - sqrt(y)))
else if (y <= 280000000.0d0) then
tmp = (1.0d0 + ((x * 0.5d0) - sqrt(x))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + ((z + (1.0d0 - z)) / (t_1 + sqrt(z))))
else
tmp = (1.0d0 / (sqrt(x) + t_2)) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.5e-60) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (t_1 - Math.sqrt(z))) + ((t_2 - Math.sqrt(x)) + (1.0 - Math.sqrt(y)));
} else if (y <= 280000000.0) {
tmp = (1.0 + ((x * 0.5) - Math.sqrt(x))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + ((z + (1.0 - z)) / (t_1 + Math.sqrt(z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.5e-60: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (t_1 - math.sqrt(z))) + ((t_2 - math.sqrt(x)) + (1.0 - math.sqrt(y))) elif y <= 280000000.0: tmp = (1.0 + ((x * 0.5) - math.sqrt(x))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + ((z + (1.0 - z)) / (t_1 + math.sqrt(z)))) else: tmp = (1.0 / (math.sqrt(x) + t_2)) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.5e-60) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(t_1 - sqrt(z))) + Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 - sqrt(y)))); elseif (y <= 280000000.0) tmp = Float64(Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(Float64(z + Float64(1.0 - z)) / Float64(t_1 + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.5e-60)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z))) + ((t_2 - sqrt(x)) + (1.0 - sqrt(y)));
elseif (y <= 280000000.0)
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + ((z + (1.0 - z)) / (t_1 + sqrt(z))));
else
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.5e-60], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 280000000.0], N[(N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.5 \cdot 10^{-60}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t\_1 - \sqrt{z}\right)\right) + \left(\left(t\_2 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;y \leq 280000000:\\
\;\;\;\;\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{z + \left(1 - z\right)}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 1.50000000000000009e-60Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in y around 0 96.9%
if 1.50000000000000009e-60 < y < 2.8e8Initial program 95.2%
associate-+l+95.2%
associate-+l+95.2%
+-commutative95.2%
+-commutative95.2%
associate-+l-80.4%
+-commutative80.4%
+-commutative80.4%
Simplified80.4%
Taylor expanded in t around inf 52.2%
Taylor expanded in x around 0 27.8%
associate--l+27.8%
Simplified27.8%
flip--27.8%
add-sqr-sqrt21.2%
+-commutative21.2%
add-sqr-sqrt27.8%
associate--l+27.8%
Applied egg-rr27.8%
if 2.8e8 < y Initial program 86.9%
associate-+l+86.9%
associate-+l+86.9%
+-commutative86.9%
+-commutative86.9%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.8%
Taylor expanded in z around inf 20.6%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.3%
+-commutative23.3%
Applied egg-rr23.3%
+-inverses23.3%
metadata-eval23.3%
*-lft-identity23.3%
+-commutative23.3%
Simplified23.3%
Taylor expanded in y around inf 25.2%
Final simplification51.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (- t_1 (sqrt x))))
(if (<= t_2 0.9999995)
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (sqrt (/ 1.0 y))))
(+ t_2 (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0))))))))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 = t_1 - sqrt(x);
double tmp;
if (t_2 <= 0.9999995) {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
} else {
tmp = t_2 + (1.0 / (sqrt(y) + sqrt((y + 1.0))));
}
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 = t_1 - sqrt(x)
if (t_2 <= 0.9999995d0) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * sqrt((1.0d0 / y)))
else
tmp = t_2 + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))
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 = t_1 - Math.sqrt(x);
double tmp;
if (t_2 <= 0.9999995) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * Math.sqrt((1.0 / y)));
} else {
tmp = t_2 + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))));
}
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 = t_1 - math.sqrt(x) tmp = 0 if t_2 <= 0.9999995: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * math.sqrt((1.0 / y))) else: tmp = t_2 + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(t_1 - sqrt(x)) tmp = 0.0 if (t_2 <= 0.9999995) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); else tmp = Float64(t_2 + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))); 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 = t_1 - sqrt(x);
tmp = 0.0;
if (t_2 <= 0.9999995)
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
else
tmp = t_2 + (1.0 / (sqrt(y) + sqrt((y + 1.0))));
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[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.9999995], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := t\_1 - \sqrt{x}\\
\mathbf{if}\;t\_2 \leq 0.9999995:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.999999500000000041Initial program 85.0%
associate-+l+85.0%
associate-+l+85.0%
+-commutative85.0%
+-commutative85.0%
associate-+l-68.3%
+-commutative68.3%
+-commutative68.3%
Simplified68.3%
Taylor expanded in t around inf 40.0%
Taylor expanded in z around inf 19.4%
flip--19.8%
div-inv19.8%
add-sqr-sqrt12.6%
+-commutative12.6%
add-sqr-sqrt20.1%
associate--l+22.6%
+-commutative22.6%
Applied egg-rr22.6%
+-inverses22.6%
metadata-eval22.6%
*-lft-identity22.6%
+-commutative22.6%
Simplified22.6%
Taylor expanded in y around inf 11.0%
if 0.999999500000000041 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 98.2%
associate-+l+98.2%
associate-+l+98.2%
+-commutative98.2%
+-commutative98.2%
associate-+l-85.8%
+-commutative85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in t around inf 49.4%
Taylor expanded in z around inf 35.8%
flip--35.8%
div-inv35.8%
add-sqr-sqrt27.5%
add-sqr-sqrt35.8%
associate--l+35.8%
Applied egg-rr35.8%
+-inverses35.8%
metadata-eval35.8%
*-lft-identity35.8%
+-commutative35.8%
Simplified35.8%
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 180000000.0)
(+
(+ 1.0 (- (* x 0.5) (sqrt x)))
(+
(- (sqrt (+ y 1.0)) (sqrt y))
(/ (+ z (- 1.0 z)) (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 180000000.0) {
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + ((z + (1.0 - z)) / (sqrt((1.0 + z)) + sqrt(z))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 180000000.0d0) then
tmp = (1.0d0 + ((x * 0.5d0) - sqrt(x))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + ((z + (1.0d0 - z)) / (sqrt((1.0d0 + z)) + sqrt(z))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 180000000.0) {
tmp = (1.0 + ((x * 0.5) - Math.sqrt(x))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + ((z + (1.0 - z)) / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 180000000.0: tmp = (1.0 + ((x * 0.5) - math.sqrt(x))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + ((z + (1.0 - z)) / (math.sqrt((1.0 + z)) + math.sqrt(z)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 180000000.0) tmp = Float64(Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(Float64(z + Float64(1.0 - z)) / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 180000000.0)
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + ((z + (1.0 - z)) / (sqrt((1.0 + z)) + sqrt(z))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 180000000.0], N[(N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $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[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 180000000:\\
\;\;\;\;\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{z + \left(1 - z\right)}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 1.8e8Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-83.1%
+-commutative83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in t around inf 51.3%
Taylor expanded in x around 0 27.2%
associate--l+27.2%
Simplified27.2%
flip--27.2%
add-sqr-sqrt21.0%
+-commutative21.0%
add-sqr-sqrt27.2%
associate--l+27.2%
Applied egg-rr27.2%
if 1.8e8 < y Initial program 86.8%
associate-+l+86.8%
associate-+l+86.8%
+-commutative86.8%
+-commutative86.8%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.6%
Taylor expanded in z around inf 20.5%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.1%
Final simplification26.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 280000000.0)
(+
(+ 1.0 (- (* x 0.5) (sqrt x)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 280000000.0) {
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 280000000.0d0) then
tmp = (1.0d0 + ((x * 0.5d0) - sqrt(x))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 280000000.0) {
tmp = (1.0 + ((x * 0.5) - Math.sqrt(x))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 280000000.0: tmp = (1.0 + ((x * 0.5) - math.sqrt(x))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 280000000.0) tmp = Float64(Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 280000000.0)
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z)));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 280000000.0], N[(N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 280000000:\\
\;\;\;\;\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 2.8e8Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-82.9%
+-commutative82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 51.0%
Taylor expanded in x around 0 27.1%
associate--l+27.1%
Simplified27.1%
if 2.8e8 < y Initial program 86.9%
associate-+l+86.9%
associate-+l+86.9%
+-commutative86.9%
+-commutative86.9%
associate-+l-71.4%
+-commutative71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in t around inf 38.8%
Taylor expanded in z around inf 20.6%
flip--21.0%
div-inv21.0%
add-sqr-sqrt21.1%
+-commutative21.1%
add-sqr-sqrt21.0%
associate--l+23.3%
+-commutative23.3%
Applied egg-rr23.3%
+-inverses23.3%
metadata-eval23.3%
*-lft-identity23.3%
+-commutative23.3%
Simplified23.3%
Taylor expanded in y around inf 25.2%
Final simplification26.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 2e-39)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* x 0.5)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= y 6000000.0)
(+
(+ 1.0 (- (* x 0.5) (sqrt x)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (* 0.5 (sqrt (/ 1.0 z)))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-39) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (x * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (y <= 6000000.0) {
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + (0.5 * sqrt((1.0 / z))));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2d-39) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (x * 0.5d0)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (y <= 6000000.0d0) then
tmp = (1.0d0 + ((x * 0.5d0) - sqrt(x))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (0.5d0 * sqrt((1.0d0 / z))))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-39) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (x * 0.5)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 6000000.0) {
tmp = (1.0 + ((x * 0.5) - Math.sqrt(x))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (0.5 * Math.sqrt((1.0 / z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2e-39: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (x * 0.5)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif y <= 6000000.0: tmp = (1.0 + ((x * 0.5) - math.sqrt(x))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (0.5 * math.sqrt((1.0 / z)))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2e-39) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(x * 0.5)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (y <= 6000000.0) tmp = Float64(Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(0.5 * sqrt(Float64(1.0 / z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2e-39)
tmp = 2.0 + ((sqrt((1.0 + z)) + (x * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (y <= 6000000.0)
tmp = (1.0 + ((x * 0.5) - sqrt(x))) + ((sqrt((y + 1.0)) - sqrt(y)) + (0.5 * sqrt((1.0 / z))));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2e-39], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6000000.0], N[(N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $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[(0.5 * N[Sqrt[N[(1.0 / y), $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 \cdot 10^{-39}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + x \cdot 0.5\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 6000000:\\
\;\;\;\;\left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 1.99999999999999986e-39Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
associate-+l-84.4%
+-commutative84.4%
+-commutative84.4%
Simplified84.4%
Taylor expanded in t around inf 49.4%
Taylor expanded in x around 0 26.1%
associate--l+26.1%
Simplified26.1%
add-cube-cbrt25.9%
pow325.8%
*-commutative25.8%
associate-+l-25.8%
Applied egg-rr25.8%
Taylor expanded in y around 0 14.1%
associate--l+26.0%
+-commutative26.0%
*-commutative26.0%
Simplified26.0%
if 1.99999999999999986e-39 < y < 6e6Initial program 95.5%
associate-+l+95.5%
associate-+l+95.5%
+-commutative95.5%
+-commutative95.5%
associate-+l-76.4%
+-commutative76.4%
+-commutative76.4%
Simplified76.4%
Taylor expanded in t around inf 61.6%
Taylor expanded in x around 0 33.1%
associate--l+33.1%
Simplified33.1%
Taylor expanded in z around inf 14.3%
if 6e6 < y Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
associate-+l-71.5%
+-commutative71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in t around inf 38.5%
Taylor expanded in z around inf 20.5%
flip--20.9%
div-inv20.9%
add-sqr-sqrt21.0%
+-commutative21.0%
add-sqr-sqrt20.9%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.0%
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 2e-39)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* x 0.5)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= y 6500000.0)
(+
1.0
(-
(+ (sqrt (+ y 1.0)) (* 0.5 (+ x (sqrt (/ 1.0 z)))))
(+ (sqrt y) (sqrt x))))
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-39) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (x * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (y <= 6500000.0) {
tmp = 1.0 + ((sqrt((y + 1.0)) + (0.5 * (x + sqrt((1.0 / z))))) - (sqrt(y) + sqrt(x)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2d-39) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (x * 0.5d0)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (y <= 6500000.0d0) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) + (0.5d0 * (x + sqrt((1.0d0 / z))))) - (sqrt(y) + sqrt(x)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-39) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (x * 0.5)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 6500000.0) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) + (0.5 * (x + Math.sqrt((1.0 / z))))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2e-39: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (x * 0.5)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif y <= 6500000.0: tmp = 1.0 + ((math.sqrt((y + 1.0)) + (0.5 * (x + math.sqrt((1.0 / z))))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2e-39) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(x * 0.5)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (y <= 6500000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * Float64(x + sqrt(Float64(1.0 / z))))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2e-39)
tmp = 2.0 + ((sqrt((1.0 + z)) + (x * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (y <= 6500000.0)
tmp = 1.0 + ((sqrt((y + 1.0)) + (0.5 * (x + sqrt((1.0 / z))))) - (sqrt(y) + sqrt(x)));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2e-39], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6500000.0], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[(x + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $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 \cdot 10^{-39}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + x \cdot 0.5\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 6500000:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} + 0.5 \cdot \left(x + \sqrt{\frac{1}{z}}\right)\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 1.99999999999999986e-39Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
associate-+l-84.4%
+-commutative84.4%
+-commutative84.4%
Simplified84.4%
Taylor expanded in t around inf 49.4%
Taylor expanded in x around 0 26.1%
associate--l+26.1%
Simplified26.1%
add-cube-cbrt25.9%
pow325.8%
*-commutative25.8%
associate-+l-25.8%
Applied egg-rr25.8%
Taylor expanded in y around 0 14.1%
associate--l+26.0%
+-commutative26.0%
*-commutative26.0%
Simplified26.0%
if 1.99999999999999986e-39 < y < 6.5e6Initial program 95.5%
associate-+l+95.5%
associate-+l+95.5%
+-commutative95.5%
+-commutative95.5%
associate-+l-76.4%
+-commutative76.4%
+-commutative76.4%
Simplified76.4%
Taylor expanded in t around inf 61.6%
Taylor expanded in x around 0 33.1%
associate--l+33.1%
Simplified33.1%
Taylor expanded in z around inf 14.3%
associate--l+14.3%
distribute-lft-out14.3%
Simplified14.3%
if 6.5e6 < y Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
associate-+l-71.5%
+-commutative71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in t around inf 38.5%
Taylor expanded in z around inf 20.5%
flip--20.9%
div-inv20.9%
add-sqr-sqrt21.0%
+-commutative21.0%
add-sqr-sqrt20.9%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.0%
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
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 1.6e-28)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* x 0.5)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= y 1e+30)
(+ (- t_1 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0)))))
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.6e-28) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (x * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (y <= 1e+30) {
tmp = (t_1 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.6d-28) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (x * 0.5d0)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (y <= 1d+30) then
tmp = (t_1 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.6e-28) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (x * 0.5)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 1e+30) {
tmp = (t_1 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.6e-28: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (x * 0.5)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif y <= 1e+30: tmp = (t_1 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0)))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.6e-28) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(x * 0.5)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (y <= 1e+30) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.6e-28)
tmp = 2.0 + ((sqrt((1.0 + z)) + (x * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (y <= 1e+30)
tmp = (t_1 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.6e-28], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+30], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.6 \cdot 10^{-28}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + x \cdot 0.5\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 10^{+30}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 1.59999999999999991e-28Initial program 97.1%
associate-+l+97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
associate-+l-84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 49.4%
Taylor expanded in x around 0 25.6%
associate--l+25.6%
Simplified25.6%
add-cube-cbrt25.5%
pow325.4%
*-commutative25.4%
associate-+l-25.4%
Applied egg-rr25.4%
Taylor expanded in y around 0 14.0%
associate--l+25.6%
+-commutative25.6%
*-commutative25.6%
Simplified25.6%
if 1.59999999999999991e-28 < y < 1e30Initial program 88.8%
associate-+l+88.8%
associate-+l+88.8%
+-commutative88.8%
+-commutative88.8%
associate-+l-73.3%
+-commutative73.3%
+-commutative73.3%
Simplified73.3%
Taylor expanded in t around inf 47.8%
Taylor expanded in z around inf 29.0%
flip--29.7%
div-inv29.7%
add-sqr-sqrt30.3%
add-sqr-sqrt29.7%
associate--l+31.2%
Applied egg-rr31.2%
+-inverses31.2%
metadata-eval31.2%
*-lft-identity31.2%
+-commutative31.2%
Simplified31.2%
if 1e30 < y Initial program 87.4%
associate-+l+87.4%
associate-+l+87.4%
+-commutative87.4%
+-commutative87.4%
associate-+l-71.8%
+-commutative71.8%
+-commutative71.8%
Simplified71.8%
Taylor expanded in t around inf 39.9%
Taylor expanded in z around inf 21.7%
flip--22.1%
div-inv22.1%
add-sqr-sqrt22.3%
+-commutative22.3%
add-sqr-sqrt22.1%
associate--l+24.4%
+-commutative24.4%
Applied egg-rr24.4%
+-inverses24.4%
metadata-eval24.4%
*-lft-identity24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in y around inf 26.3%
Final simplification26.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 59000000.0) (- (+ 1.0 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x))) (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 59000000.0) {
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 59000000.0d0) then
tmp = (1.0d0 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 59000000.0) {
tmp = (1.0 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 59000000.0: tmp = (1.0 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 59000000.0) tmp = Float64(Float64(1.0 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 59000000.0)
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 59000000.0], N[(N[(1.0 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 59000000:\\
\;\;\;\;\left(1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\end{array}
\end{array}
if y < 5.9e7Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
Taylor expanded in t around inf 51.5%
Taylor expanded in z around inf 35.2%
Taylor expanded in x around 0 18.0%
if 5.9e7 < y Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
associate-+l-71.5%
+-commutative71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in t around inf 38.5%
Taylor expanded in z around inf 20.5%
flip--20.9%
div-inv20.9%
add-sqr-sqrt21.0%
+-commutative21.0%
add-sqr-sqrt20.9%
associate--l+23.2%
+-commutative23.2%
Applied egg-rr23.2%
+-inverses23.2%
metadata-eval23.2%
*-lft-identity23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in y around inf 25.0%
Final simplification21.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 6.5e+21) (+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))) (/ 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 <= 6.5e+21) {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} 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 <= 6.5d+21) then
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
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 <= 6.5e+21) {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} 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 <= 6.5e+21: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) 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 <= 6.5e+21) tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); 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 <= 6.5e+21)
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
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, 6.5e+21], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.5 \cdot 10^{+21}:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 6.5e21Initial program 95.4%
associate-+l+95.4%
associate-+l+95.4%
+-commutative95.4%
+-commutative95.4%
associate-+l-81.5%
+-commutative81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in t around inf 50.3%
Taylor expanded in z around inf 33.7%
Taylor expanded in x around 0 17.2%
associate--l+17.2%
Simplified17.2%
if 6.5e21 < y Initial program 87.5%
associate-+l+87.5%
associate-+l+87.5%
+-commutative87.5%
+-commutative87.5%
associate-+l-72.4%
+-commutative72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in t around inf 38.9%
Taylor expanded in z around inf 21.1%
flip--21.5%
div-inv21.5%
add-sqr-sqrt21.8%
+-commutative21.8%
add-sqr-sqrt21.5%
associate--l+23.9%
+-commutative23.9%
Applied egg-rr23.9%
+-inverses23.9%
metadata-eval23.9%
*-lft-identity23.9%
+-commutative23.9%
Simplified23.9%
Taylor expanded in y around inf 23.9%
+-commutative23.9%
Simplified23.9%
Final simplification20.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 6e+21) (- (+ 1.0 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x))) (/ 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 <= 6e+21) {
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} 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 <= 6d+21) then
tmp = (1.0d0 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
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 <= 6e+21) {
tmp = (1.0 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} 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 <= 6e+21: tmp = (1.0 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) 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 <= 6e+21) tmp = Float64(Float64(1.0 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); 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 <= 6e+21)
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
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, 6e+21], N[(N[(1.0 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+21}:\\
\;\;\;\;\left(1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 6e21Initial program 95.4%
associate-+l+95.4%
associate-+l+95.4%
+-commutative95.4%
+-commutative95.4%
associate-+l-81.5%
+-commutative81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in t around inf 50.3%
Taylor expanded in z around inf 33.7%
Taylor expanded in x around 0 17.2%
if 6e21 < y Initial program 87.5%
associate-+l+87.5%
associate-+l+87.5%
+-commutative87.5%
+-commutative87.5%
associate-+l-72.4%
+-commutative72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in t around inf 38.9%
Taylor expanded in z around inf 21.1%
flip--21.5%
div-inv21.5%
add-sqr-sqrt21.8%
+-commutative21.8%
add-sqr-sqrt21.5%
associate--l+23.9%
+-commutative23.9%
Applied egg-rr23.9%
+-inverses23.9%
metadata-eval23.9%
*-lft-identity23.9%
+-commutative23.9%
Simplified23.9%
Taylor expanded in y around inf 23.9%
+-commutative23.9%
Simplified23.9%
Final simplification20.5%
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)))))
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)));
}
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)))
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)));
}
[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)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) 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)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 / N[(N[Sqrt[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])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}}
\end{array}
Initial program 91.5%
associate-+l+91.5%
associate-+l+91.5%
+-commutative91.5%
+-commutative91.5%
associate-+l-76.9%
+-commutative76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in t around inf 44.6%
Taylor expanded in z around inf 27.5%
flip--27.7%
div-inv27.7%
add-sqr-sqrt24.0%
+-commutative24.0%
add-sqr-sqrt27.8%
associate--l+29.1%
+-commutative29.1%
Applied egg-rr29.1%
+-inverses29.1%
metadata-eval29.1%
*-lft-identity29.1%
+-commutative29.1%
Simplified29.1%
Taylor expanded in y around inf 18.1%
+-commutative18.1%
Simplified18.1%
Final simplification18.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.5%
associate-+l+91.5%
associate-+l+91.5%
+-commutative91.5%
+-commutative91.5%
associate-+l-76.9%
+-commutative76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in t around inf 44.6%
Taylor expanded in z around inf 27.5%
Taylor expanded in y around inf 15.9%
Final simplification15.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* x (+ 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x * (0.5 + sqrt((1.0 / 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 = x * (0.5d0 + sqrt((1.0d0 / x)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x * (0.5 + Math.sqrt((1.0 / x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x * (0.5 + math.sqrt((1.0 / x)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x * Float64(0.5 + sqrt(Float64(1.0 / x)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x * (0.5 + sqrt((1.0 / x)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x * N[(0.5 + N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
x \cdot \left(0.5 + \sqrt{\frac{1}{x}}\right)
\end{array}
Initial program 91.5%
associate-+l+91.5%
associate-+l+91.5%
+-commutative91.5%
+-commutative91.5%
associate-+l-76.9%
+-commutative76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in t around inf 44.6%
Taylor expanded in x around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in x around inf 3.5%
Taylor expanded in x around -inf 0.0%
cancel-sign-sub-inv0.0%
unpow20.0%
rem-square-sqrt6.1%
distribute-lft-neg-in6.1%
distribute-rgt-neg-in6.1%
metadata-eval6.1%
*-rgt-identity6.1%
Simplified6.1%
Final simplification6.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (* x 0.5) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (x * 0.5) - 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 = (x * 0.5d0) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (x * 0.5) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (x * 0.5) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(x * 0.5) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (x * 0.5) - 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[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
x \cdot 0.5 - \sqrt{x}
\end{array}
Initial program 91.5%
associate-+l+91.5%
associate-+l+91.5%
+-commutative91.5%
+-commutative91.5%
associate-+l-76.9%
+-commutative76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in t around inf 44.6%
Taylor expanded in x around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in x around inf 3.5%
Taylor expanded in x around 0 3.5%
mul-1-neg3.5%
+-commutative3.5%
*-commutative3.5%
sub-neg3.5%
Simplified3.5%
Final simplification3.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt 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 91.5%
associate-+l+91.5%
associate-+l+91.5%
+-commutative91.5%
+-commutative91.5%
associate-+l-76.9%
+-commutative76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in t around inf 44.6%
Taylor expanded in x around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in x around inf 3.5%
Taylor expanded in x around 0 1.6%
mul-1-neg1.6%
Simplified1.6%
Final simplification1.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 2024079
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 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))))