
(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 25 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 t)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_4 (sqrt (+ 1.0 z))))
(if (<= t_3 5e-5)
(+
(+ (/ 1.0 (+ (sqrt x) t_2)) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_4 (sqrt z)) (- t_1 (sqrt t))))
(+
(+ (- t_2 (sqrt x)) t_3)
(+ (/ 1.0 (+ t_4 (sqrt z))) (/ 1.0 (+ t_1 (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 + t));
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((y + 1.0)) - sqrt(y);
double t_4 = sqrt((1.0 + z));
double tmp;
if (t_3 <= 5e-5) {
tmp = ((1.0 / (sqrt(x) + t_2)) + (0.5 * sqrt((1.0 / y)))) + ((t_4 - sqrt(z)) + (t_1 - sqrt(t)));
} else {
tmp = ((t_2 - sqrt(x)) + t_3) + ((1.0 / (t_4 + sqrt(z))) + (1.0 / (t_1 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((y + 1.0d0)) - sqrt(y)
t_4 = sqrt((1.0d0 + z))
if (t_3 <= 5d-5) then
tmp = ((1.0d0 / (sqrt(x) + t_2)) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_4 - sqrt(z)) + (t_1 - sqrt(t)))
else
tmp = ((t_2 - sqrt(x)) + t_3) + ((1.0d0 / (t_4 + sqrt(z))) + (1.0d0 / (t_1 + 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 + t));
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 + z));
double tmp;
if (t_3 <= 5e-5) {
tmp = ((1.0 / (Math.sqrt(x) + t_2)) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_4 - Math.sqrt(z)) + (t_1 - Math.sqrt(t)));
} else {
tmp = ((t_2 - Math.sqrt(x)) + t_3) + ((1.0 / (t_4 + Math.sqrt(z))) + (1.0 / (t_1 + 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 + t)) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((y + 1.0)) - math.sqrt(y) t_4 = math.sqrt((1.0 + z)) tmp = 0 if t_3 <= 5e-5: tmp = ((1.0 / (math.sqrt(x) + t_2)) + (0.5 * math.sqrt((1.0 / y)))) + ((t_4 - math.sqrt(z)) + (t_1 - math.sqrt(t))) else: tmp = ((t_2 - math.sqrt(x)) + t_3) + ((1.0 / (t_4 + math.sqrt(z))) + (1.0 / (t_1 + 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 + t)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_4 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t_3 <= 5e-5) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_4 - sqrt(z)) + Float64(t_1 - sqrt(t)))); else tmp = Float64(Float64(Float64(t_2 - sqrt(x)) + t_3) + Float64(Float64(1.0 / Float64(t_4 + sqrt(z))) + Float64(1.0 / Float64(t_1 + 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 + t));
t_2 = sqrt((1.0 + x));
t_3 = sqrt((y + 1.0)) - sqrt(y);
t_4 = sqrt((1.0 + z));
tmp = 0.0;
if (t_3 <= 5e-5)
tmp = ((1.0 / (sqrt(x) + t_2)) + (0.5 * sqrt((1.0 / y)))) + ((t_4 - sqrt(z)) + (t_1 - sqrt(t)));
else
tmp = ((t_2 - sqrt(x)) + t_3) + ((1.0 / (t_4 + sqrt(z))) + (1.0 / (t_1 + 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 + t), $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[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 5e-5], N[(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$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] + N[(N[(1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + 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 + t}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{y + 1} - \sqrt{y}\\
t_4 := \sqrt{1 + z}\\
\mathbf{if}\;t\_3 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + t\_2} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_4 - \sqrt{z}\right) + \left(t\_1 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{x}\right) + t\_3\right) + \left(\frac{1}{t\_4 + \sqrt{z}} + \frac{1}{t\_1 + \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.5%
associate-+l+86.5%
sub-neg86.5%
sub-neg86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
Simplified86.5%
flip--86.5%
div-inv86.5%
add-sqr-sqrt67.8%
+-commutative67.8%
add-sqr-sqrt87.4%
+-commutative87.4%
Applied egg-rr87.4%
associate--l+90.0%
+-inverses90.0%
metadata-eval90.0%
*-lft-identity90.0%
+-commutative90.0%
Simplified90.0%
Taylor expanded in y around inf 93.3%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial 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-sqrt75.2%
+-commutative75.2%
add-sqr-sqrt97.3%
associate--l+97.3%
Applied egg-rr97.3%
associate-*r/97.3%
*-rgt-identity97.3%
associate-+r-97.3%
+-commutative97.3%
associate-+r-97.7%
+-inverses97.7%
metadata-eval97.7%
+-commutative97.7%
Simplified97.7%
flip--97.7%
div-inv97.7%
add-sqr-sqrt76.6%
add-sqr-sqrt98.6%
associate--l+98.8%
Applied egg-rr98.8%
+-inverses98.8%
metadata-eval98.8%
*-lft-identity98.8%
+-commutative98.8%
Simplified98.8%
Final simplification96.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_1 5e-5)
(+
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_2 (sqrt z)) t_3))
(+ (+ t_1 (- 1.0 (sqrt x))) (+ t_3 (/ 1.0 (+ t_2 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_1 <= 5e-5) {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
} else {
tmp = (t_1 + (1.0 - sqrt(x))) + (t_3 + (1.0 / (t_2 + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_1 <= 5d-5) then
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_2 - sqrt(z)) + t_3)
else
tmp = (t_1 + (1.0d0 - sqrt(x))) + (t_3 + (1.0d0 / (t_2 + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_1 <= 5e-5) {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_2 - Math.sqrt(z)) + t_3);
} else {
tmp = (t_1 + (1.0 - Math.sqrt(x))) + (t_3 + (1.0 / (t_2 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_1 <= 5e-5: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / y)))) + ((t_2 - math.sqrt(z)) + t_3) else: tmp = (t_1 + (1.0 - math.sqrt(x))) + (t_3 + (1.0 / (t_2 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_1 <= 5e-5) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_2 - sqrt(z)) + t_3)); else tmp = Float64(Float64(t_1 + Float64(1.0 - sqrt(x))) + Float64(t_3 + Float64(1.0 / Float64(t_2 + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_1 <= 5e-5)
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
else
tmp = (t_1 + (1.0 - sqrt(x))) + (t_3 + (1.0 / (t_2 + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-5], N[(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] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_2 - \sqrt{z}\right) + t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \left(1 - \sqrt{x}\right)\right) + \left(t\_3 + \frac{1}{t\_2 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000024e-5Initial program 86.5%
associate-+l+86.5%
sub-neg86.5%
sub-neg86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
Simplified86.5%
flip--86.5%
div-inv86.5%
add-sqr-sqrt67.8%
+-commutative67.8%
add-sqr-sqrt87.4%
+-commutative87.4%
Applied egg-rr87.4%
associate--l+90.0%
+-inverses90.0%
metadata-eval90.0%
*-lft-identity90.0%
+-commutative90.0%
Simplified90.0%
Taylor expanded in y around inf 93.3%
if 5.00000000000000024e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 48.2%
flip--48.2%
div-inv48.2%
add-sqr-sqrt36.6%
add-sqr-sqrt48.4%
associate--l+48.4%
Applied egg-rr48.4%
+-inverses48.4%
metadata-eval48.4%
*-lft-identity48.4%
+-commutative48.4%
Simplified48.4%
Final simplification68.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= (- (sqrt (+ 1.0 x)) (sqrt x)) 5e-6)
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x))))
(+ (- t_1 (sqrt z)) (* 0.5 (sqrt (/ 1.0 t)))))
(+
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_1 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 5e-6) {
tmp = ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x)))) + ((t_1 - sqrt(z)) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if ((sqrt((1.0d0 + x)) - sqrt(x)) <= 5d-6) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x)))) + ((t_1 - sqrt(z)) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_1 + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if ((Math.sqrt((1.0 + x)) - Math.sqrt(x)) <= 5e-6) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x)))) + ((t_1 - Math.sqrt(z)) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_1 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if (math.sqrt((1.0 + x)) - math.sqrt(x)) <= 5e-6: tmp = ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) + ((t_1 - math.sqrt(z)) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_1 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) <= 5e-6) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x)))) + Float64(Float64(t_1 - sqrt(z)) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_1 + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 5e-6)
tmp = ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x)))) + ((t_1 - sqrt(z)) + (0.5 * sqrt((1.0 / t))));
else
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 5e-6], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $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 + z}\\
\mathbf{if}\;\sqrt{1 + x} - \sqrt{x} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right) + \left(\left(t\_1 - \sqrt{z}\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 5.00000000000000041e-6Initial program 88.3%
associate-+l+88.3%
sub-neg88.3%
sub-neg88.3%
+-commutative88.3%
+-commutative88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in t around inf 39.6%
Taylor expanded in x around inf 41.9%
Taylor expanded in y around inf 27.3%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 92.5%
flip--92.5%
div-inv92.5%
add-sqr-sqrt68.5%
add-sqr-sqrt93.0%
associate--l+93.3%
Applied egg-rr93.3%
+-inverses93.3%
metadata-eval93.3%
*-lft-identity93.3%
+-commutative93.3%
Simplified93.3%
Final simplification58.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= (- (sqrt (+ 1.0 x)) (sqrt x)) 5e-6)
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x))))
(+ t_1 (* 0.5 (sqrt (/ 1.0 t)))))
(+
(+ t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 5e-6) {
tmp = ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x)))) + (t_1 + (0.5 * sqrt((1.0 / t))));
} else {
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if ((sqrt((1.0d0 + x)) - sqrt(x)) <= 5d-6) then
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x)))) + (t_1 + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = (t_1 + (sqrt((1.0d0 + t)) - sqrt(t))) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if ((Math.sqrt((1.0 + x)) - Math.sqrt(x)) <= 5e-6) {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x)))) + (t_1 + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = (t_1 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if (math.sqrt((1.0 + x)) - math.sqrt(x)) <= 5e-6: tmp = ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) + (t_1 + (0.5 * math.sqrt((1.0 / t)))) else: tmp = (t_1 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x))) 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)) tmp = 0.0 if (Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) <= 5e-6) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x)))) + Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if ((sqrt((1.0 + x)) - sqrt(x)) <= 5e-6)
tmp = ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x)))) + (t_1 + (0.5 * sqrt((1.0 / t))));
else
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 5e-6], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;\sqrt{1 + x} - \sqrt{x} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right) + \left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 5.00000000000000041e-6Initial program 88.3%
associate-+l+88.3%
sub-neg88.3%
sub-neg88.3%
+-commutative88.3%
+-commutative88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in t around inf 39.6%
Taylor expanded in x around inf 41.9%
Taylor expanded in y around inf 27.3%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.6%
associate-+l+96.6%
sub-neg96.6%
sub-neg96.6%
+-commutative96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 92.5%
Final simplification58.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 t))))
(if (<= z 24000000.0)
(-
(+ (/ 1.0 (+ t_1 (sqrt t))) (+ (sqrt (+ 1.0 z)) 2.0))
(+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0)))))
(+ (- t_1 (sqrt t)) (* 0.5 (sqrt (/ 1.0 z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double tmp;
if (z <= 24000000.0) {
tmp = ((1.0 / (t_1 + sqrt(t))) + (sqrt((1.0 + z)) + 2.0)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + ((t_1 - sqrt(t)) + (0.5 * sqrt((1.0 / z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
if (z <= 24000000.0d0) then
tmp = ((1.0d0 / (t_1 + sqrt(t))) + (sqrt((1.0d0 + z)) + 2.0d0)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = ((1.0d0 - sqrt(x)) + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0))))) + ((t_1 - sqrt(t)) + (0.5d0 * sqrt((1.0d0 / z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double tmp;
if (z <= 24000000.0) {
tmp = ((1.0 / (t_1 + Math.sqrt(t))) + (Math.sqrt((1.0 + z)) + 2.0)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = ((1.0 - Math.sqrt(x)) + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0))))) + ((t_1 - Math.sqrt(t)) + (0.5 * Math.sqrt((1.0 / z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) tmp = 0 if z <= 24000000.0: tmp = ((1.0 / (t_1 + math.sqrt(t))) + (math.sqrt((1.0 + z)) + 2.0)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = ((1.0 - math.sqrt(x)) + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) + ((t_1 - math.sqrt(t)) + (0.5 * math.sqrt((1.0 / z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (z <= 24000000.0) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(t))) + Float64(sqrt(Float64(1.0 + z)) + 2.0)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0))))) + Float64(Float64(t_1 - sqrt(t)) + Float64(0.5 * sqrt(Float64(1.0 / z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
tmp = 0.0;
if (z <= 24000000.0)
tmp = ((1.0 / (t_1 + sqrt(t))) + (sqrt((1.0 + z)) + 2.0)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = ((1.0 - sqrt(x)) + (1.0 / (sqrt(y) + sqrt((y + 1.0))))) + ((t_1 - sqrt(t)) + (0.5 * sqrt((1.0 / z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 24000000.0], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - 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[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $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 + t}\\
\mathbf{if}\;z \leq 24000000:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{t}} + \left(\sqrt{1 + z} + 2\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right) + \left(\left(t\_1 - \sqrt{t}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if z < 2.4e7Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.2%
div-inv97.2%
add-sqr-sqrt72.7%
+-commutative72.7%
add-sqr-sqrt97.4%
associate--l+97.4%
Applied egg-rr97.4%
associate-*r/97.4%
*-rgt-identity97.4%
associate-+r-97.4%
+-commutative97.4%
associate-+r-97.8%
+-inverses97.8%
metadata-eval97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in y around 0 51.5%
Taylor expanded in x around 0 26.4%
associate-+r+26.4%
+-commutative26.4%
+-commutative26.4%
Simplified26.4%
if 2.4e7 < z Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in x around 0 45.2%
flip--45.2%
div-inv45.2%
add-sqr-sqrt38.1%
add-sqr-sqrt45.3%
associate--l+45.3%
Applied egg-rr45.3%
+-inverses45.3%
metadata-eval45.3%
*-lft-identity45.3%
+-commutative45.3%
Simplified45.3%
Taylor expanded in z around inf 46.2%
Final simplification34.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 z)) (sqrt z))))
(if (<= x 3.6)
(+
(+ t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ (- 1.0 (sqrt x)) (/ 1.0 (+ 1.0 (sqrt y)))))
(+
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (sqrt (/ 1.0 x))))
(+ t_1 (* 0.5 (sqrt (/ 1.0 t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (x <= 3.6) {
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 - sqrt(x)) + (1.0 / (1.0 + sqrt(y))));
} else {
tmp = ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x)))) + (t_1 + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (x <= 3.6d0) then
tmp = (t_1 + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 - sqrt(x)) + (1.0d0 / (1.0d0 + sqrt(y))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * sqrt((1.0d0 / x)))) + (t_1 + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (x <= 3.6) {
tmp = (t_1 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 - Math.sqrt(x)) + (1.0 / (1.0 + Math.sqrt(y))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * Math.sqrt((1.0 / x)))) + (t_1 + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if x <= 3.6: tmp = (t_1 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 - math.sqrt(x)) + (1.0 / (1.0 + math.sqrt(y)))) else: tmp = ((0.5 * math.sqrt((1.0 / y))) + (0.5 * math.sqrt((1.0 / x)))) + (t_1 + (0.5 * math.sqrt((1.0 / t)))) 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)) tmp = 0.0 if (x <= 3.6) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 / Float64(1.0 + sqrt(y))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * sqrt(Float64(1.0 / x)))) + Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (x <= 3.6)
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 - sqrt(x)) + (1.0 / (1.0 + sqrt(y))));
else
tmp = ((0.5 * sqrt((1.0 / y))) + (0.5 * sqrt((1.0 / x)))) + (t_1 + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.6], N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(1.0 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / 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 + z} - \sqrt{z}\\
\mathbf{if}\;x \leq 3.6:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 - \sqrt{x}\right) + \frac{1}{1 + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right) + \left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if x < 3.60000000000000009Initial program 96.7%
associate-+l+96.7%
sub-neg96.7%
sub-neg96.7%
+-commutative96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in x around 0 94.8%
flip--95.1%
div-inv95.1%
add-sqr-sqrt82.7%
add-sqr-sqrt95.8%
associate--l+96.1%
Applied egg-rr96.1%
+-inverses96.1%
metadata-eval96.1%
*-lft-identity96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in y around 0 91.2%
if 3.60000000000000009 < x Initial program 88.4%
associate-+l+88.4%
sub-neg88.4%
sub-neg88.4%
+-commutative88.4%
+-commutative88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in t around inf 39.5%
Taylor expanded in x around inf 41.7%
Taylor expanded in y around inf 26.9%
Final simplification56.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 t))))
(if (<= z 24000000.0)
(-
(+ (/ 1.0 (+ t_1 (sqrt t))) (+ (sqrt (+ 1.0 z)) 2.0))
(+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- 1.0 (sqrt x)))
(+ (- t_1 (sqrt t)) (* 0.5 (sqrt (/ 1.0 z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double tmp;
if (z <= 24000000.0) {
tmp = ((1.0 / (t_1 + sqrt(t))) + (sqrt((1.0 + z)) + 2.0)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))) + ((t_1 - sqrt(t)) + (0.5 * sqrt((1.0 / z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
if (z <= 24000000.0d0) then
tmp = ((1.0d0 / (t_1 + sqrt(t))) + (sqrt((1.0d0 + z)) + 2.0d0)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 - sqrt(x))) + ((t_1 - sqrt(t)) + (0.5d0 * sqrt((1.0d0 / z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double tmp;
if (z <= 24000000.0) {
tmp = ((1.0 / (t_1 + Math.sqrt(t))) + (Math.sqrt((1.0 + z)) + 2.0)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 - Math.sqrt(x))) + ((t_1 - Math.sqrt(t)) + (0.5 * Math.sqrt((1.0 / z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) tmp = 0 if z <= 24000000.0: tmp = ((1.0 / (t_1 + math.sqrt(t))) + (math.sqrt((1.0 + z)) + 2.0)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 - math.sqrt(x))) + ((t_1 - math.sqrt(t)) + (0.5 * math.sqrt((1.0 / z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (z <= 24000000.0) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(t))) + Float64(sqrt(Float64(1.0 + z)) + 2.0)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 - sqrt(x))) + Float64(Float64(t_1 - sqrt(t)) + Float64(0.5 * sqrt(Float64(1.0 / z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
tmp = 0.0;
if (z <= 24000000.0)
tmp = ((1.0 / (t_1 + sqrt(t))) + (sqrt((1.0 + z)) + 2.0)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 - sqrt(x))) + ((t_1 - sqrt(t)) + (0.5 * sqrt((1.0 / z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 24000000.0], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $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 + t}\\
\mathbf{if}\;z \leq 24000000:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{t}} + \left(\sqrt{1 + z} + 2\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(1 - \sqrt{x}\right)\right) + \left(\left(t\_1 - \sqrt{t}\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\right)\\
\end{array}
\end{array}
if z < 2.4e7Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.2%
div-inv97.2%
add-sqr-sqrt72.7%
+-commutative72.7%
add-sqr-sqrt97.4%
associate--l+97.4%
Applied egg-rr97.4%
associate-*r/97.4%
*-rgt-identity97.4%
associate-+r-97.4%
+-commutative97.4%
associate-+r-97.8%
+-inverses97.8%
metadata-eval97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in y around 0 51.5%
Taylor expanded in x around 0 26.4%
associate-+r+26.4%
+-commutative26.4%
+-commutative26.4%
Simplified26.4%
if 2.4e7 < z Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in x around 0 45.2%
Taylor expanded in z around inf 46.0%
Final simplification34.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (sqrt x)))
(t_2 (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
(if (<= y 0.46)
(+ t_2 (+ t_1 (- 1.0 (sqrt y))))
(+ t_2 (+ (* 0.5 (sqrt (/ 1.0 y))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - sqrt(x);
double t_2 = (sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t));
double tmp;
if (y <= 0.46) {
tmp = t_2 + (t_1 + (1.0 - sqrt(y)));
} else {
tmp = t_2 + ((0.5 * sqrt((1.0 / y))) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - sqrt(x)
t_2 = (sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))
if (y <= 0.46d0) then
tmp = t_2 + (t_1 + (1.0d0 - sqrt(y)))
else
tmp = t_2 + ((0.5d0 * sqrt((1.0d0 / y))) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - Math.sqrt(x);
double t_2 = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t));
double tmp;
if (y <= 0.46) {
tmp = t_2 + (t_1 + (1.0 - Math.sqrt(y)));
} else {
tmp = t_2 + ((0.5 * Math.sqrt((1.0 / y))) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 - math.sqrt(x) t_2 = (math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)) tmp = 0 if y <= 0.46: tmp = t_2 + (t_1 + (1.0 - math.sqrt(y))) else: tmp = t_2 + ((0.5 * math.sqrt((1.0 / y))) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) tmp = 0.0 if (y <= 0.46) tmp = Float64(t_2 + Float64(t_1 + Float64(1.0 - sqrt(y)))); else tmp = Float64(t_2 + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 - sqrt(x);
t_2 = (sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t));
tmp = 0.0;
if (y <= 0.46)
tmp = t_2 + (t_1 + (1.0 - sqrt(y)));
else
tmp = t_2 + ((0.5 * sqrt((1.0 / y))) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.46], N[(t$95$2 + N[(t$95$1 + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 1 - \sqrt{x}\\
t_2 := \left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\\
\mathbf{if}\;y \leq 0.46:\\
\;\;\;\;t\_2 + \left(t\_1 + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_1\right)\\
\end{array}
\end{array}
if y < 0.46000000000000002Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 47.4%
Taylor expanded in y around 0 46.5%
if 0.46000000000000002 < y Initial program 86.8%
associate-+l+86.8%
sub-neg86.8%
sub-neg86.8%
+-commutative86.8%
+-commutative86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in x around 0 41.1%
Taylor expanded in y around inf 41.2%
Final simplification44.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 t))) (t_2 (sqrt (+ 1.0 z))))
(if (<= y 3.5e-10)
(+
(+ (- t_2 (sqrt z)) (- t_1 (sqrt t)))
(+ (- 1.0 (sqrt x)) (- 1.0 (sqrt y))))
(if (<= y 8.5e+19)
(+
(sqrt (+ y 1.0))
(-
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 z))))
(sqrt y)))
(+ 1.0 (- (+ t_2 t_1) (+ (sqrt t) (+ (sqrt x) (sqrt z)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t));
double t_2 = sqrt((1.0 + z));
double tmp;
if (y <= 3.5e-10) {
tmp = ((t_2 - sqrt(z)) + (t_1 - sqrt(t))) + ((1.0 - sqrt(x)) + (1.0 - sqrt(y)));
} else if (y <= 8.5e+19) {
tmp = sqrt((y + 1.0)) + (((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / z)))) - sqrt(y));
} else {
tmp = 1.0 + ((t_2 + t_1) - (sqrt(t) + (sqrt(x) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + t))
t_2 = sqrt((1.0d0 + z))
if (y <= 3.5d-10) then
tmp = ((t_2 - sqrt(z)) + (t_1 - sqrt(t))) + ((1.0d0 - sqrt(x)) + (1.0d0 - sqrt(y)))
else if (y <= 8.5d+19) then
tmp = sqrt((y + 1.0d0)) + (((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / z)))) - sqrt(y))
else
tmp = 1.0d0 + ((t_2 + t_1) - (sqrt(t) + (sqrt(x) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t));
double t_2 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 3.5e-10) {
tmp = ((t_2 - Math.sqrt(z)) + (t_1 - Math.sqrt(t))) + ((1.0 - Math.sqrt(x)) + (1.0 - Math.sqrt(y)));
} else if (y <= 8.5e+19) {
tmp = Math.sqrt((y + 1.0)) + (((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / z)))) - Math.sqrt(y));
} else {
tmp = 1.0 + ((t_2 + t_1) - (Math.sqrt(t) + (Math.sqrt(x) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) t_2 = math.sqrt((1.0 + z)) tmp = 0 if y <= 3.5e-10: tmp = ((t_2 - math.sqrt(z)) + (t_1 - math.sqrt(t))) + ((1.0 - math.sqrt(x)) + (1.0 - math.sqrt(y))) elif y <= 8.5e+19: tmp = math.sqrt((y + 1.0)) + (((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / z)))) - math.sqrt(y)) else: tmp = 1.0 + ((t_2 + t_1) - (math.sqrt(t) + (math.sqrt(x) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + t)) t_2 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 3.5e-10) tmp = Float64(Float64(Float64(t_2 - sqrt(z)) + Float64(t_1 - sqrt(t))) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 - sqrt(y)))); elseif (y <= 8.5e+19) tmp = Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - sqrt(y))); else tmp = Float64(1.0 + Float64(Float64(t_2 + t_1) - Float64(sqrt(t) + Float64(sqrt(x) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t));
t_2 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 3.5e-10)
tmp = ((t_2 - sqrt(z)) + (t_1 - sqrt(t))) + ((1.0 - sqrt(x)) + (1.0 - sqrt(y)));
elseif (y <= 8.5e+19)
tmp = sqrt((y + 1.0)) + (((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / z)))) - sqrt(y));
else
tmp = 1.0 + ((t_2 + t_1) - (sqrt(t) + (sqrt(x) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.5e-10], N[(N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e+19], N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(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 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$2 + t$95$1), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $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 + t}\\
t_2 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 3.5 \cdot 10^{-10}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{z}\right) + \left(t\_1 - \sqrt{t}\right)\right) + \left(\left(1 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+19}:\\
\;\;\;\;\sqrt{y + 1} + \left(\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_2 + t\_1\right) - \left(\sqrt{t} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if y < 3.4999999999999998e-10Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 46.7%
Taylor expanded in y around 0 46.5%
if 3.4999999999999998e-10 < y < 8.5e19Initial program 85.9%
associate-+l+85.9%
sub-neg85.9%
sub-neg85.9%
+-commutative85.9%
+-commutative85.9%
+-commutative85.9%
Simplified85.9%
flip--85.9%
div-inv85.9%
add-sqr-sqrt68.6%
+-commutative68.6%
add-sqr-sqrt85.9%
+-commutative85.9%
Applied egg-rr85.9%
associate--l+85.8%
+-inverses85.8%
metadata-eval85.8%
*-lft-identity85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in t around inf 37.3%
associate--l+40.1%
associate--l+40.1%
Simplified40.1%
Taylor expanded in z around inf 21.3%
if 8.5e19 < y Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in x around 0 39.7%
Taylor expanded in y around inf 14.7%
associate--l+36.0%
Simplified36.0%
Final simplification40.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= y 1.45e-7)
(+ (- t_1 (sqrt z)) (+ (- 1.0 (sqrt x)) (+ 1.0 (- (* y 0.5) (sqrt y)))))
(if (<= y 8.5e+19)
(+
(sqrt (+ y 1.0))
(-
(+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (* 0.5 (sqrt (/ 1.0 z))))
(sqrt y)))
(+
1.0
(- (+ t_1 (sqrt (+ 1.0 t))) (+ (sqrt t) (+ (sqrt x) (sqrt z)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (y <= 1.45e-7) {
tmp = (t_1 - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
} else if (y <= 8.5e+19) {
tmp = sqrt((y + 1.0)) + (((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / z)))) - sqrt(y));
} else {
tmp = 1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(t) + (sqrt(x) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (y <= 1.45d-7) then
tmp = (t_1 - sqrt(z)) + ((1.0d0 - sqrt(x)) + (1.0d0 + ((y * 0.5d0) - sqrt(y))))
else if (y <= 8.5d+19) then
tmp = sqrt((y + 1.0d0)) + (((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * sqrt((1.0d0 / z)))) - sqrt(y))
else
tmp = 1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - (sqrt(t) + (sqrt(x) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 1.45e-7) {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (1.0 + ((y * 0.5) - Math.sqrt(y))));
} else if (y <= 8.5e+19) {
tmp = Math.sqrt((y + 1.0)) + (((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * Math.sqrt((1.0 / z)))) - Math.sqrt(y));
} else {
tmp = 1.0 + ((t_1 + Math.sqrt((1.0 + t))) - (Math.sqrt(t) + (Math.sqrt(x) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if y <= 1.45e-7: tmp = (t_1 - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (1.0 + ((y * 0.5) - math.sqrt(y)))) elif y <= 8.5e+19: tmp = math.sqrt((y + 1.0)) + (((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * math.sqrt((1.0 / z)))) - math.sqrt(y)) else: tmp = 1.0 + ((t_1 + math.sqrt((1.0 + t))) - (math.sqrt(t) + (math.sqrt(x) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 1.45e-7) tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 + Float64(Float64(y * 0.5) - sqrt(y))))); elseif (y <= 8.5e+19) tmp = Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - sqrt(y))); else tmp = Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - Float64(sqrt(t) + Float64(sqrt(x) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 1.45e-7)
tmp = (t_1 - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
elseif (y <= 8.5e+19)
tmp = sqrt((y + 1.0)) + (((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * sqrt((1.0 / z)))) - sqrt(y));
else
tmp = 1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(t) + (sqrt(x) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.45e-7], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e+19], N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(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 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $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 + z}\\
\mathbf{if}\;y \leq 1.45 \cdot 10^{-7}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(1 + \left(y \cdot 0.5 - \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+19}:\\
\;\;\;\;\sqrt{y + 1} + \left(\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + \sqrt{1 + t}\right) - \left(\sqrt{t} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if y < 1.4499999999999999e-7Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 46.7%
Taylor expanded in y around 0 46.7%
associate--l+46.7%
Simplified46.7%
Taylor expanded in t around inf 26.3%
if 1.4499999999999999e-7 < y < 8.5e19Initial program 85.9%
associate-+l+85.9%
sub-neg85.9%
sub-neg85.9%
+-commutative85.9%
+-commutative85.9%
+-commutative85.9%
Simplified85.9%
flip--85.9%
div-inv85.9%
add-sqr-sqrt68.6%
+-commutative68.6%
add-sqr-sqrt85.9%
+-commutative85.9%
Applied egg-rr85.9%
associate--l+85.8%
+-inverses85.8%
metadata-eval85.8%
*-lft-identity85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in t around inf 37.3%
associate--l+40.1%
associate--l+40.1%
Simplified40.1%
Taylor expanded in z around inf 21.3%
if 8.5e19 < y Initial program 87.2%
associate-+l+87.2%
sub-neg87.2%
sub-neg87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in x around 0 39.7%
Taylor expanded in y around inf 14.7%
associate--l+36.0%
Simplified36.0%
Final simplification30.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= y 2.65)
(+ (- t_1 (sqrt z)) (+ (- 1.0 (sqrt x)) (+ 1.0 (- (* y 0.5) (sqrt y)))))
(+ 1.0 (- (+ t_1 (sqrt (+ 1.0 t))) (+ (sqrt t) (+ (sqrt x) (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (y <= 2.65) {
tmp = (t_1 - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
} else {
tmp = 1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(t) + (sqrt(x) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (y <= 2.65d0) then
tmp = (t_1 - sqrt(z)) + ((1.0d0 - sqrt(x)) + (1.0d0 + ((y * 0.5d0) - sqrt(y))))
else
tmp = 1.0d0 + ((t_1 + sqrt((1.0d0 + t))) - (sqrt(t) + (sqrt(x) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 2.65) {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (1.0 + ((y * 0.5) - Math.sqrt(y))));
} else {
tmp = 1.0 + ((t_1 + Math.sqrt((1.0 + t))) - (Math.sqrt(t) + (Math.sqrt(x) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if y <= 2.65: tmp = (t_1 - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (1.0 + ((y * 0.5) - math.sqrt(y)))) else: tmp = 1.0 + ((t_1 + math.sqrt((1.0 + t))) - (math.sqrt(t) + (math.sqrt(x) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 2.65) tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 + Float64(Float64(y * 0.5) - sqrt(y))))); else tmp = Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) - Float64(sqrt(t) + Float64(sqrt(x) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 2.65)
tmp = (t_1 - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
else
tmp = 1.0 + ((t_1 + sqrt((1.0 + t))) - (sqrt(t) + (sqrt(x) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.65], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $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 + z}\\
\mathbf{if}\;y \leq 2.65:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(1 + \left(y \cdot 0.5 - \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + \sqrt{1 + t}\right) - \left(\sqrt{t} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if y < 2.64999999999999991Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 47.4%
Taylor expanded in y around 0 47.1%
associate--l+47.1%
Simplified47.1%
Taylor expanded in t around inf 27.1%
if 2.64999999999999991 < y Initial program 86.8%
associate-+l+86.8%
sub-neg86.8%
sub-neg86.8%
+-commutative86.8%
+-commutative86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in x around 0 41.1%
Taylor expanded in y around inf 14.3%
associate--l+34.2%
Simplified34.2%
Final simplification30.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 0.00029)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- 1.0 (sqrt x)) (+ 1.0 (- (* y 0.5) (sqrt y)))))
(if (<= y 1.05e+32)
(- (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (sqrt (+ y 1.0))) (sqrt y))
(+
2.0
(- (+ (sqrt (+ 1.0 t)) (* y 0.5)) (+ (sqrt t) (+ (sqrt y) (sqrt x))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.00029) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
} else if (y <= 1.05e+32) {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + sqrt((y + 1.0))) - sqrt(y);
} else {
tmp = 2.0 + ((sqrt((1.0 + t)) + (y * 0.5)) - (sqrt(t) + (sqrt(y) + sqrt(x))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.00029d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (1.0d0 + ((y * 0.5d0) - sqrt(y))))
else if (y <= 1.05d+32) then
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + sqrt((y + 1.0d0))) - sqrt(y)
else
tmp = 2.0d0 + ((sqrt((1.0d0 + t)) + (y * 0.5d0)) - (sqrt(t) + (sqrt(y) + sqrt(x))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.00029) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (1.0 + ((y * 0.5) - Math.sqrt(y))));
} else if (y <= 1.05e+32) {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + Math.sqrt((y + 1.0))) - Math.sqrt(y);
} else {
tmp = 2.0 + ((Math.sqrt((1.0 + t)) + (y * 0.5)) - (Math.sqrt(t) + (Math.sqrt(y) + Math.sqrt(x))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.00029: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (1.0 + ((y * 0.5) - math.sqrt(y)))) elif y <= 1.05e+32: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + math.sqrt((y + 1.0))) - math.sqrt(y) else: tmp = 2.0 + ((math.sqrt((1.0 + t)) + (y * 0.5)) - (math.sqrt(t) + (math.sqrt(y) + math.sqrt(x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.00029) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 + Float64(Float64(y * 0.5) - sqrt(y))))); elseif (y <= 1.05e+32) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + sqrt(Float64(y + 1.0))) - sqrt(y)); else tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + t)) + Float64(y * 0.5)) - Float64(sqrt(t) + Float64(sqrt(y) + sqrt(x))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.00029)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (1.0 + ((y * 0.5) - sqrt(y))));
elseif (y <= 1.05e+32)
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + sqrt((y + 1.0))) - sqrt(y);
else
tmp = 2.0 + ((sqrt((1.0 + t)) + (y * 0.5)) - (sqrt(t) + (sqrt(y) + sqrt(x))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.00029], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+32], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.00029:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(1 + \left(y \cdot 0.5 - \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+32}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \sqrt{y + 1}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + t} + y \cdot 0.5\right) - \left(\sqrt{t} + \left(\sqrt{y} + \sqrt{x}\right)\right)\right)\\
\end{array}
\end{array}
if y < 2.9e-4Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 47.4%
Taylor expanded in y around 0 47.1%
associate--l+47.1%
Simplified47.1%
Taylor expanded in t around inf 27.1%
if 2.9e-4 < y < 1.05e32Initial program 80.1%
associate-+l+80.1%
sub-neg80.1%
sub-neg80.1%
+-commutative80.1%
+-commutative80.1%
+-commutative80.1%
Simplified80.1%
flip--80.1%
div-inv80.1%
add-sqr-sqrt60.8%
+-commutative60.8%
add-sqr-sqrt80.1%
+-commutative80.1%
Applied egg-rr80.1%
associate--l+80.5%
+-inverses80.5%
metadata-eval80.5%
*-lft-identity80.5%
+-commutative80.5%
Simplified80.5%
Taylor expanded in t around inf 41.0%
associate--l+42.7%
associate--l+42.7%
Simplified42.7%
Taylor expanded in z around inf 20.0%
if 1.05e32 < y Initial program 87.9%
associate-+l+87.9%
sub-neg87.9%
sub-neg87.9%
+-commutative87.9%
+-commutative87.9%
+-commutative87.9%
Simplified87.9%
Taylor expanded in x around 0 39.1%
Taylor expanded in y around 0 4.1%
associate--l+4.1%
Simplified4.1%
Taylor expanded in z around inf 4.0%
associate--l+4.6%
+-commutative4.6%
Simplified4.6%
Final simplification17.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 5.8e+15)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* y 0.5)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(- (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (sqrt (+ y 1.0))) (sqrt y))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5.8e+15) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (y * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + sqrt((y + 1.0))) - sqrt(y);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 5.8d+15) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (y * 0.5d0)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + sqrt((y + 1.0d0))) - sqrt(y)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5.8e+15) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (y * 0.5)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + Math.sqrt((y + 1.0))) - Math.sqrt(y);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 5.8e+15: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (y * 0.5)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + math.sqrt((y + 1.0))) - math.sqrt(y) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 5.8e+15) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(y * 0.5)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + sqrt(Float64(y + 1.0))) - sqrt(y)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 5.8e+15)
tmp = 2.0 + ((sqrt((1.0 + z)) + (y * 0.5)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + sqrt((y + 1.0))) - sqrt(y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 5.8e+15], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.8 \cdot 10^{+15}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + y \cdot 0.5\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \sqrt{y + 1}\right) - \sqrt{y}\\
\end{array}
\end{array}
if z < 5.8e15Initial program 96.0%
associate-+l+96.0%
sub-neg96.0%
sub-neg96.0%
+-commutative96.0%
+-commutative96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in x around 0 43.0%
Taylor expanded in y around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in t around inf 17.4%
associate--l+17.4%
+-commutative17.4%
Simplified17.4%
if 5.8e15 < z Initial program 86.6%
associate-+l+86.6%
sub-neg86.6%
sub-neg86.6%
+-commutative86.6%
+-commutative86.6%
+-commutative86.6%
Simplified86.6%
flip--86.7%
div-inv86.7%
add-sqr-sqrt72.9%
+-commutative72.9%
add-sqr-sqrt87.7%
+-commutative87.7%
Applied egg-rr87.7%
associate--l+90.8%
+-inverses90.8%
metadata-eval90.8%
*-lft-identity90.8%
+-commutative90.8%
Simplified90.8%
Taylor expanded in t around inf 4.3%
associate--l+21.5%
associate--l+21.5%
Simplified21.5%
Taylor expanded in z around inf 31.1%
Final simplification22.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 1.02e+15) (+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (+ (sqrt y) (sqrt x))))) (- (+ (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (sqrt (+ y 1.0))) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.02e+15) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))));
} else {
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + sqrt((y + 1.0))) - sqrt(y);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.02d+15) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))))
else
tmp = ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + sqrt((y + 1.0d0))) - sqrt(y)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.02e+15) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(y) + Math.sqrt(x))));
} else {
tmp = ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + Math.sqrt((y + 1.0))) - Math.sqrt(y);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.02e+15: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(y) + math.sqrt(x)))) else: tmp = ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + math.sqrt((y + 1.0))) - math.sqrt(y) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.02e+15) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(y) + sqrt(x))))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + sqrt(Float64(y + 1.0))) - sqrt(y)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.02e+15)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))));
else
tmp = ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) + sqrt((y + 1.0))) - sqrt(y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.02e+15], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.02 \cdot 10^{+15}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} + \sqrt{y + 1}\right) - \sqrt{y}\\
\end{array}
\end{array}
if z < 1.02e15Initial program 96.5%
associate-+l+96.5%
sub-neg96.5%
sub-neg96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 43.3%
Taylor expanded in y around 0 27.8%
associate--l+27.8%
Simplified27.8%
Taylor expanded in t around inf 17.5%
Taylor expanded in y around 0 15.7%
associate--l+15.7%
associate-+r+15.7%
+-commutative15.7%
Simplified15.7%
if 1.02e15 < z Initial program 86.0%
associate-+l+86.0%
sub-neg86.0%
sub-neg86.0%
+-commutative86.0%
+-commutative86.0%
+-commutative86.0%
Simplified86.0%
flip--86.0%
div-inv86.0%
add-sqr-sqrt72.3%
+-commutative72.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in t around inf 4.3%
associate--l+21.3%
associate--l+21.3%
Simplified21.3%
Taylor expanded in z around inf 30.8%
Final simplification21.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 1.75e+15) (+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (+ (sqrt y) (sqrt x))))) (+ (sqrt (+ y 1.0)) (- (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.75e+15) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))));
} else {
tmp = sqrt((y + 1.0)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.75d+15) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))))
else
tmp = sqrt((y + 1.0d0)) + ((1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.75e+15) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(y) + Math.sqrt(x))));
} else {
tmp = Math.sqrt((y + 1.0)) + ((1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.75e+15: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(y) + math.sqrt(x)))) else: tmp = math.sqrt((y + 1.0)) + ((1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.75e+15) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(y) + sqrt(x))))); else tmp = Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.75e+15)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))));
else
tmp = sqrt((y + 1.0)) + ((1.0 / (sqrt(x) + sqrt((1.0 + x)))) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.75e+15], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.75 \cdot 10^{+15}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y + 1} + \left(\frac{1}{\sqrt{x} + \sqrt{1 + x}} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.75e15Initial program 96.5%
associate-+l+96.5%
sub-neg96.5%
sub-neg96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 43.3%
Taylor expanded in y around 0 27.8%
associate--l+27.8%
Simplified27.8%
Taylor expanded in t around inf 17.5%
Taylor expanded in y around 0 15.7%
associate--l+15.7%
associate-+r+15.7%
+-commutative15.7%
Simplified15.7%
if 1.75e15 < z Initial program 86.0%
associate-+l+86.0%
sub-neg86.0%
sub-neg86.0%
+-commutative86.0%
+-commutative86.0%
+-commutative86.0%
Simplified86.0%
flip--86.0%
div-inv86.0%
add-sqr-sqrt72.3%
+-commutative72.3%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in t around inf 4.3%
associate--l+21.3%
associate--l+21.3%
Simplified21.3%
Taylor expanded in z around inf 30.8%
Final simplification21.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) + 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 = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(y) + sqrt(x))))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(y) + Math.sqrt(x))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(y) + math.sqrt(x))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(y) + sqrt(x))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(y) + 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[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{y} + \sqrt{x}\right)\right)\right)
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in x around 0 44.4%
Taylor expanded in y around 0 26.9%
associate--l+26.9%
Simplified26.9%
Taylor expanded in t around inf 11.8%
Taylor expanded in y around 0 10.3%
associate--l+18.4%
associate-+r+18.4%
+-commutative18.4%
Simplified18.4%
Final simplification18.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 32000000.0) (- (+ 2.0 (+ (sqrt (+ 1.0 z)) (* y 0.5))) (+ (sqrt x) (sqrt z))) (+ 2.0 (- (* 0.5 (+ y (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 32000000.0) {
tmp = (2.0 + (sqrt((1.0 + z)) + (y * 0.5))) - (sqrt(x) + sqrt(z));
} else {
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 32000000.0d0) then
tmp = (2.0d0 + (sqrt((1.0d0 + z)) + (y * 0.5d0))) - (sqrt(x) + sqrt(z))
else
tmp = 2.0d0 + ((0.5d0 * (y + sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 32000000.0) {
tmp = (2.0 + (Math.sqrt((1.0 + z)) + (y * 0.5))) - (Math.sqrt(x) + Math.sqrt(z));
} else {
tmp = 2.0 + ((0.5 * (y + Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 32000000.0: tmp = (2.0 + (math.sqrt((1.0 + z)) + (y * 0.5))) - (math.sqrt(x) + math.sqrt(z)) else: tmp = 2.0 + ((0.5 * (y + math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 32000000.0) tmp = Float64(Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) + Float64(y * 0.5))) - Float64(sqrt(x) + sqrt(z))); else tmp = Float64(2.0 + Float64(Float64(0.5 * Float64(y + sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 32000000.0)
tmp = (2.0 + (sqrt((1.0 + z)) + (y * 0.5))) - (sqrt(x) + sqrt(z));
else
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 32000000.0], N[(N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(0.5 * N[(y + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 32000000:\\
\;\;\;\;\left(2 + \left(\sqrt{1 + z} + y \cdot 0.5\right)\right) - \left(\sqrt{x} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;2 + \left(0.5 \cdot \left(y + \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 3.2e7Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in x around 0 43.9%
Taylor expanded in y around 0 28.0%
associate--l+28.0%
Simplified28.0%
Taylor expanded in t around inf 17.8%
Taylor expanded in z around inf 17.4%
if 3.2e7 < z Initial program 85.4%
associate-+l+85.4%
sub-neg85.4%
sub-neg85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in x around 0 45.2%
Taylor expanded in y around 0 25.2%
associate--l+25.2%
Simplified25.2%
Taylor expanded in t around inf 3.4%
Taylor expanded in z around inf 14.5%
associate--l+14.5%
distribute-lft-out14.5%
+-commutative14.5%
Simplified14.5%
Final simplification16.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 y) (sqrt x))))
(if (<= z 1.0)
(+ 3.0 (- (* 0.5 (+ y z)) (+ (sqrt z) t_1)))
(+ 2.0 (- (* 0.5 (+ y (sqrt (/ 1.0 z)))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(y) + sqrt(x);
double tmp;
if (z <= 1.0) {
tmp = 3.0 + ((0.5 * (y + z)) - (sqrt(z) + t_1));
} else {
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(y) + sqrt(x)
if (z <= 1.0d0) then
tmp = 3.0d0 + ((0.5d0 * (y + z)) - (sqrt(z) + t_1))
else
tmp = 2.0d0 + ((0.5d0 * (y + sqrt((1.0d0 / z)))) - t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(y) + Math.sqrt(x);
double tmp;
if (z <= 1.0) {
tmp = 3.0 + ((0.5 * (y + z)) - (Math.sqrt(z) + t_1));
} else {
tmp = 2.0 + ((0.5 * (y + Math.sqrt((1.0 / z)))) - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(y) + math.sqrt(x) tmp = 0 if z <= 1.0: tmp = 3.0 + ((0.5 * (y + z)) - (math.sqrt(z) + t_1)) else: tmp = 2.0 + ((0.5 * (y + math.sqrt((1.0 / z)))) - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(y) + sqrt(x)) tmp = 0.0 if (z <= 1.0) tmp = Float64(3.0 + Float64(Float64(0.5 * Float64(y + z)) - Float64(sqrt(z) + t_1))); else tmp = Float64(2.0 + Float64(Float64(0.5 * Float64(y + sqrt(Float64(1.0 / z)))) - t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(y) + sqrt(x);
tmp = 0.0;
if (z <= 1.0)
tmp = 3.0 + ((0.5 * (y + z)) - (sqrt(z) + t_1));
else
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.0], N[(3.0 + N[(N[(0.5 * N[(y + z), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(0.5 * N[(y + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y} + \sqrt{x}\\
\mathbf{if}\;z \leq 1:\\
\;\;\;\;3 + \left(0.5 \cdot \left(y + z\right) - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 + \left(0.5 \cdot \left(y + \sqrt{\frac{1}{z}}\right) - t\_1\right)\\
\end{array}
\end{array}
if z < 1Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in x around 0 43.8%
Taylor expanded in y around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in t around inf 17.3%
Taylor expanded in z around 0 17.3%
associate--l+17.3%
distribute-lft-out17.3%
associate-+r+17.3%
+-commutative17.3%
Simplified17.3%
if 1 < z Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in x around 0 45.2%
Taylor expanded in y around 0 25.7%
associate--l+25.7%
Simplified25.7%
Taylor expanded in t around inf 4.3%
Taylor expanded in z around inf 14.7%
associate--l+14.7%
distribute-lft-out14.7%
+-commutative14.7%
Simplified14.7%
Final simplification16.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 (<= z 0.45) (- (+ (* y 0.5) 3.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))) (+ 2.0 (- (* 0.5 (+ y (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.45) {
tmp = ((y * 0.5) + 3.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.45d0) then
tmp = ((y * 0.5d0) + 3.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 2.0d0 + ((0.5d0 * (y + sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.45) {
tmp = ((y * 0.5) + 3.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 2.0 + ((0.5 * (y + Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.45: tmp = ((y * 0.5) + 3.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 2.0 + ((0.5 * (y + math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.45) tmp = Float64(Float64(Float64(y * 0.5) + 3.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(2.0 + Float64(Float64(0.5 * Float64(y + sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.45)
tmp = ((y * 0.5) + 3.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.45], N[(N[(N[(y * 0.5), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(0.5 * N[(y + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.45:\\
\;\;\;\;\left(y \cdot 0.5 + 3\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 + \left(0.5 \cdot \left(y + \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 0.450000000000000011Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in x around 0 43.8%
Taylor expanded in y around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in t around inf 17.3%
Taylor expanded in z around 0 17.3%
if 0.450000000000000011 < z Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in x around 0 45.2%
Taylor expanded in y around 0 25.7%
associate--l+25.7%
Simplified25.7%
Taylor expanded in t around inf 4.3%
Taylor expanded in z around inf 14.7%
associate--l+14.7%
distribute-lft-out14.7%
+-commutative14.7%
Simplified14.7%
Final simplification16.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 (<= z 1.0) (- (+ (* y 0.5) 3.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))) (+ 2.0 (- (* y 0.5) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.0) {
tmp = ((y * 0.5) + 3.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 2.0 + ((y * 0.5) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.0d0) then
tmp = ((y * 0.5d0) + 3.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 2.0d0 + ((y * 0.5d0) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.0) {
tmp = ((y * 0.5) + 3.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 2.0 + ((y * 0.5) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.0: tmp = ((y * 0.5) + 3.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 2.0 + ((y * 0.5) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(Float64(y * 0.5) + 3.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(2.0 + Float64(Float64(y * 0.5) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.0)
tmp = ((y * 0.5) + 3.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 2.0 + ((y * 0.5) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.0], N[(N[(N[(y * 0.5), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(y * 0.5), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\left(y \cdot 0.5 + 3\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 + \left(y \cdot 0.5 - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 1Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in x around 0 43.8%
Taylor expanded in y around 0 27.7%
associate--l+27.7%
Simplified27.7%
Taylor expanded in t around inf 17.3%
Taylor expanded in z around 0 17.3%
if 1 < z Initial program 85.5%
associate-+l+85.5%
sub-neg85.5%
sub-neg85.5%
+-commutative85.5%
+-commutative85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in x around 0 45.2%
Taylor expanded in y around 0 25.7%
associate--l+25.7%
Simplified25.7%
Taylor expanded in t around inf 4.3%
Taylor expanded in z around inf 14.6%
associate--l+14.6%
*-commutative14.6%
+-commutative14.6%
Simplified14.6%
Final simplification16.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 2.0 (- (* y 0.5) (+ (sqrt y) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 2.0 + ((y * 0.5) - (sqrt(y) + 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 = 2.0d0 + ((y * 0.5d0) - (sqrt(y) + sqrt(x)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 2.0 + ((y * 0.5) - (Math.sqrt(y) + Math.sqrt(x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 2.0 + ((y * 0.5) - (math.sqrt(y) + math.sqrt(x)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(2.0 + Float64(Float64(y * 0.5) - Float64(sqrt(y) + sqrt(x)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 2.0 + ((y * 0.5) - (sqrt(y) + 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[(2.0 + N[(N[(y * 0.5), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
2 + \left(y \cdot 0.5 - \left(\sqrt{y} + \sqrt{x}\right)\right)
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in x around 0 44.4%
Taylor expanded in y around 0 26.9%
associate--l+26.9%
Simplified26.9%
Taylor expanded in t around inf 11.8%
Taylor expanded in z around inf 10.6%
associate--l+10.6%
*-commutative10.6%
+-commutative10.6%
Simplified10.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ y 1.0)) (sqrt y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((y + 1.0)) - sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((y + 1.0d0)) - sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((y + 1.0)) - Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((y + 1.0)) - math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((y + 1.0)) - sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{y + 1} - \sqrt{y}
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
flip--92.4%
div-inv92.4%
add-sqr-sqrt72.6%
+-commutative72.6%
add-sqr-sqrt92.9%
+-commutative92.9%
Applied egg-rr92.9%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
*-lft-identity94.2%
+-commutative94.2%
Simplified94.2%
Taylor expanded in t around inf 20.5%
associate--l+27.3%
associate--l+27.3%
Simplified27.3%
Taylor expanded in y around inf 15.6%
mul-1-neg15.6%
Simplified15.6%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* y (+ 0.5 (sqrt (/ 1.0 y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return y * (0.5 + sqrt((1.0 / y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * (0.5d0 + sqrt((1.0d0 / y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return y * (0.5 + Math.sqrt((1.0 / y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return y * (0.5 + math.sqrt((1.0 / y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(y * Float64(0.5 + sqrt(Float64(1.0 / y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = y * (0.5 + sqrt((1.0 / y)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * 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])\\
\\
y \cdot \left(0.5 + \sqrt{\frac{1}{y}}\right)
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in x around 0 44.4%
Taylor expanded in y around 0 26.9%
associate--l+26.9%
Simplified26.9%
Taylor expanded in y around inf 3.6%
Taylor expanded in y around -inf 0.0%
cancel-sign-sub-inv0.0%
unpow20.0%
rem-square-sqrt6.3%
distribute-lft-neg-in6.3%
distribute-rgt-neg-in6.3%
metadata-eval6.3%
*-rgt-identity6.3%
Simplified6.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.5 (sqrt (/ 1.0 t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * sqrt((1.0 / t));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * sqrt((1.0d0 / t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.sqrt((1.0 / t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.sqrt((1.0 / t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * sqrt(Float64(1.0 / t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * sqrt((1.0 / t));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{t}}
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in x around 0 44.4%
Taylor expanded in y around 0 26.9%
associate--l+26.9%
Simplified26.9%
Taylor expanded in t around inf 11.0%
associate-+r+11.0%
distribute-lft-out11.0%
+-commutative11.0%
Simplified11.0%
Taylor expanded in t around 0 7.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 92.2%
associate-+l+92.2%
sub-neg92.2%
sub-neg92.2%
+-commutative92.2%
+-commutative92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in x around 0 44.4%
Taylor expanded in x around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024101
(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))))