
(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 18 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 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(t_2 (sqrt (+ x 1.0)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (/ 1.0 (+ t_3 (sqrt y))))
(t_5 (- t_3 (sqrt y)))
(t_6 (+ (- t_2 (sqrt x)) t_5))
(t_7 (sqrt (+ 1.0 t))))
(if (<= t_6 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) t_4) (+ (- t_7 (sqrt t)) t_1))
(if (<= t_6 1.5)
(+ t_2 (- (+ t_4 t_1) (sqrt x)))
(+ (+ (- 1.0 (sqrt x)) t_5) (+ t_1 (/ 1.0 (+ t_7 (sqrt t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((1.0 + z)) + sqrt(z));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt((1.0 + y));
double t_4 = 1.0 / (t_3 + sqrt(y));
double t_5 = t_3 - sqrt(y);
double t_6 = (t_2 - sqrt(x)) + t_5;
double t_7 = sqrt((1.0 + t));
double tmp;
if (t_6 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + t_4) + ((t_7 - sqrt(t)) + t_1);
} else if (t_6 <= 1.5) {
tmp = t_2 + ((t_4 + t_1) - sqrt(x));
} else {
tmp = ((1.0 - sqrt(x)) + t_5) + (t_1 + (1.0 / (t_7 + 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) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = 1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))
t_2 = sqrt((x + 1.0d0))
t_3 = sqrt((1.0d0 + y))
t_4 = 1.0d0 / (t_3 + sqrt(y))
t_5 = t_3 - sqrt(y)
t_6 = (t_2 - sqrt(x)) + t_5
t_7 = sqrt((1.0d0 + t))
if (t_6 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_4) + ((t_7 - sqrt(t)) + t_1)
else if (t_6 <= 1.5d0) then
tmp = t_2 + ((t_4 + t_1) - sqrt(x))
else
tmp = ((1.0d0 - sqrt(x)) + t_5) + (t_1 + (1.0d0 / (t_7 + 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 = 1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = Math.sqrt((1.0 + y));
double t_4 = 1.0 / (t_3 + Math.sqrt(y));
double t_5 = t_3 - Math.sqrt(y);
double t_6 = (t_2 - Math.sqrt(x)) + t_5;
double t_7 = Math.sqrt((1.0 + t));
double tmp;
if (t_6 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_4) + ((t_7 - Math.sqrt(t)) + t_1);
} else if (t_6 <= 1.5) {
tmp = t_2 + ((t_4 + t_1) - Math.sqrt(x));
} else {
tmp = ((1.0 - Math.sqrt(x)) + t_5) + (t_1 + (1.0 / (t_7 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)) t_2 = math.sqrt((x + 1.0)) t_3 = math.sqrt((1.0 + y)) t_4 = 1.0 / (t_3 + math.sqrt(y)) t_5 = t_3 - math.sqrt(y) t_6 = (t_2 - math.sqrt(x)) + t_5 t_7 = math.sqrt((1.0 + t)) tmp = 0 if t_6 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_4) + ((t_7 - math.sqrt(t)) + t_1) elif t_6 <= 1.5: tmp = t_2 + ((t_4 + t_1) - math.sqrt(x)) else: tmp = ((1.0 - math.sqrt(x)) + t_5) + (t_1 + (1.0 / (t_7 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) t_2 = sqrt(Float64(x + 1.0)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(1.0 / Float64(t_3 + sqrt(y))) t_5 = Float64(t_3 - sqrt(y)) t_6 = Float64(Float64(t_2 - sqrt(x)) + t_5) t_7 = sqrt(Float64(1.0 + t)) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_4) + Float64(Float64(t_7 - sqrt(t)) + t_1)); elseif (t_6 <= 1.5) tmp = Float64(t_2 + Float64(Float64(t_4 + t_1) - sqrt(x))); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + t_5) + Float64(t_1 + Float64(1.0 / Float64(t_7 + 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 = 1.0 / (sqrt((1.0 + z)) + sqrt(z));
t_2 = sqrt((x + 1.0));
t_3 = sqrt((1.0 + y));
t_4 = 1.0 / (t_3 + sqrt(y));
t_5 = t_3 - sqrt(y);
t_6 = (t_2 - sqrt(x)) + t_5;
t_7 = sqrt((1.0 + t));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + t_4) + ((t_7 - sqrt(t)) + t_1);
elseif (t_6 <= 1.5)
tmp = t_2 + ((t_4 + t_1) - sqrt(x));
else
tmp = ((1.0 - sqrt(x)) + t_5) + (t_1 + (1.0 / (t_7 + 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[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$6, 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision] + N[(N[(t$95$7 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 1.5], N[(t$95$2 + N[(N[(t$95$4 + t$95$1), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(t$95$7 + 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 := \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{1 + y}\\
t_4 := \frac{1}{t\_3 + \sqrt{y}}\\
t_5 := t\_3 - \sqrt{y}\\
t_6 := \left(t\_2 - \sqrt{x}\right) + t\_5\\
t_7 := \sqrt{1 + t}\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_4\right) + \left(\left(t\_7 - \sqrt{t}\right) + t\_1\right)\\
\mathbf{elif}\;t\_6 \leq 1.5:\\
\;\;\;\;t\_2 + \left(\left(t\_4 + t\_1\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + t\_5\right) + \left(t\_1 + \frac{1}{t\_7 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 0.0Initial program 73.3%
associate-+l+73.3%
associate-+l-73.3%
associate-+l-73.3%
+-commutative73.3%
+-commutative73.3%
+-commutative73.3%
Simplified73.3%
flip--73.3%
add-sqr-sqrt62.8%
add-sqr-sqrt73.3%
Applied egg-rr73.3%
associate--l+78.1%
+-inverses78.1%
metadata-eval78.1%
Simplified78.1%
flip--78.1%
add-sqr-sqrt40.8%
add-sqr-sqrt78.1%
Applied egg-rr78.1%
associate--l+84.4%
+-inverses84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in x around inf 90.7%
if 0.0 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 1.5Initial program 95.2%
associate-+l+95.2%
associate-+l-59.6%
associate-+l-95.2%
+-commutative95.2%
+-commutative95.2%
+-commutative95.2%
Simplified95.2%
flip--95.4%
add-sqr-sqrt68.9%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
associate--l+96.3%
+-inverses96.3%
metadata-eval96.3%
Simplified96.3%
flip--96.4%
add-sqr-sqrt73.6%
add-sqr-sqrt97.0%
Applied egg-rr97.0%
associate--l+97.6%
+-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t around inf 31.3%
associate--l+31.3%
Simplified31.3%
if 1.5 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 98.9%
associate-+l+98.9%
associate-+l-98.9%
associate-+l-98.9%
+-commutative98.9%
+-commutative98.9%
+-commutative98.9%
Simplified98.9%
flip--98.9%
add-sqr-sqrt82.4%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
associate--l+99.8%
+-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 99.2%
flip--99.3%
add-sqr-sqrt78.7%
add-sqr-sqrt99.3%
Applied egg-rr99.3%
associate--l+99.3%
+-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification59.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 (+ 1.0 y)) (sqrt y))))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_3
(+
(- (sqrt (+ 1.0 t)) (sqrt t))
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))))
(if (<= t_2 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) t_1) t_3)
(+ t_3 (+ t_2 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((1.0 + y)) + sqrt(y));
double t_2 = sqrt((x + 1.0)) - sqrt(x);
double t_3 = (sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
double tmp;
if (t_2 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + t_1) + t_3;
} else {
tmp = t_3 + (t_2 + 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) :: t_3
real(8) :: tmp
t_1 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
t_3 = (sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))
if (t_2 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_1) + t_3
else
tmp = t_3 + (t_2 + 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((1.0 + y)) + Math.sqrt(y));
double t_2 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_3 = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)));
double tmp;
if (t_2 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_1) + t_3;
} else {
tmp = t_3 + (t_2 + 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((1.0 + y)) + math.sqrt(y)) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) t_3 = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) tmp = 0 if t_2 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_1) + t_3 else: tmp = t_3 + (t_2 + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) t_2 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_3 = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_1) + t_3); else tmp = Float64(t_3 + Float64(t_2 + 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((1.0 + y)) + sqrt(y));
t_2 = sqrt((x + 1.0)) - sqrt(x);
t_3 = (sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z)));
tmp = 0.0;
if (t_2 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + t_1) + t_3;
else
tmp = t_3 + (t_2 + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + t$95$3), $MachinePrecision], N[(t$95$3 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
t_3 := \left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_1\right) + t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_2 + t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 85.7%
associate-+l+85.7%
associate-+l-43.0%
associate-+l-85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
flip--85.8%
add-sqr-sqrt63.9%
add-sqr-sqrt85.8%
Applied egg-rr85.8%
associate--l+88.7%
+-inverses88.7%
metadata-eval88.7%
Simplified88.7%
flip--88.8%
add-sqr-sqrt72.3%
add-sqr-sqrt89.4%
Applied egg-rr89.4%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in x around inf 95.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.8%
associate-+l+96.8%
associate-+l-96.8%
associate-+l-96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
flip--96.9%
add-sqr-sqrt77.0%
add-sqr-sqrt97.5%
Applied egg-rr97.5%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified97.5%
flip--97.5%
add-sqr-sqrt73.9%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification96.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)))
(t_2 (/ 1.0 (+ t_1 (sqrt z))))
(t_3 (sqrt (+ 1.0 t)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (- t_4 (sqrt y))))
(if (<= x 1.85e-177)
(+ (+ (- 1.0 (sqrt x)) t_5) (+ t_2 (/ 1.0 (+ t_3 (sqrt t)))))
(if (<= x 8000000.0)
(+ (sqrt (+ x 1.0)) (- (+ (/ 1.0 (+ t_4 (sqrt y))) t_2) (sqrt x)))
(+
(+ (* 0.5 (sqrt (/ 1.0 x))) t_5)
(+ (- t_3 (sqrt t)) (- 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 t_2 = 1.0 / (t_1 + sqrt(z));
double t_3 = sqrt((1.0 + t));
double t_4 = sqrt((1.0 + y));
double t_5 = t_4 - sqrt(y);
double tmp;
if (x <= 1.85e-177) {
tmp = ((1.0 - sqrt(x)) + t_5) + (t_2 + (1.0 / (t_3 + sqrt(t))));
} else if (x <= 8000000.0) {
tmp = sqrt((x + 1.0)) + (((1.0 / (t_4 + sqrt(y))) + t_2) - sqrt(x));
} else {
tmp = ((0.5 * sqrt((1.0 / x))) + t_5) + ((t_3 - sqrt(t)) + (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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = 1.0d0 / (t_1 + sqrt(z))
t_3 = sqrt((1.0d0 + t))
t_4 = sqrt((1.0d0 + y))
t_5 = t_4 - sqrt(y)
if (x <= 1.85d-177) then
tmp = ((1.0d0 - sqrt(x)) + t_5) + (t_2 + (1.0d0 / (t_3 + sqrt(t))))
else if (x <= 8000000.0d0) then
tmp = sqrt((x + 1.0d0)) + (((1.0d0 / (t_4 + sqrt(y))) + t_2) - sqrt(x))
else
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_5) + ((t_3 - sqrt(t)) + (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 t_2 = 1.0 / (t_1 + Math.sqrt(z));
double t_3 = Math.sqrt((1.0 + t));
double t_4 = Math.sqrt((1.0 + y));
double t_5 = t_4 - Math.sqrt(y);
double tmp;
if (x <= 1.85e-177) {
tmp = ((1.0 - Math.sqrt(x)) + t_5) + (t_2 + (1.0 / (t_3 + Math.sqrt(t))));
} else if (x <= 8000000.0) {
tmp = Math.sqrt((x + 1.0)) + (((1.0 / (t_4 + Math.sqrt(y))) + t_2) - Math.sqrt(x));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_5) + ((t_3 - Math.sqrt(t)) + (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)) t_2 = 1.0 / (t_1 + math.sqrt(z)) t_3 = math.sqrt((1.0 + t)) t_4 = math.sqrt((1.0 + y)) t_5 = t_4 - math.sqrt(y) tmp = 0 if x <= 1.85e-177: tmp = ((1.0 - math.sqrt(x)) + t_5) + (t_2 + (1.0 / (t_3 + math.sqrt(t)))) elif x <= 8000000.0: tmp = math.sqrt((x + 1.0)) + (((1.0 / (t_4 + math.sqrt(y))) + t_2) - math.sqrt(x)) else: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_5) + ((t_3 - math.sqrt(t)) + (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)) t_2 = Float64(1.0 / Float64(t_1 + sqrt(z))) t_3 = sqrt(Float64(1.0 + t)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(t_4 - sqrt(y)) tmp = 0.0 if (x <= 1.85e-177) tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + t_5) + Float64(t_2 + Float64(1.0 / Float64(t_3 + sqrt(t))))); elseif (x <= 8000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(1.0 / Float64(t_4 + sqrt(y))) + t_2) - sqrt(x))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_5) + Float64(Float64(t_3 - sqrt(t)) + 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));
t_2 = 1.0 / (t_1 + sqrt(z));
t_3 = sqrt((1.0 + t));
t_4 = sqrt((1.0 + y));
t_5 = t_4 - sqrt(y);
tmp = 0.0;
if (x <= 1.85e-177)
tmp = ((1.0 - sqrt(x)) + t_5) + (t_2 + (1.0 / (t_3 + sqrt(t))));
elseif (x <= 8000000.0)
tmp = sqrt((x + 1.0)) + (((1.0 / (t_4 + sqrt(y))) + t_2) - sqrt(x));
else
tmp = ((0.5 * sqrt((1.0 / x))) + t_5) + ((t_3 - sqrt(t)) + (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]}, Block[{t$95$2 = N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.85e-177], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] + N[(t$95$2 + N[(1.0 / N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] + N[(N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \frac{1}{t\_1 + \sqrt{z}}\\
t_3 := \sqrt{1 + t}\\
t_4 := \sqrt{1 + y}\\
t_5 := t\_4 - \sqrt{y}\\
\mathbf{if}\;x \leq 1.85 \cdot 10^{-177}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + t\_5\right) + \left(t\_2 + \frac{1}{t\_3 + \sqrt{t}}\right)\\
\mathbf{elif}\;x \leq 8000000:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\frac{1}{t\_4 + \sqrt{y}} + t\_2\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_5\right) + \left(\left(t\_3 - \sqrt{t}\right) + \left(t\_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if x < 1.84999999999999997e-177Initial program 97.8%
associate-+l+97.8%
associate-+l-97.8%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.7%
add-sqr-sqrt82.6%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in x around 0 98.7%
flip--98.8%
add-sqr-sqrt79.1%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
Simplified99.5%
if 1.84999999999999997e-177 < x < 8e6Initial program 97.3%
associate-+l+97.3%
associate-+l-97.3%
associate-+l-97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
flip--97.5%
add-sqr-sqrt75.0%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate--l+97.9%
+-inverses97.9%
metadata-eval97.9%
Simplified97.9%
flip--98.0%
add-sqr-sqrt75.7%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate--l+99.0%
+-inverses99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in t around inf 49.5%
associate--l+49.5%
Simplified49.5%
if 8e6 < x Initial program 85.4%
associate-+l+85.4%
associate-+l-44.4%
associate-+l-85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in x around inf 89.2%
Final simplification79.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (/ 1.0 (+ t_1 (sqrt z))))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (- t_4 (sqrt y))))
(if (<= x 3.3e-177)
(+ (+ t_3 t_2) (+ (- 1.0 (sqrt x)) t_5))
(if (<= x 18000000.0)
(+ (sqrt (+ x 1.0)) (- (+ (/ 1.0 (+ t_4 (sqrt y))) t_2) (sqrt x)))
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) t_5) (+ t_3 (- 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 t_2 = 1.0 / (t_1 + sqrt(z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double t_4 = sqrt((1.0 + y));
double t_5 = t_4 - sqrt(y);
double tmp;
if (x <= 3.3e-177) {
tmp = (t_3 + t_2) + ((1.0 - sqrt(x)) + t_5);
} else if (x <= 18000000.0) {
tmp = sqrt((x + 1.0)) + (((1.0 / (t_4 + sqrt(y))) + t_2) - sqrt(x));
} else {
tmp = ((0.5 * sqrt((1.0 / x))) + t_5) + (t_3 + (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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = 1.0d0 / (t_1 + sqrt(z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
t_4 = sqrt((1.0d0 + y))
t_5 = t_4 - sqrt(y)
if (x <= 3.3d-177) then
tmp = (t_3 + t_2) + ((1.0d0 - sqrt(x)) + t_5)
else if (x <= 18000000.0d0) then
tmp = sqrt((x + 1.0d0)) + (((1.0d0 / (t_4 + sqrt(y))) + t_2) - sqrt(x))
else
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_5) + (t_3 + (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 t_2 = 1.0 / (t_1 + Math.sqrt(z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double t_4 = Math.sqrt((1.0 + y));
double t_5 = t_4 - Math.sqrt(y);
double tmp;
if (x <= 3.3e-177) {
tmp = (t_3 + t_2) + ((1.0 - Math.sqrt(x)) + t_5);
} else if (x <= 18000000.0) {
tmp = Math.sqrt((x + 1.0)) + (((1.0 / (t_4 + Math.sqrt(y))) + t_2) - Math.sqrt(x));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_5) + (t_3 + (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)) t_2 = 1.0 / (t_1 + math.sqrt(z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) t_4 = math.sqrt((1.0 + y)) t_5 = t_4 - math.sqrt(y) tmp = 0 if x <= 3.3e-177: tmp = (t_3 + t_2) + ((1.0 - math.sqrt(x)) + t_5) elif x <= 18000000.0: tmp = math.sqrt((x + 1.0)) + (((1.0 / (t_4 + math.sqrt(y))) + t_2) - math.sqrt(x)) else: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_5) + (t_3 + (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)) t_2 = Float64(1.0 / Float64(t_1 + sqrt(z))) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(t_4 - sqrt(y)) tmp = 0.0 if (x <= 3.3e-177) tmp = Float64(Float64(t_3 + t_2) + Float64(Float64(1.0 - sqrt(x)) + t_5)); elseif (x <= 18000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(1.0 / Float64(t_4 + sqrt(y))) + t_2) - sqrt(x))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_5) + Float64(t_3 + 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));
t_2 = 1.0 / (t_1 + sqrt(z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
t_4 = sqrt((1.0 + y));
t_5 = t_4 - sqrt(y);
tmp = 0.0;
if (x <= 3.3e-177)
tmp = (t_3 + t_2) + ((1.0 - sqrt(x)) + t_5);
elseif (x <= 18000000.0)
tmp = sqrt((x + 1.0)) + (((1.0 / (t_4 + sqrt(y))) + t_2) - sqrt(x));
else
tmp = ((0.5 * sqrt((1.0 / x))) + t_5) + (t_3 + (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]}, Block[{t$95$2 = N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.3e-177], N[(N[(t$95$3 + t$95$2), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 18000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] + N[(t$95$3 + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \frac{1}{t\_1 + \sqrt{z}}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
t_4 := \sqrt{1 + y}\\
t_5 := t\_4 - \sqrt{y}\\
\mathbf{if}\;x \leq 3.3 \cdot 10^{-177}:\\
\;\;\;\;\left(t\_3 + t\_2\right) + \left(\left(1 - \sqrt{x}\right) + t\_5\right)\\
\mathbf{elif}\;x \leq 18000000:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\frac{1}{t\_4 + \sqrt{y}} + t\_2\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_5\right) + \left(t\_3 + \left(t\_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if x < 3.3e-177Initial program 97.8%
associate-+l+97.8%
associate-+l-97.8%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.7%
add-sqr-sqrt82.6%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in x around 0 98.7%
if 3.3e-177 < x < 1.8e7Initial program 97.2%
associate-+l+97.2%
associate-+l-97.2%
associate-+l-97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.4%
add-sqr-sqrt75.2%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate--l+97.8%
+-inverses97.8%
metadata-eval97.8%
Simplified97.8%
flip--97.8%
add-sqr-sqrt75.8%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in t around inf 50.0%
associate--l+50.0%
Simplified50.0%
if 1.8e7 < x Initial program 85.4%
associate-+l+85.4%
associate-+l-44.0%
associate-+l-85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in x around inf 89.2%
Final simplification79.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 z)))
(t_2 (sqrt (+ 1.0 y)))
(t_3 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- t_1 (sqrt z)))))
(if (<= x 5e-177)
(+ t_3 (+ 1.0 (- t_2 (+ (sqrt x) (sqrt y)))))
(if (<= x 9000000.0)
(+
(sqrt (+ x 1.0))
(- (+ (/ 1.0 (+ t_2 (sqrt y))) (/ 1.0 (+ t_1 (sqrt z)))) (sqrt x)))
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) (- t_2 (sqrt y))) t_3)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + y));
double t_3 = (sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z));
double tmp;
if (x <= 5e-177) {
tmp = t_3 + (1.0 + (t_2 - (sqrt(x) + sqrt(y))));
} else if (x <= 9000000.0) {
tmp = sqrt((x + 1.0)) + (((1.0 / (t_2 + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
} else {
tmp = ((0.5 * sqrt((1.0 / x))) + (t_2 - sqrt(y))) + t_3;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
t_3 = (sqrt((1.0d0 + t)) - sqrt(t)) + (t_1 - sqrt(z))
if (x <= 5d-177) then
tmp = t_3 + (1.0d0 + (t_2 - (sqrt(x) + sqrt(y))))
else if (x <= 9000000.0d0) then
tmp = sqrt((x + 1.0d0)) + (((1.0d0 / (t_2 + sqrt(y))) + (1.0d0 / (t_1 + sqrt(z)))) - sqrt(x))
else
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + (t_2 - sqrt(y))) + t_3
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + y));
double t_3 = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (t_1 - Math.sqrt(z));
double tmp;
if (x <= 5e-177) {
tmp = t_3 + (1.0 + (t_2 - (Math.sqrt(x) + Math.sqrt(y))));
} else if (x <= 9000000.0) {
tmp = Math.sqrt((x + 1.0)) + (((1.0 / (t_2 + Math.sqrt(y))) + (1.0 / (t_1 + Math.sqrt(z)))) - Math.sqrt(x));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + (t_2 - Math.sqrt(y))) + t_3;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + y)) t_3 = (math.sqrt((1.0 + t)) - math.sqrt(t)) + (t_1 - math.sqrt(z)) tmp = 0 if x <= 5e-177: tmp = t_3 + (1.0 + (t_2 - (math.sqrt(x) + math.sqrt(y)))) elif x <= 9000000.0: tmp = math.sqrt((x + 1.0)) + (((1.0 / (t_2 + math.sqrt(y))) + (1.0 / (t_1 + math.sqrt(z)))) - math.sqrt(x)) else: tmp = ((0.5 * math.sqrt((1.0 / x))) + (t_2 - math.sqrt(y))) + t_3 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + y)) t_3 = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(t_1 - sqrt(z))) tmp = 0.0 if (x <= 5e-177) tmp = Float64(t_3 + Float64(1.0 + Float64(t_2 - Float64(sqrt(x) + sqrt(y))))); elseif (x <= 9000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(1.0 / Float64(t_1 + sqrt(z)))) - sqrt(x))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_2 - sqrt(y))) + t_3); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + y));
t_3 = (sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z));
tmp = 0.0;
if (x <= 5e-177)
tmp = t_3 + (1.0 + (t_2 - (sqrt(x) + sqrt(y))));
elseif (x <= 9000000.0)
tmp = sqrt((x + 1.0)) + (((1.0 / (t_2 + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
else
tmp = ((0.5 * sqrt((1.0 / x))) + (t_2 - sqrt(y))) + t_3;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5e-177], N[(t$95$3 + N[(1.0 + N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + y}\\
t_3 := \left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;x \leq 5 \cdot 10^{-177}:\\
\;\;\;\;t\_3 + \left(1 + \left(t\_2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;x \leq 9000000:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\frac{1}{t\_2 + \sqrt{y}} + \frac{1}{t\_1 + \sqrt{z}}\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_2 - \sqrt{y}\right)\right) + t\_3\\
\end{array}
\end{array}
if x < 5e-177Initial program 97.8%
associate-+l+97.8%
associate-+l-97.8%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in x around 0 55.1%
associate--l+97.8%
Simplified97.8%
if 5e-177 < x < 9e6Initial program 97.2%
associate-+l+97.2%
associate-+l-97.2%
associate-+l-97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.4%
add-sqr-sqrt75.2%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate--l+97.8%
+-inverses97.8%
metadata-eval97.8%
Simplified97.8%
flip--97.8%
add-sqr-sqrt75.8%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in t around inf 50.0%
associate--l+50.0%
Simplified50.0%
if 9e6 < x Initial program 85.4%
associate-+l+85.4%
associate-+l-44.0%
associate-+l-85.4%
+-commutative85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in x around inf 89.2%
Final simplification78.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))) (t_2 (- t_1 (sqrt z))) (t_3 (sqrt (+ 1.0 y))))
(if (<= x 8.5e-178)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_2)
(+ 1.0 (- t_3 (+ (sqrt x) (sqrt y)))))
(if (<= x 170000.0)
(+
(sqrt (+ x 1.0))
(- (+ (/ 1.0 (+ t_3 (sqrt y))) (/ 1.0 (+ t_1 (sqrt z)))) (sqrt x)))
(+
(/ (+ (* (sqrt (/ 1.0 x)) -0.125) (* (sqrt x) 0.5)) x)
(+ (- t_3 (sqrt y)) t_2))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = t_1 - sqrt(z);
double t_3 = sqrt((1.0 + y));
double tmp;
if (x <= 8.5e-178) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_2) + (1.0 + (t_3 - (sqrt(x) + sqrt(y))));
} else if (x <= 170000.0) {
tmp = sqrt((x + 1.0)) + (((1.0 / (t_3 + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
} else {
tmp = (((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x) + ((t_3 - sqrt(y)) + t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((1.0d0 + y))
if (x <= 8.5d-178) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + t_2) + (1.0d0 + (t_3 - (sqrt(x) + sqrt(y))))
else if (x <= 170000.0d0) then
tmp = sqrt((x + 1.0d0)) + (((1.0d0 / (t_3 + sqrt(y))) + (1.0d0 / (t_1 + sqrt(z)))) - sqrt(x))
else
tmp = (((sqrt((1.0d0 / x)) * (-0.125d0)) + (sqrt(x) * 0.5d0)) / x) + ((t_3 - sqrt(y)) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (x <= 8.5e-178) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_2) + (1.0 + (t_3 - (Math.sqrt(x) + Math.sqrt(y))));
} else if (x <= 170000.0) {
tmp = Math.sqrt((x + 1.0)) + (((1.0 / (t_3 + Math.sqrt(y))) + (1.0 / (t_1 + Math.sqrt(z)))) - Math.sqrt(x));
} else {
tmp = (((Math.sqrt((1.0 / x)) * -0.125) + (Math.sqrt(x) * 0.5)) / x) + ((t_3 - Math.sqrt(y)) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = t_1 - math.sqrt(z) t_3 = math.sqrt((1.0 + y)) tmp = 0 if x <= 8.5e-178: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_2) + (1.0 + (t_3 - (math.sqrt(x) + math.sqrt(y)))) elif x <= 170000.0: tmp = math.sqrt((x + 1.0)) + (((1.0 / (t_3 + math.sqrt(y))) + (1.0 / (t_1 + math.sqrt(z)))) - math.sqrt(x)) else: tmp = (((math.sqrt((1.0 / x)) * -0.125) + (math.sqrt(x) * 0.5)) / x) + ((t_3 - math.sqrt(y)) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = Float64(t_1 - sqrt(z)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (x <= 8.5e-178) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_2) + Float64(1.0 + Float64(t_3 - Float64(sqrt(x) + sqrt(y))))); elseif (x <= 170000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(1.0 / Float64(t_3 + sqrt(y))) + Float64(1.0 / Float64(t_1 + sqrt(z)))) - sqrt(x))); else tmp = Float64(Float64(Float64(Float64(sqrt(Float64(1.0 / x)) * -0.125) + Float64(sqrt(x) * 0.5)) / x) + Float64(Float64(t_3 - sqrt(y)) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = t_1 - sqrt(z);
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if (x <= 8.5e-178)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + t_2) + (1.0 + (t_3 - (sqrt(x) + sqrt(y))));
elseif (x <= 170000.0)
tmp = sqrt((x + 1.0)) + (((1.0 / (t_3 + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
else
tmp = (((sqrt((1.0 / x)) * -0.125) + (sqrt(x) * 0.5)) / x) + ((t_3 - sqrt(y)) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 8.5e-178], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(1.0 + N[(t$95$3 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 170000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;x \leq 8.5 \cdot 10^{-178}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_2\right) + \left(1 + \left(t\_3 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;x \leq 170000:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\frac{1}{t\_3 + \sqrt{y}} + \frac{1}{t\_1 + \sqrt{z}}\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{x}} \cdot -0.125 + \sqrt{x} \cdot 0.5}{x} + \left(\left(t\_3 - \sqrt{y}\right) + t\_2\right)\\
\end{array}
\end{array}
if x < 8.5000000000000001e-178Initial program 97.8%
associate-+l+97.8%
associate-+l-97.8%
associate-+l-97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in x around 0 55.1%
associate--l+97.8%
Simplified97.8%
if 8.5000000000000001e-178 < x < 1.7e5Initial program 97.4%
associate-+l+97.4%
associate-+l-97.4%
associate-+l-97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
flip--97.7%
add-sqr-sqrt74.9%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate--l+98.1%
+-inverses98.1%
metadata-eval98.1%
Simplified98.1%
flip--98.1%
add-sqr-sqrt75.5%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around inf 49.9%
associate--l+49.9%
Simplified49.9%
if 1.7e5 < x Initial program 85.4%
associate-+l+85.4%
associate-+l+85.4%
+-commutative85.4%
+-commutative85.4%
associate-+l-70.4%
+-commutative70.4%
+-commutative70.4%
Simplified70.4%
Taylor expanded in x around inf 74.9%
Taylor expanded in t around inf 45.7%
Final simplification58.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= t 1e+27)
(-
(- (+ t_1 (+ 2.0 (hypot 1.0 (sqrt t)))) (sqrt t))
(+ (sqrt z) (+ (sqrt x) (sqrt y))))
(+
(sqrt (+ x 1.0))
(-
(+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (/ 1.0 (+ t_1 (sqrt z))))
(sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 1e+27) {
tmp = ((t_1 + (2.0 + hypot(1.0, sqrt(t)))) - sqrt(t)) - (sqrt(z) + (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((x + 1.0)) + (((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 1e+27) {
tmp = ((t_1 + (2.0 + Math.hypot(1.0, Math.sqrt(t)))) - Math.sqrt(t)) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((x + 1.0)) + (((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (1.0 / (t_1 + Math.sqrt(z)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 1e+27: tmp = ((t_1 + (2.0 + math.hypot(1.0, math.sqrt(t)))) - math.sqrt(t)) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((x + 1.0)) + (((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (1.0 / (t_1 + math.sqrt(z)))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 1e+27) tmp = Float64(Float64(Float64(t_1 + Float64(2.0 + hypot(1.0, sqrt(t)))) - sqrt(t)) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(1.0 / Float64(t_1 + sqrt(z)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 1e+27)
tmp = ((t_1 + (2.0 + hypot(1.0, sqrt(t)))) - sqrt(t)) - (sqrt(z) + (sqrt(x) + sqrt(y)));
else
tmp = sqrt((x + 1.0)) + (((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1e+27], N[(N[(N[(t$95$1 + N[(2.0 + N[Sqrt[1.0 ^ 2 + N[Sqrt[t], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 10^{+27}:\\
\;\;\;\;\left(\left(t\_1 + \left(2 + \mathsf{hypot}\left(1, \sqrt{t}\right)\right)\right) - \sqrt{t}\right) - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{t\_1 + \sqrt{z}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if t < 1e27Initial program 94.8%
associate-+l+94.8%
associate-+l-76.6%
associate-+l-94.8%
+-commutative94.8%
+-commutative94.8%
+-commutative94.8%
Simplified94.8%
Taylor expanded in y around 0 18.4%
associate-+r+18.5%
+-commutative18.5%
associate-+r+18.5%
Simplified18.5%
Taylor expanded in x around 0 15.8%
associate-+r+15.8%
associate--r+15.8%
associate-+r+15.8%
metadata-eval15.8%
rem-square-sqrt15.8%
hypot-undefine15.8%
+-commutative15.8%
Simplified15.8%
if 1e27 < t Initial program 86.9%
associate-+l+86.9%
associate-+l-64.5%
associate-+l-86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
flip--87.0%
add-sqr-sqrt67.5%
add-sqr-sqrt87.0%
Applied egg-rr87.0%
associate--l+88.9%
+-inverses88.9%
metadata-eval88.9%
Simplified88.9%
flip--89.1%
add-sqr-sqrt73.5%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in t around inf 53.7%
associate--l+53.7%
Simplified53.7%
Final simplification30.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 (<= t 18000000000000.0)
(-
(+ 2.0 (+ t_1 (sqrt (+ 1.0 t))))
(+ (+ (sqrt x) (sqrt t)) (+ (sqrt y) (sqrt z))))
(+
(sqrt (+ x 1.0))
(-
(+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (/ 1.0 (+ t_1 (sqrt z))))
(sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 18000000000000.0) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - ((sqrt(x) + sqrt(t)) + (sqrt(y) + sqrt(z)));
} else {
tmp = sqrt((x + 1.0)) + (((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 18000000000000.0d0) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - ((sqrt(x) + sqrt(t)) + (sqrt(y) + sqrt(z)))
else
tmp = sqrt((x + 1.0d0)) + (((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (1.0d0 / (t_1 + sqrt(z)))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 18000000000000.0) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - ((Math.sqrt(x) + Math.sqrt(t)) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.sqrt((x + 1.0)) + (((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (1.0 / (t_1 + Math.sqrt(z)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 18000000000000.0: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - ((math.sqrt(x) + math.sqrt(t)) + (math.sqrt(y) + math.sqrt(z))) else: tmp = math.sqrt((x + 1.0)) + (((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (1.0 / (t_1 + math.sqrt(z)))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 18000000000000.0) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(Float64(sqrt(x) + sqrt(t)) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(1.0 / Float64(t_1 + sqrt(z)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 18000000000000.0)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - ((sqrt(x) + sqrt(t)) + (sqrt(y) + sqrt(z)));
else
tmp = sqrt((x + 1.0)) + (((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (t_1 + sqrt(z)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 18000000000000.0], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 18000000000000:\\
\;\;\;\;\left(2 + \left(t\_1 + \sqrt{1 + t}\right)\right) - \left(\left(\sqrt{x} + \sqrt{t}\right) + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{t\_1 + \sqrt{z}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if t < 1.8e13Initial program 95.4%
associate-+l+95.4%
associate-+l-77.5%
associate-+l-95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in y around 0 18.8%
associate-+r+18.9%
+-commutative18.9%
associate-+r+18.9%
Simplified18.9%
Taylor expanded in x around 0 16.2%
if 1.8e13 < t Initial program 86.4%
associate-+l+86.4%
associate-+l-63.6%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.5%
add-sqr-sqrt67.0%
add-sqr-sqrt86.5%
Applied egg-rr86.5%
associate--l+88.3%
+-inverses88.3%
metadata-eval88.3%
Simplified88.3%
flip--88.5%
add-sqr-sqrt72.9%
add-sqr-sqrt88.7%
Applied egg-rr88.7%
associate--l+91.7%
+-inverses91.7%
metadata-eval91.7%
Simplified91.7%
Taylor expanded in t around inf 52.5%
associate--l+52.5%
Simplified52.5%
Final simplification31.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 (<= t 18000000000000.0)
(-
(+ 2.0 (+ t_1 (sqrt (+ 1.0 t))))
(+ (+ (sqrt x) (sqrt t)) (+ (sqrt y) (sqrt z))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- t_1 (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 18000000000000.0) {
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - ((sqrt(x) + sqrt(t)) + (sqrt(y) + sqrt(z)));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + y)) - sqrt(y)) + (t_1 - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 18000000000000.0d0) then
tmp = (2.0d0 + (t_1 + sqrt((1.0d0 + t)))) - ((sqrt(x) + sqrt(t)) + (sqrt(y) + sqrt(z)))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((sqrt((1.0d0 + y)) - sqrt(y)) + (t_1 - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 18000000000000.0) {
tmp = (2.0 + (t_1 + Math.sqrt((1.0 + t)))) - ((Math.sqrt(x) + Math.sqrt(t)) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + (t_1 - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 18000000000000.0: tmp = (2.0 + (t_1 + math.sqrt((1.0 + t)))) - ((math.sqrt(x) + math.sqrt(t)) + (math.sqrt(y) + math.sqrt(z))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + (t_1 - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 18000000000000.0) tmp = Float64(Float64(2.0 + Float64(t_1 + sqrt(Float64(1.0 + t)))) - Float64(Float64(sqrt(x) + sqrt(t)) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(t_1 - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 18000000000000.0)
tmp = (2.0 + (t_1 + sqrt((1.0 + t)))) - ((sqrt(x) + sqrt(t)) + (sqrt(y) + sqrt(z)));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + y)) - sqrt(y)) + (t_1 - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 18000000000000.0], N[(N[(2.0 + N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 18000000000000:\\
\;\;\;\;\left(2 + \left(t\_1 + \sqrt{1 + t}\right)\right) - \left(\left(\sqrt{x} + \sqrt{t}\right) + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(t\_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 1.8e13Initial program 95.4%
associate-+l+95.4%
associate-+l-77.5%
associate-+l-95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in y around 0 18.8%
associate-+r+18.9%
+-commutative18.9%
associate-+r+18.9%
Simplified18.9%
Taylor expanded in x around 0 16.2%
if 1.8e13 < t Initial program 86.4%
associate-+l+86.4%
associate-+l+86.4%
+-commutative86.4%
+-commutative86.4%
associate-+l-47.9%
+-commutative47.9%
+-commutative47.9%
Simplified47.9%
Taylor expanded in t around inf 86.3%
Final simplification45.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= t 1.06)
(+ (- 2.0 (+ (sqrt x) (sqrt y))) (+ t_1 (+ 1.0 (- (* 0.5 t) (sqrt t)))))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (+ (- (sqrt (+ 1.0 y)) (sqrt y)) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (t <= 1.06) {
tmp = (2.0 - (sqrt(x) + sqrt(y))) + (t_1 + (1.0 + ((0.5 * t) - sqrt(t))));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + y)) - sqrt(y)) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (t <= 1.06d0) then
tmp = (2.0d0 - (sqrt(x) + sqrt(y))) + (t_1 + (1.0d0 + ((0.5d0 * t) - sqrt(t))))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((sqrt((1.0d0 + y)) - sqrt(y)) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (t <= 1.06) {
tmp = (2.0 - (Math.sqrt(x) + Math.sqrt(y))) + (t_1 + (1.0 + ((0.5 * t) - Math.sqrt(t))));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if t <= 1.06: tmp = (2.0 - (math.sqrt(x) + math.sqrt(y))) + (t_1 + (1.0 + ((0.5 * t) - math.sqrt(t)))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (t <= 1.06) tmp = Float64(Float64(2.0 - Float64(sqrt(x) + sqrt(y))) + Float64(t_1 + Float64(1.0 + Float64(Float64(0.5 * t) - sqrt(t))))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (t <= 1.06)
tmp = (2.0 - (sqrt(x) + sqrt(y))) + (t_1 + (1.0 + ((0.5 * t) - sqrt(t))));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((1.0 + y)) - sqrt(y)) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.06], N[(N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 + N[(N[(0.5 * t), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;t \leq 1.06:\\
\;\;\;\;\left(2 - \left(\sqrt{x} + \sqrt{y}\right)\right) + \left(t\_1 + \left(1 + \left(0.5 \cdot t - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + t\_1\right)\\
\end{array}
\end{array}
if t < 1.0600000000000001Initial program 96.0%
associate-+l+96.0%
associate-+l-78.1%
associate-+l-96.0%
+-commutative96.0%
+-commutative96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in t around 0 95.6%
associate--l+95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 44.2%
Taylor expanded in y around 0 27.2%
+-commutative27.2%
Simplified27.2%
if 1.0600000000000001 < t Initial program 86.3%
associate-+l+86.3%
associate-+l+86.3%
+-commutative86.3%
+-commutative86.3%
associate-+l-50.8%
+-commutative50.8%
+-commutative50.8%
Simplified50.8%
Taylor expanded in t around inf 82.1%
Final simplification51.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 80000000.0)
(-
(+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (+ 1.0 (sqrt (+ 1.0 y))))
(+ (sqrt x) (sqrt y)))
(+
(sqrt (+ x 1.0))
(- (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 z)))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 80000000.0) {
tmp = ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + sqrt((1.0 + y)))) - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 80000000.0d0) then
tmp = ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (1.0d0 + sqrt((1.0d0 + y)))) - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) + ((0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / z)))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 80000000.0) {
tmp = ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (1.0 + Math.sqrt((1.0 + y)))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) + ((0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / z)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 80000000.0: tmp = ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (1.0 + math.sqrt((1.0 + y)))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) + ((0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / z)))) - 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 <= 80000000.0) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 + sqrt(Float64(1.0 + y)))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / z)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 80000000.0)
tmp = ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 + sqrt((1.0 + y)))) - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 80000000.0], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 80000000:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(1 + \sqrt{1 + y}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 8e7Initial program 97.1%
associate-+l+97.1%
associate-+l-59.3%
associate-+l-97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.2%
add-sqr-sqrt73.5%
add-sqr-sqrt97.5%
Applied egg-rr97.5%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in x around 0 47.7%
Taylor expanded in t around inf 23.2%
associate-+r+23.2%
Simplified23.2%
if 8e7 < y Initial program 85.7%
associate-+l+85.7%
associate-+l-85.2%
associate-+l-85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in t around inf 5.2%
associate--l+23.4%
Simplified23.4%
Taylor expanded in z around inf 6.1%
Taylor expanded in y around inf 19.0%
associate--l+19.0%
distribute-lft-out19.0%
Simplified19.0%
Final simplification21.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.55)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(- (+ 2.0 (* y (+ 0.5 (* y -0.125)))) (+ (sqrt x) (sqrt y))))
(+
(sqrt (+ x 1.0))
(- (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 z)))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.55) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 + (y * (0.5 + (y * -0.125)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((x + 1.0)) + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.55d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((2.0d0 + (y * (0.5d0 + (y * (-0.125d0))))) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((x + 1.0d0)) + ((0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / z)))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.55) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((2.0 + (y * (0.5 + (y * -0.125)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((x + 1.0)) + ((0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / z)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.55: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((2.0 + (y * (0.5 + (y * -0.125)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((x + 1.0)) + ((0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / z)))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.55) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(2.0 + Float64(y * Float64(0.5 + Float64(y * -0.125)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / z)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.55)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 + (y * (0.5 + (y * -0.125)))) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((x + 1.0)) + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.55], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 + N[(y * N[(0.5 + N[(y * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.55:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(2 + y \cdot \left(0.5 + y \cdot -0.125\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 2.5499999999999998Initial program 97.1%
associate-+l+97.1%
associate-+l-59.3%
associate-+l-97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in y around 0 58.2%
associate-+r+58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in t around inf 30.3%
Taylor expanded in x around 0 22.6%
if 2.5499999999999998 < y Initial program 85.7%
associate-+l+85.7%
associate-+l-85.2%
associate-+l-85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in t around inf 5.2%
associate--l+23.4%
Simplified23.4%
Taylor expanded in z around inf 6.1%
Taylor expanded in y around inf 19.0%
associate--l+19.0%
distribute-lft-out19.0%
Simplified19.0%
Final simplification20.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 (+ x 1.0))))
(if (<= y 56000000.0)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(+ t_1 (- (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 z)))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 56000000.0) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = t_1 + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if (y <= 56000000.0d0) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = t_1 + ((0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / z)))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 56000000.0) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = t_1 + ((0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / z)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 56000000.0: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = t_1 + ((0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / z)))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 56000000.0) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(t_1 + Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / z)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 56000000.0)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = t_1 + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 56000000.0], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 56000000:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 5.6e7Initial program 97.1%
associate-+l+97.1%
associate-+l-59.3%
associate-+l-97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in t around inf 18.3%
associate--l+21.5%
Simplified21.5%
Taylor expanded in z around inf 18.2%
associate--l+18.2%
Simplified18.2%
if 5.6e7 < y Initial program 85.7%
associate-+l+85.7%
associate-+l-85.2%
associate-+l-85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in t around inf 5.2%
associate--l+23.4%
Simplified23.4%
Taylor expanded in z around inf 6.1%
Taylor expanded in y around inf 19.0%
associate--l+19.0%
distribute-lft-out19.0%
Simplified19.0%
Final simplification18.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 x) (sqrt y))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 0.058)
(+ (sqrt (+ x 1.0)) (- t_2 t_1))
(+ 1.0 (- (+ t_2 (* 0.5 (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(x) + sqrt(y);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 0.058) {
tmp = sqrt((x + 1.0)) + (t_2 - t_1);
} else {
tmp = 1.0 + ((t_2 + (0.5 * 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) :: t_2
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
t_2 = sqrt((1.0d0 + y))
if (z <= 0.058d0) then
tmp = sqrt((x + 1.0d0)) + (t_2 - t_1)
else
tmp = 1.0d0 + ((t_2 + (0.5d0 * 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(x) + Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 0.058) {
tmp = Math.sqrt((x + 1.0)) + (t_2 - t_1);
} else {
tmp = 1.0 + ((t_2 + (0.5 * 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(x) + math.sqrt(y) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 0.058: tmp = math.sqrt((x + 1.0)) + (t_2 - t_1) else: tmp = 1.0 + ((t_2 + (0.5 * 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(x) + sqrt(y)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 0.058) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(t_2 - t_1)); else tmp = Float64(1.0 + Float64(Float64(t_2 + Float64(0.5 * 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(x) + sqrt(y);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 0.058)
tmp = sqrt((x + 1.0)) + (t_2 - t_1);
else
tmp = 1.0 + ((t_2 + (0.5 * 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[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.058], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$2 - t$95$1), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$2 + N[(0.5 * 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{x} + \sqrt{y}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.058:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_2 - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_2 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - t\_1\right)\\
\end{array}
\end{array}
if z < 0.0580000000000000029Initial program 96.9%
associate-+l+96.9%
associate-+l-80.5%
associate-+l-96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 21.0%
associate--l+25.2%
Simplified25.2%
Taylor expanded in z around inf 8.8%
associate--l+13.0%
Simplified13.0%
if 0.0580000000000000029 < z Initial program 86.8%
associate-+l+86.8%
associate-+l-63.6%
associate-+l-86.8%
+-commutative86.8%
+-commutative86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in t around inf 3.6%
associate--l+19.7%
Simplified19.7%
Taylor expanded in z around inf 15.4%
Taylor expanded in x around 0 12.5%
associate--l+29.3%
+-commutative29.3%
Simplified29.3%
Final simplification21.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + 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((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + 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((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + 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[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)
\end{array}
Initial program 91.7%
associate-+l+91.7%
associate-+l-71.8%
associate-+l-91.7%
+-commutative91.7%
+-commutative91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in t around inf 12.0%
associate--l+22.4%
Simplified22.4%
Taylor expanded in z around inf 12.2%
associate--l+19.9%
Simplified19.9%
Final simplification19.9%
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 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 91.7%
associate-+l+91.7%
associate-+l-71.8%
associate-+l-91.7%
+-commutative91.7%
+-commutative91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in t around inf 12.0%
associate--l+22.4%
Simplified22.4%
Taylor expanded in x around inf 15.7%
mul-1-neg15.7%
Simplified15.7%
Final simplification15.7%
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 (pow z -0.5)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * pow(z, -0.5);
}
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 * (z ** (-0.5d0))
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.pow(z, -0.5);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.pow(z, -0.5)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * (z ^ -0.5)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * (z ^ -0.5);
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[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot {z}^{-0.5}
\end{array}
Initial program 91.7%
associate-+l+91.7%
associate-+l-71.8%
associate-+l-91.7%
+-commutative91.7%
+-commutative91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in t around inf 12.0%
associate--l+22.4%
Simplified22.4%
Taylor expanded in z around inf 10.6%
Taylor expanded in z around 0 7.6%
pow17.6%
pow1/27.6%
inv-pow7.6%
pow-pow7.6%
metadata-eval7.6%
Applied egg-rr7.6%
unpow17.6%
Simplified7.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 x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 91.7%
associate-+l+91.7%
associate-+l-71.8%
associate-+l-91.7%
+-commutative91.7%
+-commutative91.7%
+-commutative91.7%
Simplified91.7%
flip--91.7%
add-sqr-sqrt70.9%
add-sqr-sqrt92.0%
Applied egg-rr92.0%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in x around 0 49.8%
Taylor expanded in x around inf 1.6%
neg-mul-11.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 2024172
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (sqrt t))))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))