
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (- t_4 (sqrt y)))
(t_6 (+ (+ t_3 t_5) t_1))
(t_7 (+ (* 0.5 (sqrt (/ 1.0 z))) (- t_2 (sqrt t)))))
(if (<= t_6 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) t_5) t_7)
(if (<= t_6 2.00005)
(+ t_7 (+ t_3 (/ 1.0 (+ t_4 (sqrt y)))))
(+
(+ t_5 (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))))
(+ t_1 (/ 1.0 (+ t_2 (sqrt t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt((x + 1.0)) - sqrt(x);
double t_4 = sqrt((1.0 + y));
double t_5 = t_4 - sqrt(y);
double t_6 = (t_3 + t_5) + t_1;
double t_7 = (0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t));
double tmp;
if (t_6 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + t_5) + t_7;
} else if (t_6 <= 2.00005) {
tmp = t_7 + (t_3 + (1.0 / (t_4 + sqrt(y))));
} else {
tmp = (t_5 + (1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x)))) + (t_1 + (1.0 / (t_2 + 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 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((x + 1.0d0)) - sqrt(x)
t_4 = sqrt((1.0d0 + y))
t_5 = t_4 - sqrt(y)
t_6 = (t_3 + t_5) + t_1
t_7 = (0.5d0 * sqrt((1.0d0 / z))) + (t_2 - sqrt(t))
if (t_6 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_5) + t_7
else if (t_6 <= 2.00005d0) then
tmp = t_7 + (t_3 + (1.0d0 / (t_4 + sqrt(y))))
else
tmp = (t_5 + (1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x)))) + (t_1 + (1.0d0 / (t_2 + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_4 = Math.sqrt((1.0 + y));
double t_5 = t_4 - Math.sqrt(y);
double t_6 = (t_3 + t_5) + t_1;
double t_7 = (0.5 * Math.sqrt((1.0 / z))) + (t_2 - Math.sqrt(t));
double tmp;
if (t_6 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_5) + t_7;
} else if (t_6 <= 2.00005) {
tmp = t_7 + (t_3 + (1.0 / (t_4 + Math.sqrt(y))));
} else {
tmp = (t_5 + (1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x)))) + (t_1 + (1.0 / (t_2 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + t)) t_3 = math.sqrt((x + 1.0)) - math.sqrt(x) t_4 = math.sqrt((1.0 + y)) t_5 = t_4 - math.sqrt(y) t_6 = (t_3 + t_5) + t_1 t_7 = (0.5 * math.sqrt((1.0 / z))) + (t_2 - math.sqrt(t)) tmp = 0 if t_6 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_5) + t_7 elif t_6 <= 2.00005: tmp = t_7 + (t_3 + (1.0 / (t_4 + math.sqrt(y)))) else: tmp = (t_5 + (1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)))) + (t_1 + (1.0 / (t_2 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + t)) t_3 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(t_4 - sqrt(y)) t_6 = Float64(Float64(t_3 + t_5) + t_1) t_7 = Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_2 - sqrt(t))) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_5) + t_7); elseif (t_6 <= 2.00005) tmp = Float64(t_7 + Float64(t_3 + Float64(1.0 / Float64(t_4 + sqrt(y))))); else tmp = Float64(Float64(t_5 + Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x)))) + Float64(t_1 + Float64(1.0 / Float64(t_2 + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
t_2 = sqrt((1.0 + t));
t_3 = sqrt((x + 1.0)) - sqrt(x);
t_4 = sqrt((1.0 + y));
t_5 = t_4 - sqrt(y);
t_6 = (t_3 + t_5) + t_1;
t_7 = (0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + t_5) + t_7;
elseif (t_6 <= 2.00005)
tmp = t_7 + (t_3 + (1.0 / (t_4 + sqrt(y))));
else
tmp = (t_5 + (1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x)))) + (t_1 + (1.0 / (t_2 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $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]}, Block[{t$95$6 = N[(N[(t$95$3 + t$95$5), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$7 = N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $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$5), $MachinePrecision] + t$95$7), $MachinePrecision], If[LessEqual[t$95$6, 2.00005], N[(t$95$7 + N[(t$95$3 + N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$5 + N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{x + 1} - \sqrt{x}\\
t_4 := \sqrt{1 + y}\\
t_5 := t\_4 - \sqrt{y}\\
t_6 := \left(t\_3 + t\_5\right) + t\_1\\
t_7 := 0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_2 - \sqrt{t}\right)\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_5\right) + t\_7\\
\mathbf{elif}\;t\_6 \leq 2.00005:\\
\;\;\;\;t\_7 + \left(t\_3 + \frac{1}{t\_4 + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_5 + \left(1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\right)\right) + \left(t\_1 + \frac{1}{t\_2 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0Initial program 62.9%
associate-+l+62.9%
sub-neg62.9%
sub-neg62.9%
+-commutative62.9%
+-commutative62.9%
+-commutative62.9%
Simplified62.9%
Taylor expanded in z around inf 71.7%
Taylor expanded in x around inf 82.2%
if 0.0 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.0000499999999999Initial program 96.5%
associate-+l+96.5%
sub-neg96.5%
sub-neg96.5%
+-commutative96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in z around inf 54.9%
flip--55.1%
div-inv55.1%
add-sqr-sqrt48.5%
add-sqr-sqrt55.4%
Applied egg-rr55.4%
associate-*r/55.4%
*-rgt-identity55.4%
associate--l+55.4%
+-inverses55.4%
metadata-eval55.4%
Simplified55.4%
if 2.0000499999999999 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 98.7%
associate-+l+98.7%
sub-neg98.7%
sub-neg98.7%
+-commutative98.7%
+-commutative98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 96.5%
associate--l+96.5%
*-commutative96.5%
Simplified96.5%
flip--97.0%
div-inv97.0%
add-sqr-sqrt75.6%
add-sqr-sqrt97.0%
Applied egg-rr97.0%
associate-*r/97.0%
*-rgt-identity97.0%
associate--l+97.0%
+-inverses97.0%
metadata-eval97.0%
Simplified97.0%
Final simplification64.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (- t_1 (sqrt y)))
(t_3 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_4 (* 0.5 (sqrt (/ 1.0 z))))
(t_5 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_3 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) t_2) (+ t_4 t_5))
(if (<= t_3 1.0)
(+ (+ t_3 t_2) (+ t_4 (* 0.5 (sqrt (/ 1.0 t)))))
(+
(+ t_5 (- (sqrt (+ 1.0 z)) (sqrt z)))
(+ 1.0 (- t_1 (+ (sqrt x) (sqrt y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = t_1 - sqrt(y);
double t_3 = sqrt((x + 1.0)) - sqrt(x);
double t_4 = 0.5 * sqrt((1.0 / z));
double t_5 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_3 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + t_2) + (t_4 + t_5);
} else if (t_3 <= 1.0) {
tmp = (t_3 + t_2) + (t_4 + (0.5 * sqrt((1.0 / t))));
} else {
tmp = (t_5 + (sqrt((1.0 + z)) - sqrt(z))) + (1.0 + (t_1 - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: 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 + y))
t_2 = t_1 - sqrt(y)
t_3 = sqrt((x + 1.0d0)) - sqrt(x)
t_4 = 0.5d0 * sqrt((1.0d0 / z))
t_5 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_3 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_2) + (t_4 + t_5)
else if (t_3 <= 1.0d0) then
tmp = (t_3 + t_2) + (t_4 + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = (t_5 + (sqrt((1.0d0 + z)) - sqrt(z))) + (1.0d0 + (t_1 - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = t_1 - Math.sqrt(y);
double t_3 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_4 = 0.5 * Math.sqrt((1.0 / z));
double t_5 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_3 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_2) + (t_4 + t_5);
} else if (t_3 <= 1.0) {
tmp = (t_3 + t_2) + (t_4 + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = (t_5 + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (1.0 + (t_1 - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = t_1 - math.sqrt(y) t_3 = math.sqrt((x + 1.0)) - math.sqrt(x) t_4 = 0.5 * math.sqrt((1.0 / z)) t_5 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_3 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_2) + (t_4 + t_5) elif t_3 <= 1.0: tmp = (t_3 + t_2) + (t_4 + (0.5 * math.sqrt((1.0 / t)))) else: tmp = (t_5 + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (1.0 + (t_1 - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(t_1 - sqrt(y)) t_3 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_4 = Float64(0.5 * sqrt(Float64(1.0 / z))) t_5 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_2) + Float64(t_4 + t_5)); elseif (t_3 <= 1.0) tmp = Float64(Float64(t_3 + t_2) + Float64(t_4 + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(t_5 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(1.0 + Float64(t_1 - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = t_1 - sqrt(y);
t_3 = sqrt((x + 1.0)) - sqrt(x);
t_4 = 0.5 * sqrt((1.0 / z));
t_5 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_3 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + t_2) + (t_4 + t_5);
elseif (t_3 <= 1.0)
tmp = (t_3 + t_2) + (t_4 + (0.5 * sqrt((1.0 / t))));
else
tmp = (t_5 + (sqrt((1.0 + z)) - sqrt(z))) + (1.0 + (t_1 - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(t$95$4 + t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1.0], N[(N[(t$95$3 + t$95$2), $MachinePrecision] + N[(t$95$4 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$5 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := t\_1 - \sqrt{y}\\
t_3 := \sqrt{x + 1} - \sqrt{x}\\
t_4 := 0.5 \cdot \sqrt{\frac{1}{z}}\\
t_5 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_2\right) + \left(t\_4 + t\_5\right)\\
\mathbf{elif}\;t\_3 \leq 1:\\
\;\;\;\;\left(t\_3 + t\_2\right) + \left(t\_4 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_5 + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(1 + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 88.7%
associate-+l+88.7%
sub-neg88.7%
sub-neg88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in z around inf 49.5%
Taylor expanded in x around inf 52.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 1Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in z around inf 48.1%
Taylor expanded in t around inf 27.6%
if 1 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in x around 0 42.5%
associate--l+52.8%
Simplified52.8%
Final simplification38.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 y)) (sqrt y)))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_2 0.0)
(+ (+ (* 0.5 (sqrt (/ 1.0 x))) t_1) (+ (* 0.5 (sqrt (/ 1.0 z))) t_3))
(+ (+ t_2 t_1) (+ t_3 (/ 1.0 (+ (sqrt (+ 1.0 z)) (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 + y)) - sqrt(y);
double t_2 = sqrt((x + 1.0)) - sqrt(x);
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_2 <= 0.0) {
tmp = ((0.5 * sqrt((1.0 / x))) + t_1) + ((0.5 * sqrt((1.0 / z))) + t_3);
} else {
tmp = (t_2 + t_1) + (t_3 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + y)) - sqrt(y)
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_2 <= 0.0d0) then
tmp = ((0.5d0 * sqrt((1.0d0 / x))) + t_1) + ((0.5d0 * sqrt((1.0d0 / z))) + t_3)
else
tmp = (t_2 + t_1) + (t_3 + (1.0d0 / (sqrt((1.0d0 + z)) + 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 + 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);
double tmp;
if (t_2 <= 0.0) {
tmp = ((0.5 * Math.sqrt((1.0 / x))) + t_1) + ((0.5 * Math.sqrt((1.0 / z))) + t_3);
} else {
tmp = (t_2 + t_1) + (t_3 + (1.0 / (Math.sqrt((1.0 + z)) + 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 + y)) - math.sqrt(y) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_2 <= 0.0: tmp = ((0.5 * math.sqrt((1.0 / x))) + t_1) + ((0.5 * math.sqrt((1.0 / z))) + t_3) else: tmp = (t_2 + t_1) + (t_3 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) t_2 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_1) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + t_3)); else tmp = Float64(Float64(t_2 + t_1) + Float64(t_3 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + 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 + y)) - sqrt(y);
t_2 = sqrt((x + 1.0)) - sqrt(x);
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_2 <= 0.0)
tmp = ((0.5 * sqrt((1.0 / x))) + t_1) + ((0.5 * sqrt((1.0 / z))) + t_3);
else
tmp = (t_2 + t_1) + (t_3 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $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[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $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] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + t$95$1), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y} - \sqrt{y}\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{x}} + t\_1\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + t\_1\right) + \left(t\_3 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 88.7%
associate-+l+88.7%
sub-neg88.7%
sub-neg88.7%
+-commutative88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in z around inf 49.5%
Taylor expanded in x around inf 52.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
flip--97.3%
div-inv97.3%
add-sqr-sqrt79.8%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate-*r/97.7%
*-rgt-identity97.7%
associate--l+97.9%
+-inverses97.9%
metadata-eval97.9%
Simplified97.9%
Final simplification77.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= z 2.15e+15)
(+
(+ t_2 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(- (+ 1.0 t_1) (+ (sqrt x) (sqrt y))))
(+
(+ (* 0.5 (sqrt (/ 1.0 z))) t_2)
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (/ 1.0 (+ t_1 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (z <= 2.15e+15) {
tmp = (t_2 + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((0.5 * sqrt((1.0 / z))) + t_2) + ((sqrt((x + 1.0)) - sqrt(x)) + (1.0 / (t_1 + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
if (z <= 2.15d+15) then
tmp = (t_2 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + ((1.0d0 + t_1) - (sqrt(x) + sqrt(y)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / z))) + t_2) + ((sqrt((x + 1.0d0)) - sqrt(x)) + (1.0d0 / (t_1 + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (z <= 2.15e+15) {
tmp = (t_2 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) + ((1.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / z))) + t_2) + ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (1.0 / (t_1 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if z <= 2.15e+15: tmp = (t_2 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) + ((1.0 + t_1) - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((0.5 * math.sqrt((1.0 / z))) + t_2) + ((math.sqrt((x + 1.0)) - math.sqrt(x)) + (1.0 / (t_1 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (z <= 2.15e+15) tmp = Float64(Float64(t_2 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(Float64(1.0 + t_1) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + t_2) + Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(1.0 / Float64(t_1 + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (z <= 2.15e+15)
tmp = (t_2 + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
else
tmp = ((0.5 * sqrt((1.0 / z))) + t_2) + ((sqrt((x + 1.0)) - sqrt(x)) + (1.0 / (t_1 + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2.15e+15], N[(N[(t$95$2 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;z \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;\left(t\_2 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{z}} + t\_2\right) + \left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \frac{1}{t\_1 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if z < 2.15e15Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.5%
div-inv97.5%
add-sqr-sqrt97.6%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate-*r/97.9%
*-rgt-identity97.9%
associate--l+97.9%
+-inverses97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in x around 0 45.7%
if 2.15e15 < z Initial program 89.1%
associate-+l+89.1%
sub-neg89.1%
sub-neg89.1%
+-commutative89.1%
+-commutative89.1%
+-commutative89.1%
Simplified89.1%
Taylor expanded in z around inf 92.2%
flip--92.4%
div-inv92.4%
add-sqr-sqrt75.6%
add-sqr-sqrt92.9%
Applied egg-rr92.9%
associate-*r/92.9%
*-rgt-identity92.9%
associate--l+95.7%
+-inverses95.7%
metadata-eval95.7%
Simplified95.7%
Final simplification68.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= y 63000.0)
(+
(+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))))
(+
(+ (* 0.5 (sqrt (/ 1.0 z))) t_1)
(- (+ (sqrt (+ x 1.0)) (* 0.5 (sqrt (/ 1.0 y)))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (y <= 63000.0) {
tmp = (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((0.5 * sqrt((1.0 / z))) + t_1) + ((sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) - sqrt(t)
if (y <= 63000.0d0) then
tmp = (t_1 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) + ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y)))
else
tmp = ((0.5d0 * sqrt((1.0d0 / z))) + t_1) + ((sqrt((x + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / y)))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (y <= 63000.0) {
tmp = (t_1 + (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 = ((0.5 * Math.sqrt((1.0 / z))) + t_1) + ((Math.sqrt((x + 1.0)) + (0.5 * Math.sqrt((1.0 / y)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if y <= 63000.0: tmp = (t_1 + (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 = ((0.5 * math.sqrt((1.0 / z))) + t_1) + ((math.sqrt((x + 1.0)) + (0.5 * math.sqrt((1.0 / y)))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (y <= 63000.0) tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + t_1) + Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / y)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (y <= 63000.0)
tmp = (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
else
tmp = ((0.5 * sqrt((1.0 / z))) + t_1) + ((sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 63000.0], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $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 + t} - \sqrt{t}\\
\mathbf{if}\;y \leq 63000:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) + \left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{z}} + t\_1\right) + \left(\left(\sqrt{x + 1} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 63000Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.5%
div-inv97.5%
add-sqr-sqrt75.5%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in x around 0 56.7%
if 63000 < y Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 39.5%
Taylor expanded in y around inf 40.1%
Final simplification49.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ x 1.0))))
(if (<= z 4.5e-28)
(+
3.0
(- (sqrt (+ 1.0 t)) (+ (sqrt t) (+ (sqrt y) (+ (sqrt x) (sqrt z))))))
(if (<= z 2400000000.0)
(-
(+ t_2 (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(+ (sqrt x) (sqrt y)))
(+
(+ (- t_2 (sqrt x)) (- t_1 (sqrt y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((x + 1.0));
double tmp;
if (z <= 4.5e-28) {
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
} else if (z <= 2400000000.0) {
tmp = (t_2 + (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y));
} else {
tmp = ((t_2 - sqrt(x)) + (t_1 - sqrt(y))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((x + 1.0d0))
if (z <= 4.5d-28) then
tmp = 3.0d0 + (sqrt((1.0d0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))))
else if (z <= 2400000000.0d0) then
tmp = (t_2 + (t_1 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y))
else
tmp = ((t_2 - sqrt(x)) + (t_1 - sqrt(y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (z <= 4.5e-28) {
tmp = 3.0 + (Math.sqrt((1.0 + t)) - (Math.sqrt(t) + (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)))));
} else if (z <= 2400000000.0) {
tmp = (t_2 + (t_1 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = ((t_2 - Math.sqrt(x)) + (t_1 - Math.sqrt(y))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if z <= 4.5e-28: tmp = 3.0 + (math.sqrt((1.0 + t)) - (math.sqrt(t) + (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))))) elif z <= 2400000000.0: tmp = (t_2 + (t_1 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = ((t_2 - math.sqrt(x)) + (t_1 - math.sqrt(y))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (z <= 4.5e-28) tmp = Float64(3.0 + Float64(sqrt(Float64(1.0 + t)) - Float64(sqrt(t) + Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))))); elseif (z <= 2400000000.0) tmp = Float64(Float64(t_2 + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(Float64(t_2 - sqrt(x)) + Float64(t_1 - sqrt(y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (z <= 4.5e-28)
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
elseif (z <= 2400000000.0)
tmp = (t_2 + (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - (sqrt(x) + sqrt(y));
else
tmp = ((t_2 - sqrt(x)) + (t_1 - sqrt(y))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4.5e-28], N[(3.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2400000000.0], N[(N[(t$95$2 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 4.5 \cdot 10^{-28}:\\
\;\;\;\;3 + \left(\sqrt{1 + t} - \left(\sqrt{t} + \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;z \leq 2400000000:\\
\;\;\;\;\left(t\_2 + \left(t\_1 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if z < 4.4999999999999998e-28Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in y around 0 17.4%
associate--l+29.5%
+-commutative29.5%
Simplified29.5%
Taylor expanded in x around 0 16.8%
+-commutative16.8%
Simplified16.8%
Taylor expanded in z around 0 16.8%
associate--l+32.3%
+-commutative32.3%
associate-+r+32.3%
+-commutative32.3%
associate-+r+32.3%
Simplified32.3%
if 4.4999999999999998e-28 < z < 2.4e9Initial program 93.9%
associate-+l+93.9%
sub-neg93.9%
sub-neg93.9%
+-commutative93.9%
+-commutative93.9%
+-commutative93.9%
Simplified93.9%
flip--96.0%
div-inv96.0%
add-sqr-sqrt95.4%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate-*r/97.8%
*-rgt-identity97.8%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in t around inf 23.1%
if 2.4e9 < z Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 92.2%
Taylor expanded in t around inf 47.4%
Final simplification38.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 44000000.0)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(- (+ (* x (+ 0.5 (* x -0.125))) 2.0) (+ (sqrt x) (sqrt y))))
(+
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 44000000.0) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 44000000.0d0) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t)))) + (((x * (0.5d0 + (x * (-0.125d0)))) + 2.0d0) - (sqrt(x) + sqrt(y)))
else
tmp = ((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 44000000.0) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 44000000.0: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 44000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))) + Float64(Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) + 2.0) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 44000000.0)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (sqrt(x) + sqrt(y)));
else
tmp = ((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 44000000.0], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 44000000:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) + \left(\left(x \cdot \left(0.5 + x \cdot -0.125\right) + 2\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if z < 4.4e7Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 56.8%
associate--l+56.8%
*-commutative56.8%
Simplified56.8%
flip--57.2%
div-inv57.2%
add-sqr-sqrt47.0%
add-sqr-sqrt57.2%
Applied egg-rr57.2%
associate-*r/57.2%
*-rgt-identity57.2%
associate--l+57.2%
+-inverses57.2%
metadata-eval57.2%
Simplified57.2%
Taylor expanded in y around 0 30.2%
if 4.4e7 < z Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in z around inf 92.2%
Taylor expanded in t around inf 46.8%
Final simplification38.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 44000000.0)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z)))
(- (+ (* x (+ 0.5 (* x -0.125))) 2.0) (+ (sqrt x) (sqrt y))))
(+
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ 1.0 y)) (sqrt y)))
(+ (* 0.5 (sqrt (/ 1.0 z))) (* 0.5 (sqrt (/ 1.0 t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 44000000.0) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 44000000.0d0) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z))) + (((x * (0.5d0 + (x * (-0.125d0)))) + 2.0d0) - (sqrt(x) + sqrt(y)))
else
tmp = ((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((1.0d0 + y)) - sqrt(y))) + ((0.5d0 * sqrt((1.0d0 / z))) + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 44000000.0) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + ((0.5 * Math.sqrt((1.0 / z))) + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 44000000.0: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) + ((0.5 * math.sqrt((1.0 / z))) + (0.5 * math.sqrt((1.0 / t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 44000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) + 2.0) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 44000000.0)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + (((x * (0.5 + (x * -0.125))) + 2.0) - (sqrt(x) + sqrt(y)));
else
tmp = ((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((1.0 + y)) - sqrt(y))) + ((0.5 * sqrt((1.0 / z))) + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 44000000.0], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 44000000:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(\left(x \cdot \left(0.5 + x \cdot -0.125\right) + 2\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if z < 4.4e7Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 56.8%
associate--l+56.8%
*-commutative56.8%
Simplified56.8%
Taylor expanded in y around 0 30.0%
if 4.4e7 < z Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in z around inf 92.2%
Taylor expanded in t around inf 46.8%
Final simplification38.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (+ (sqrt x) (sqrt y)))
(t_3 (sqrt (+ x 1.0))))
(if (<= z 3.8e-27)
(+
3.0
(- (sqrt (+ 1.0 t)) (+ (sqrt t) (+ (sqrt y) (+ (sqrt x) (sqrt z))))))
(if (<= z 2400000000.0)
(- (+ t_3 (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))) t_2)
(+ t_3 (+ t_1 (- (* 0.5 (sqrt (/ 1.0 z))) 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 + y));
double t_2 = sqrt(x) + sqrt(y);
double t_3 = sqrt((x + 1.0));
double tmp;
if (z <= 3.8e-27) {
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
} else if (z <= 2400000000.0) {
tmp = (t_3 + (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - t_2;
} else {
tmp = t_3 + (t_1 + ((0.5 * sqrt((1.0 / z))) - 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 + y))
t_2 = sqrt(x) + sqrt(y)
t_3 = sqrt((x + 1.0d0))
if (z <= 3.8d-27) then
tmp = 3.0d0 + (sqrt((1.0d0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))))
else if (z <= 2400000000.0d0) then
tmp = (t_3 + (t_1 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))) - t_2
else
tmp = t_3 + (t_1 + ((0.5d0 * sqrt((1.0d0 / z))) - 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 + y));
double t_2 = Math.sqrt(x) + Math.sqrt(y);
double t_3 = Math.sqrt((x + 1.0));
double tmp;
if (z <= 3.8e-27) {
tmp = 3.0 + (Math.sqrt((1.0 + t)) - (Math.sqrt(t) + (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)))));
} else if (z <= 2400000000.0) {
tmp = (t_3 + (t_1 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))))) - t_2;
} else {
tmp = t_3 + (t_1 + ((0.5 * Math.sqrt((1.0 / z))) - 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 + y)) t_2 = math.sqrt(x) + math.sqrt(y) t_3 = math.sqrt((x + 1.0)) tmp = 0 if z <= 3.8e-27: tmp = 3.0 + (math.sqrt((1.0 + t)) - (math.sqrt(t) + (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))))) elif z <= 2400000000.0: tmp = (t_3 + (t_1 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))) - t_2 else: tmp = t_3 + (t_1 + ((0.5 * math.sqrt((1.0 / z))) - 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 + y)) t_2 = Float64(sqrt(x) + sqrt(y)) t_3 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (z <= 3.8e-27) tmp = Float64(3.0 + Float64(sqrt(Float64(1.0 + t)) - Float64(sqrt(t) + Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))))); elseif (z <= 2400000000.0) tmp = Float64(Float64(t_3 + Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))) - t_2); else tmp = Float64(t_3 + Float64(t_1 + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) - 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 + y));
t_2 = sqrt(x) + sqrt(y);
t_3 = sqrt((x + 1.0));
tmp = 0.0;
if (z <= 3.8e-27)
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
elseif (z <= 2400000000.0)
tmp = (t_3 + (t_1 + (1.0 / (sqrt((1.0 + z)) + sqrt(z))))) - t_2;
else
tmp = t_3 + (t_1 + ((0.5 * sqrt((1.0 / z))) - 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 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3.8e-27], N[(3.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2400000000.0], N[(N[(t$95$3 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], N[(t$95$3 + N[(t$95$1 + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x} + \sqrt{y}\\
t_3 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 3.8 \cdot 10^{-27}:\\
\;\;\;\;3 + \left(\sqrt{1 + t} - \left(\sqrt{t} + \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;z \leq 2400000000:\\
\;\;\;\;\left(t\_3 + \left(t\_1 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\right) - t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} - t\_2\right)\right)\\
\end{array}
\end{array}
if z < 3.8e-27Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in y around 0 17.2%
associate--l+29.7%
+-commutative29.7%
Simplified29.7%
Taylor expanded in x around 0 16.5%
+-commutative16.5%
Simplified16.5%
Taylor expanded in z around 0 16.5%
associate--l+31.8%
+-commutative31.8%
associate-+r+31.8%
+-commutative31.8%
associate-+r+31.8%
Simplified31.8%
if 3.8e-27 < z < 2.4e9Initial program 93.2%
associate-+l+93.2%
sub-neg93.2%
sub-neg93.2%
+-commutative93.2%
+-commutative93.2%
+-commutative93.2%
Simplified93.2%
flip--95.7%
div-inv95.7%
add-sqr-sqrt95.0%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
Simplified97.5%
Taylor expanded in t around inf 25.2%
if 2.4e9 < z Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in t around inf 4.4%
associate--l+17.1%
Simplified17.1%
Taylor expanded in z around inf 25.4%
associate--l+32.4%
associate--l+32.4%
Simplified32.4%
Final simplification31.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))))
(if (<= z 3.7e-26)
(+
3.0
(- (sqrt (+ 1.0 t)) (+ (sqrt t) (+ (sqrt y) (+ (sqrt x) (sqrt z))))))
(if (<= z 350000000000.0)
(+
(- (+ (* x (+ 0.5 (* x -0.125))) 2.0) t_1)
(+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) (* 0.5 (sqrt (/ 1.0 t)))))
(+
(sqrt (+ x 1.0))
(+ (sqrt (+ 1.0 y)) (- (* 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 tmp;
if (z <= 3.7e-26) {
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
} else if (z <= 350000000000.0) {
tmp = (((x * (0.5 + (x * -0.125))) + 2.0) - t_1) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (0.5 * sqrt((1.0 / t))));
} else {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) + ((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) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (z <= 3.7d-26) then
tmp = 3.0d0 + (sqrt((1.0d0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))))
else if (z <= 350000000000.0d0) then
tmp = (((x * (0.5d0 + (x * (-0.125d0)))) + 2.0d0) - t_1) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) + ((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 tmp;
if (z <= 3.7e-26) {
tmp = 3.0 + (Math.sqrt((1.0 + t)) - (Math.sqrt(t) + (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)))));
} else if (z <= 350000000000.0) {
tmp = (((x * (0.5 + (x * -0.125))) + 2.0) - t_1) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) + ((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) tmp = 0 if z <= 3.7e-26: tmp = 3.0 + (math.sqrt((1.0 + t)) - (math.sqrt(t) + (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))))) elif z <= 350000000000.0: tmp = (((x * (0.5 + (x * -0.125))) + 2.0) - t_1) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (0.5 * math.sqrt((1.0 / t)))) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) + ((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)) tmp = 0.0 if (z <= 3.7e-26) tmp = Float64(3.0 + Float64(sqrt(Float64(1.0 + t)) - Float64(sqrt(t) + Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))))); elseif (z <= 350000000000.0) tmp = Float64(Float64(Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) + 2.0) - t_1) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) + Float64(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);
tmp = 0.0;
if (z <= 3.7e-26)
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
elseif (z <= 350000000000.0)
tmp = (((x * (0.5 + (x * -0.125))) + 2.0) - t_1) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (0.5 * sqrt((1.0 / t))));
else
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) + ((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]}, If[LessEqual[z, 3.7e-26], N[(3.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 350000000000.0], N[(N[(N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - t$95$1), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 3.7 \cdot 10^{-26}:\\
\;\;\;\;3 + \left(\sqrt{1 + t} - \left(\sqrt{t} + \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;z \leq 350000000000:\\
\;\;\;\;\left(\left(x \cdot \left(0.5 + x \cdot -0.125\right) + 2\right) - t\_1\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} + \left(0.5 \cdot \sqrt{\frac{1}{z}} - t\_1\right)\right)\\
\end{array}
\end{array}
if z < 3.6999999999999999e-26Initial program 98.0%
associate-+l+98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in y around 0 17.2%
associate--l+29.7%
+-commutative29.7%
Simplified29.7%
Taylor expanded in x around 0 16.5%
+-commutative16.5%
Simplified16.5%
Taylor expanded in z around 0 16.5%
associate--l+31.8%
+-commutative31.8%
associate-+r+31.8%
+-commutative31.8%
associate-+r+31.8%
Simplified31.8%
if 3.6999999999999999e-26 < z < 3.5e11Initial program 92.4%
associate-+l+92.4%
sub-neg92.4%
sub-neg92.4%
+-commutative92.4%
+-commutative92.4%
+-commutative92.4%
Simplified92.4%
Taylor expanded in x around 0 47.6%
associate--l+47.6%
*-commutative47.6%
Simplified47.6%
Taylor expanded in t around inf 30.7%
flip--94.7%
div-inv94.7%
add-sqr-sqrt95.2%
add-sqr-sqrt97.7%
Applied egg-rr31.8%
associate-*r/97.7%
*-rgt-identity97.7%
associate--l+97.7%
+-inverses97.7%
metadata-eval97.7%
Simplified31.8%
Taylor expanded in y around 0 21.3%
if 3.5e11 < z Initial program 89.1%
associate-+l+89.1%
sub-neg89.1%
sub-neg89.1%
+-commutative89.1%
+-commutative89.1%
+-commutative89.1%
Simplified89.1%
Taylor expanded in t around inf 4.4%
associate--l+17.2%
Simplified17.2%
Taylor expanded in z around inf 25.5%
associate--l+32.6%
associate--l+32.6%
Simplified32.6%
Final simplification31.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 4e-28)
(+ 3.0 (- (sqrt (+ 1.0 t)) (+ (sqrt t) (+ (sqrt y) (+ (sqrt x) (sqrt z))))))
(if (<= z 44000000.0)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* 0.5 y)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
(sqrt (+ x 1.0))
(+
(sqrt (+ 1.0 y))
(- (* 0.5 (sqrt (/ 1.0 z))) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4e-28) {
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
} else if (z <= 44000000.0) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) + ((0.5 * sqrt((1.0 / z))) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 4d-28) then
tmp = 3.0d0 + (sqrt((1.0d0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))))
else if (z <= 44000000.0d0) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (0.5d0 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) + ((0.5d0 * sqrt((1.0d0 / z))) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4e-28) {
tmp = 3.0 + (Math.sqrt((1.0 + t)) - (Math.sqrt(t) + (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)))));
} else if (z <= 44000000.0) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (0.5 * y)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) + ((0.5 * Math.sqrt((1.0 / z))) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 4e-28: tmp = 3.0 + (math.sqrt((1.0 + t)) - (math.sqrt(t) + (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))))) elif z <= 44000000.0: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (0.5 * y)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) + ((0.5 * math.sqrt((1.0 / z))) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 4e-28) tmp = Float64(3.0 + Float64(sqrt(Float64(1.0 + t)) - Float64(sqrt(t) + Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))))); elseif (z <= 44000000.0) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(0.5 * y)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 4e-28)
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
elseif (z <= 44000000.0)
tmp = 2.0 + ((sqrt((1.0 + z)) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) + ((0.5 * sqrt((1.0 / z))) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 4e-28], N[(3.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 44000000.0], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4 \cdot 10^{-28}:\\
\;\;\;\;3 + \left(\sqrt{1 + t} - \left(\sqrt{t} + \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;z \leq 44000000:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + 0.5 \cdot y\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} + \left(0.5 \cdot \sqrt{\frac{1}{z}} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if z < 3.99999999999999988e-28Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in y around 0 17.4%
associate--l+29.5%
+-commutative29.5%
Simplified29.5%
Taylor expanded in x around 0 16.8%
+-commutative16.8%
Simplified16.8%
Taylor expanded in z around 0 16.8%
associate--l+32.3%
+-commutative32.3%
associate-+r+32.3%
+-commutative32.3%
associate-+r+32.3%
Simplified32.3%
if 3.99999999999999988e-28 < z < 4.4e7Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 21.0%
associate--l+25.2%
Simplified25.2%
Taylor expanded in x around 0 20.4%
associate--l+28.0%
associate-+r-27.9%
+-commutative27.9%
Simplified27.9%
Taylor expanded in y around 0 21.2%
associate--l+21.3%
*-commutative21.3%
Simplified21.3%
if 4.4e7 < z Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in t around inf 5.2%
associate--l+17.5%
Simplified17.5%
Taylor expanded in z around inf 25.5%
associate--l+32.4%
associate--l+32.5%
Simplified32.5%
Final simplification31.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 3.7e-28)
(+ 3.0 (- (sqrt (+ 1.0 t)) (+ (sqrt t) (+ (sqrt y) (+ (sqrt x) (sqrt z))))))
(if (<= z 44000000.0)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* 0.5 y)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
1.0
(+
(sqrt (+ 1.0 y))
(- (* 0.5 (sqrt (/ 1.0 z))) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.7e-28) {
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
} else if (z <= 44000000.0) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) + ((0.5 * sqrt((1.0 / z))) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3.7d-28) then
tmp = 3.0d0 + (sqrt((1.0d0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))))
else if (z <= 44000000.0d0) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (0.5d0 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((0.5d0 * sqrt((1.0d0 / z))) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.7e-28) {
tmp = 3.0 + (Math.sqrt((1.0 + t)) - (Math.sqrt(t) + (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)))));
} else if (z <= 44000000.0) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (0.5 * y)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((0.5 * Math.sqrt((1.0 / z))) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3.7e-28: tmp = 3.0 + (math.sqrt((1.0 + t)) - (math.sqrt(t) + (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))))) elif z <= 44000000.0: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (0.5 * y)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((0.5 * math.sqrt((1.0 / z))) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3.7e-28) tmp = Float64(3.0 + Float64(sqrt(Float64(1.0 + t)) - Float64(sqrt(t) + Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))))); elseif (z <= 44000000.0) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(0.5 * y)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3.7e-28)
tmp = 3.0 + (sqrt((1.0 + t)) - (sqrt(t) + (sqrt(y) + (sqrt(x) + sqrt(z)))));
elseif (z <= 44000000.0)
tmp = 2.0 + ((sqrt((1.0 + z)) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = 1.0 + (sqrt((1.0 + y)) + ((0.5 * sqrt((1.0 / z))) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3.7e-28], N[(3.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 44000000.0], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.7 \cdot 10^{-28}:\\
\;\;\;\;3 + \left(\sqrt{1 + t} - \left(\sqrt{t} + \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{elif}\;z \leq 44000000:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + 0.5 \cdot y\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(0.5 \cdot \sqrt{\frac{1}{z}} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if z < 3.7000000000000002e-28Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in y around 0 17.4%
associate--l+29.5%
+-commutative29.5%
Simplified29.5%
Taylor expanded in x around 0 16.8%
+-commutative16.8%
Simplified16.8%
Taylor expanded in z around 0 16.8%
associate--l+32.3%
+-commutative32.3%
associate-+r+32.3%
+-commutative32.3%
associate-+r+32.3%
Simplified32.3%
if 3.7000000000000002e-28 < z < 4.4e7Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 21.0%
associate--l+25.2%
Simplified25.2%
Taylor expanded in x around 0 20.4%
associate--l+28.0%
associate-+r-27.9%
+-commutative27.9%
Simplified27.9%
Taylor expanded in y around 0 21.2%
associate--l+21.3%
*-commutative21.3%
Simplified21.3%
if 4.4e7 < z Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in t around inf 5.2%
associate--l+17.5%
Simplified17.5%
Taylor expanded in x around 0 4.3%
associate--l+26.2%
associate-+r-32.5%
+-commutative32.5%
Simplified32.5%
Taylor expanded in z around inf 34.2%
+-commutative34.2%
Simplified34.2%
Final simplification32.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt x) (sqrt y))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 8.6e-29)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1)))
(if (<= y 5e+14) (+ t_2 (- (sqrt (+ 1.0 y)) t_1)) (- t_2 (sqrt x))))))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((x + 1.0));
double tmp;
if (y <= 8.6e-29) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
} else if (y <= 5e+14) {
tmp = t_2 + (sqrt((1.0 + y)) - t_1);
} else {
tmp = t_2 - 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) :: t_2
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
t_2 = sqrt((x + 1.0d0))
if (y <= 8.6d-29) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + t_1))
else if (y <= 5d+14) then
tmp = t_2 + (sqrt((1.0d0 + y)) - t_1)
else
tmp = t_2 - 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) + Math.sqrt(y);
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 8.6e-29) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1));
} else if (y <= 5e+14) {
tmp = t_2 + (Math.sqrt((1.0 + y)) - t_1);
} else {
tmp = t_2 - 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) + math.sqrt(y) t_2 = math.sqrt((x + 1.0)) tmp = 0 if y <= 8.6e-29: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1)) elif y <= 5e+14: tmp = t_2 + (math.sqrt((1.0 + y)) - t_1) else: tmp = t_2 - math.sqrt(x) 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(x + 1.0)) tmp = 0.0 if (y <= 8.6e-29) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1))); elseif (y <= 5e+14) tmp = Float64(t_2 + Float64(sqrt(Float64(1.0 + y)) - t_1)); else tmp = Float64(t_2 - 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) + sqrt(y);
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 8.6e-29)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
elseif (y <= 5e+14)
tmp = t_2 + (sqrt((1.0 + y)) - t_1);
else
tmp = t_2 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 8.6e-29], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+14], N[(t$95$2 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$2 - N[Sqrt[x], $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{x + 1}\\
\mathbf{if}\;y \leq 8.6 \cdot 10^{-29}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t\_2 + \left(\sqrt{1 + y} - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 - \sqrt{x}\\
\end{array}
\end{array}
if y < 8.5999999999999996e-29Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in t around inf 22.9%
associate--l+27.5%
Simplified27.5%
Taylor expanded in x around 0 20.2%
associate--l+27.1%
associate-+r-40.0%
+-commutative40.0%
Simplified40.0%
Taylor expanded in y around 0 20.2%
associate--l+40.0%
associate-+r+40.0%
+-commutative40.0%
Simplified40.0%
if 8.5999999999999996e-29 < y < 5e14Initial program 94.4%
associate-+l+94.3%
sub-neg94.3%
sub-neg94.3%
+-commutative94.3%
+-commutative94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in t around inf 28.8%
associate--l+33.5%
Simplified33.5%
Taylor expanded in z around inf 22.2%
associate--l+22.2%
Simplified22.2%
if 5e14 < y Initial program 89.4%
associate-+l+89.4%
sub-neg89.4%
sub-neg89.4%
+-commutative89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 3.7%
associate--l+16.6%
Simplified16.6%
Taylor expanded in x around inf 16.4%
mul-1-neg16.4%
Simplified16.4%
Final simplification27.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 (<= z 44000000.0)
(+
2.0
(- (+ (sqrt (+ 1.0 z)) (* 0.5 y)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(+
1.0
(+ (sqrt (+ 1.0 y)) (- (* 0.5 (sqrt (/ 1.0 z))) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 44000000.0) {
tmp = 2.0 + ((sqrt((1.0 + z)) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) + ((0.5 * sqrt((1.0 / z))) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 44000000.0d0) then
tmp = 2.0d0 + ((sqrt((1.0d0 + z)) + (0.5d0 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((0.5d0 * sqrt((1.0d0 / z))) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 44000000.0) {
tmp = 2.0 + ((Math.sqrt((1.0 + z)) + (0.5 * y)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((0.5 * Math.sqrt((1.0 / z))) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 44000000.0: tmp = 2.0 + ((math.sqrt((1.0 + z)) + (0.5 * y)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((0.5 * math.sqrt((1.0 / z))) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 44000000.0) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + z)) + Float64(0.5 * y)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 44000000.0)
tmp = 2.0 + ((sqrt((1.0 + z)) + (0.5 * y)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = 1.0 + (sqrt((1.0 + y)) + ((0.5 * sqrt((1.0 / z))) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 44000000.0], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 44000000:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + z} + 0.5 \cdot y\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(0.5 \cdot \sqrt{\frac{1}{z}} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if z < 4.4e7Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 24.2%
associate--l+28.5%
Simplified28.5%
Taylor expanded in x around 0 22.0%
associate--l+28.6%
associate-+r-28.6%
+-commutative28.6%
Simplified28.6%
Taylor expanded in y around 0 20.6%
associate--l+20.6%
*-commutative20.6%
Simplified20.6%
if 4.4e7 < z Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in t around inf 5.2%
associate--l+17.5%
Simplified17.5%
Taylor expanded in x around 0 4.3%
associate--l+26.2%
associate-+r-32.5%
+-commutative32.5%
Simplified32.5%
Taylor expanded in z around inf 34.2%
+-commutative34.2%
Simplified34.2%
Final simplification27.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 x) (sqrt y))))
(if (<= z 44000000.0)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1)))
(+ 1.0 (+ (sqrt (+ 1.0 y)) (- (* 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 tmp;
if (z <= 44000000.0) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) + ((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) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (z <= 44000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + t_1))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((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 tmp;
if (z <= 44000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((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) tmp = 0 if z <= 44000000.0: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((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)) tmp = 0.0 if (z <= 44000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(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);
tmp = 0.0;
if (z <= 44000000.0)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
else
tmp = 1.0 + (sqrt((1.0 + y)) + ((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]}, If[LessEqual[z, 44000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 44000000:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(0.5 \cdot \sqrt{\frac{1}{z}} - t\_1\right)\right)\\
\end{array}
\end{array}
if z < 4.4e7Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 24.2%
associate--l+28.5%
Simplified28.5%
Taylor expanded in x around 0 22.0%
associate--l+28.6%
associate-+r-28.6%
+-commutative28.6%
Simplified28.6%
Taylor expanded in y around 0 18.9%
associate--l+18.9%
associate-+r+18.9%
+-commutative18.9%
Simplified18.9%
if 4.4e7 < z Initial program 88.9%
associate-+l+88.9%
sub-neg88.9%
sub-neg88.9%
+-commutative88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
Taylor expanded in t around inf 5.2%
associate--l+17.5%
Simplified17.5%
Taylor expanded in x around 0 4.3%
associate--l+26.2%
associate-+r-32.5%
+-commutative32.5%
Simplified32.5%
Taylor expanded in z around inf 34.2%
+-commutative34.2%
Simplified34.2%
Final simplification26.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 x) (sqrt y))))
(if (<= y 8.6e-29)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1)))
(if (<= y 4e+15)
(+ 1.0 (- (sqrt (+ 1.0 y)) t_1))
(- (sqrt (+ x 1.0)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (y <= 8.6e-29) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
} else if (y <= 4e+15) {
tmp = 1.0 + (sqrt((1.0 + y)) - t_1);
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (y <= 8.6d-29) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + t_1))
else if (y <= 4d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - t_1)
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (y <= 8.6e-29) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1));
} else if (y <= 4e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - t_1);
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if y <= 8.6e-29: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1)) elif y <= 4e+15: tmp = 1.0 + (math.sqrt((1.0 + y)) - t_1) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (y <= 8.6e-29) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1))); elseif (y <= 4e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - t_1)); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (y <= 8.6e-29)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1));
elseif (y <= 4e+15)
tmp = 1.0 + (sqrt((1.0 + y)) - t_1);
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 8.6e-29], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;y \leq 8.6 \cdot 10^{-29}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 8.5999999999999996e-29Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in t around inf 22.9%
associate--l+27.5%
Simplified27.5%
Taylor expanded in x around 0 20.2%
associate--l+27.1%
associate-+r-40.0%
+-commutative40.0%
Simplified40.0%
Taylor expanded in y around 0 20.2%
associate--l+40.0%
associate-+r+40.0%
+-commutative40.0%
Simplified40.0%
if 8.5999999999999996e-29 < y < 4e15Initial program 93.0%
associate-+l+93.0%
sub-neg93.0%
sub-neg93.0%
+-commutative93.0%
+-commutative93.0%
+-commutative93.0%
Simplified93.0%
Taylor expanded in t around inf 27.7%
associate--l+32.9%
Simplified32.9%
Taylor expanded in x around 0 27.1%
associate--l+34.0%
associate-+r-33.5%
+-commutative33.5%
Simplified33.5%
Taylor expanded in z around inf 21.3%
associate--l+21.3%
sub-neg21.3%
+-commutative21.3%
+-commutative21.3%
sub-neg21.3%
Simplified21.3%
if 4e15 < y Initial program 89.6%
associate-+l+89.6%
sub-neg89.6%
sub-neg89.6%
+-commutative89.6%
+-commutative89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in t around inf 3.7%
associate--l+16.5%
Simplified16.5%
Taylor expanded in x around inf 16.3%
mul-1-neg16.3%
Simplified16.3%
Final simplification27.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 8.6e-29)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (sqrt z))))
(if (<= y 4.5e+15)
(+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(- (sqrt (+ x 1.0)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.6e-29) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + sqrt(z)));
} else if (y <= 4.5e+15) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 8.6d-29) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(x) + sqrt(z)))
else if (y <= 4.5d+15) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.6e-29) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + Math.sqrt(z)));
} else if (y <= 4.5e+15) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 8.6e-29: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + math.sqrt(z))) elif y <= 4.5e+15: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 8.6e-29) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + sqrt(z)))); elseif (y <= 4.5e+15) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 8.6e-29)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(x) + sqrt(z)));
elseif (y <= 4.5e+15)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 8.6e-29], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.6 \cdot 10^{-29}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 8.5999999999999996e-29Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in t around inf 22.9%
associate--l+27.5%
Simplified27.5%
Taylor expanded in x around 0 20.2%
associate--l+27.1%
associate-+r-40.0%
+-commutative40.0%
Simplified40.0%
Taylor expanded in y around 0 20.2%
associate--l+40.0%
associate-+r+40.0%
+-commutative40.0%
Simplified40.0%
Taylor expanded in x around inf 40.0%
if 8.5999999999999996e-29 < y < 4.5e15Initial program 93.0%
associate-+l+93.0%
sub-neg93.0%
sub-neg93.0%
+-commutative93.0%
+-commutative93.0%
+-commutative93.0%
Simplified93.0%
Taylor expanded in t around inf 27.7%
associate--l+32.9%
Simplified32.9%
Taylor expanded in x around 0 27.1%
associate--l+34.0%
associate-+r-33.5%
+-commutative33.5%
Simplified33.5%
Taylor expanded in z around inf 21.3%
associate--l+21.3%
sub-neg21.3%
+-commutative21.3%
+-commutative21.3%
sub-neg21.3%
Simplified21.3%
if 4.5e15 < y Initial program 89.6%
associate-+l+89.6%
sub-neg89.6%
sub-neg89.6%
+-commutative89.6%
+-commutative89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in t around inf 3.7%
associate--l+16.5%
Simplified16.5%
Taylor expanded in x around inf 16.3%
mul-1-neg16.3%
Simplified16.3%
Final simplification27.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 (<= z 0.102) (- 3.0 (+ (sqrt y) (+ (sqrt x) (sqrt z)))) (+ 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) {
double tmp;
if (z <= 0.102) {
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.102d0) then
tmp = 3.0d0 - (sqrt(y) + (sqrt(x) + sqrt(z)))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.102) {
tmp = 3.0 - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.102: tmp = 3.0 - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.102) tmp = Float64(3.0 - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.102)
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
else
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.102], N[(3.0 - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.102:\\
\;\;\;\;3 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 0.101999999999999993Initial program 97.8%
associate-+l+97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in t around inf 24.9%
associate--l+29.1%
Simplified29.1%
Taylor expanded in x around 0 22.6%
associate--l+28.9%
associate-+r-28.9%
+-commutative28.9%
Simplified28.9%
Taylor expanded in y around 0 19.5%
associate--l+19.5%
associate-+r+19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in z around 0 19.1%
associate-+r+19.1%
+-commutative19.1%
associate-+r+19.1%
Simplified19.1%
if 0.101999999999999993 < z Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in t around inf 5.1%
associate--l+17.3%
Simplified17.3%
Taylor expanded in x around 0 4.2%
associate--l+26.0%
associate-+r-32.0%
+-commutative32.0%
Simplified32.0%
Taylor expanded in z around inf 21.6%
associate--l+33.2%
sub-neg33.2%
+-commutative33.2%
+-commutative33.2%
sub-neg33.2%
Simplified33.2%
Final simplification26.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.2e-174)
(- 3.0 (+ (sqrt y) (+ (sqrt x) (sqrt z))))
(if (<= y 0.86)
(- 2.0 (+ (sqrt x) (sqrt y)))
(- (sqrt (+ x 1.0)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e-174) {
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
} else if (y <= 0.86) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.2d-174) then
tmp = 3.0d0 - (sqrt(y) + (sqrt(x) + sqrt(z)))
else if (y <= 0.86d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e-174) {
tmp = 3.0 - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)));
} else if (y <= 0.86) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.2e-174: tmp = 3.0 - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))) elif y <= 0.86: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e-174) tmp = Float64(3.0 - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))); elseif (y <= 0.86) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.2e-174)
tmp = 3.0 - (sqrt(y) + (sqrt(x) + sqrt(z)));
elseif (y <= 0.86)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.2e-174], N[(3.0 - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.86], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{-174}:\\
\;\;\;\;3 - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 0.86:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.20000000000000022e-174Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 22.2%
associate--l+26.4%
Simplified26.4%
Taylor expanded in x around 0 19.0%
associate--l+24.7%
associate-+r-38.1%
+-commutative38.1%
Simplified38.1%
Taylor expanded in y around 0 19.0%
associate--l+38.1%
associate-+r+38.1%
+-commutative38.1%
Simplified38.1%
Taylor expanded in z around 0 15.2%
associate-+r+15.2%
+-commutative15.2%
associate-+r+15.2%
Simplified15.2%
if 2.20000000000000022e-174 < y < 0.859999999999999987Initial program 98.4%
associate-+l+98.3%
sub-neg98.3%
sub-neg98.3%
+-commutative98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in t around inf 24.4%
associate--l+28.9%
Simplified28.9%
Taylor expanded in x around 0 22.5%
associate--l+30.5%
associate-+r-40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in y around 0 22.5%
associate--l+40.6%
associate-+r+40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in z around inf 27.4%
+-commutative27.4%
Simplified27.4%
if 0.859999999999999987 < y Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in t around inf 5.8%
associate--l+18.2%
Simplified18.2%
Taylor expanded in x around inf 16.4%
mul-1-neg16.4%
Simplified16.4%
Final simplification19.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 0.95) (- 2.0 (+ (sqrt x) (sqrt y))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.95) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.95d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.95) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.95: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.95) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.95)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.95], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.95:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 0.94999999999999996Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 23.3%
associate--l+27.7%
Simplified27.7%
Taylor expanded in x around 0 20.7%
associate--l+27.6%
associate-+r-39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in y around 0 20.7%
associate--l+39.3%
associate-+r+39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in z around inf 24.5%
+-commutative24.5%
Simplified24.5%
if 0.94999999999999996 < y Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in t around inf 5.8%
associate--l+18.2%
Simplified18.2%
Taylor expanded in x around inf 16.4%
mul-1-neg16.4%
Simplified16.4%
Final simplification20.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 0.98) (- 2.0 (+ (sqrt x) (sqrt y))) (sqrt y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.98) {
tmp = 2.0 - (sqrt(x) + sqrt(y));
} else {
tmp = sqrt(y);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.98d0) then
tmp = 2.0d0 - (sqrt(x) + sqrt(y))
else
tmp = sqrt(y)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.98) {
tmp = 2.0 - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = Math.sqrt(y);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.98: tmp = 2.0 - (math.sqrt(x) + math.sqrt(y)) else: tmp = math.sqrt(y) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.98) tmp = Float64(2.0 - Float64(sqrt(x) + sqrt(y))); else tmp = sqrt(y); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.98)
tmp = 2.0 - (sqrt(x) + sqrt(y));
else
tmp = sqrt(y);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.98], N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[y], $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.98:\\
\;\;\;\;2 - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y}\\
\end{array}
\end{array}
if y < 0.97999999999999998Initial program 97.4%
associate-+l+97.4%
sub-neg97.4%
sub-neg97.4%
+-commutative97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in t around inf 23.3%
associate--l+27.7%
Simplified27.7%
Taylor expanded in x around 0 20.7%
associate--l+27.6%
associate-+r-39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in y around 0 20.7%
associate--l+39.3%
associate-+r+39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in z around inf 24.5%
+-commutative24.5%
Simplified24.5%
if 0.97999999999999998 < y Initial program 89.0%
associate-+l+89.0%
sub-neg89.0%
sub-neg89.0%
+-commutative89.0%
+-commutative89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in y around 0 2.1%
associate--l+19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in y around inf 1.3%
mul-1-neg1.3%
Simplified1.3%
add-sqr-sqrt0.0%
sqrt-unprod6.8%
sqr-neg6.8%
add-sqr-sqrt6.8%
pow1/26.8%
Applied egg-rr6.8%
Taylor expanded in y around 0 6.8%
Final simplification16.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 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[Sqrt[y], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{y}
\end{array}
Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in y around 0 10.4%
associate--l+30.0%
+-commutative30.0%
Simplified30.0%
Taylor expanded in y around inf 1.6%
mul-1-neg1.6%
Simplified1.6%
add-sqr-sqrt0.0%
sqrt-unprod6.8%
sqr-neg6.8%
add-sqr-sqrt6.8%
pow1/26.8%
Applied egg-rr6.8%
Taylor expanded in y around 0 6.8%
(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 2024143
(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))))