
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- t_2 (sqrt x)))
(t_4 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_5 (+ (+ t_3 t_4) (- t_1 (sqrt z)))))
(if (<= t_5 1.00005)
(+ (/ 1.0 (+ (sqrt x) t_2)) (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))
(if (<= t_5 2.1)
(+ t_3 (+ t_4 (/ 1.0 (+ t_1 (sqrt z)))))
(+
t_3
(+ t_4 (- (+ t_1 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))) (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + x));
double t_3 = t_2 - sqrt(x);
double t_4 = sqrt((y + 1.0)) - sqrt(y);
double t_5 = (t_3 + t_4) + (t_1 - sqrt(z));
double tmp;
if (t_5 <= 1.00005) {
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
} else if (t_5 <= 2.1) {
tmp = t_3 + (t_4 + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = t_3 + (t_4 + ((t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
t_3 = t_2 - sqrt(x)
t_4 = sqrt((y + 1.0d0)) - sqrt(y)
t_5 = (t_3 + t_4) + (t_1 - sqrt(z))
if (t_5 <= 1.00005d0) then
tmp = (1.0d0 / (sqrt(x) + t_2)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
else if (t_5 <= 2.1d0) then
tmp = t_3 + (t_4 + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = t_3 + (t_4 + ((t_1 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t)))) - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_5 = (t_3 + t_4) + (t_1 - Math.sqrt(z));
double tmp;
if (t_5 <= 1.00005) {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
} else if (t_5 <= 2.1) {
tmp = t_3 + (t_4 + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = t_3 + (t_4 + ((t_1 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))) - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + x)) t_3 = t_2 - math.sqrt(x) t_4 = math.sqrt((y + 1.0)) - math.sqrt(y) t_5 = (t_3 + t_4) + (t_1 - math.sqrt(z)) tmp = 0 if t_5 <= 1.00005: tmp = (1.0 / (math.sqrt(x) + t_2)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) elif t_5 <= 2.1: tmp = t_3 + (t_4 + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = t_3 + (t_4 + ((t_1 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(t_2 - sqrt(x)) t_4 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_5 = Float64(Float64(t_3 + t_4) + Float64(t_1 - sqrt(z))) tmp = 0.0 if (t_5 <= 1.00005) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); elseif (t_5 <= 2.1) tmp = Float64(t_3 + Float64(t_4 + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(t_3 + Float64(t_4 + Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))) - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + x));
t_3 = t_2 - sqrt(x);
t_4 = sqrt((y + 1.0)) - sqrt(y);
t_5 = (t_3 + t_4) + (t_1 - sqrt(z));
tmp = 0.0;
if (t_5 <= 1.00005)
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
elseif (t_5 <= 2.1)
tmp = t_3 + (t_4 + (1.0 / (t_1 + sqrt(z))));
else
tmp = t_3 + (t_4 + ((t_1 + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$3 + t$95$4), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 1.00005], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.1], N[(t$95$3 + N[(t$95$4 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(t$95$4 + N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + x}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := \sqrt{y + 1} - \sqrt{y}\\
t_5 := \left(t\_3 + t\_4\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_5 \leq 1.00005:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\mathbf{elif}\;t\_5 \leq 2.1:\\
\;\;\;\;t\_3 + \left(t\_4 + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_4 + \left(\left(t\_1 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) - \sqrt{z}\right)\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))) < 1.00005000000000011Initial program 80.0%
associate-+l+80.0%
associate-+l+80.0%
+-commutative80.0%
+-commutative80.0%
associate-+l-68.2%
+-commutative68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in t around inf 43.7%
Taylor expanded in y around inf 33.4%
Taylor expanded in z around inf 20.7%
+-commutative20.7%
distribute-lft-out20.7%
Simplified20.7%
flip--20.7%
div-inv20.7%
add-sqr-sqrt15.4%
+-commutative15.4%
add-sqr-sqrt20.7%
associate--l+24.2%
+-commutative24.2%
Applied egg-rr24.2%
+-inverses24.2%
metadata-eval24.2%
*-lft-identity24.2%
+-commutative24.2%
Simplified24.2%
if 1.00005000000000011 < (+.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.10000000000000009Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-74.8%
+-commutative74.8%
+-commutative74.8%
Simplified74.8%
associate--r-95.8%
flip--95.8%
flip--95.8%
frac-add95.8%
Applied egg-rr97.6%
Taylor expanded in t around inf 57.8%
if 2.10000000000000009 < (+.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 99.5%
associate-+l+99.5%
associate-+l+99.5%
+-commutative99.5%
+-commutative99.5%
associate-+l-67.2%
+-commutative67.2%
+-commutative67.2%
Simplified67.2%
associate--r-99.5%
sub-neg99.5%
associate-+r+99.6%
Applied egg-rr99.6%
flip--99.6%
div-inv99.6%
add-sqr-sqrt78.3%
add-sqr-sqrt99.8%
associate--l+99.9%
Applied egg-rr99.9%
+-inverses99.9%
metadata-eval99.9%
*-lft-identity99.9%
+-commutative99.9%
Simplified99.9%
Final simplification45.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (- t_1 (sqrt z)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (- t_3 (sqrt x)))
(t_5 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_6 (+ t_4 t_5))
(t_7 (+ t_6 t_2)))
(if (<= t_7 1.00005)
(+ (/ 1.0 (+ (sqrt x) t_3)) (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))
(if (<= t_7 2.1)
(+ t_4 (+ t_5 (/ 1.0 (+ t_1 (sqrt z)))))
(+ t_6 (+ (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) t_2))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = t_1 - sqrt(z);
double t_3 = sqrt((1.0 + x));
double t_4 = t_3 - sqrt(x);
double t_5 = sqrt((y + 1.0)) - sqrt(y);
double t_6 = t_4 + t_5;
double t_7 = t_6 + t_2;
double tmp;
if (t_7 <= 1.00005) {
tmp = (1.0 / (sqrt(x) + t_3)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
} else if (t_7 <= 2.1) {
tmp = t_4 + (t_5 + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = t_6 + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + 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) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((1.0d0 + x))
t_4 = t_3 - sqrt(x)
t_5 = sqrt((y + 1.0d0)) - sqrt(y)
t_6 = t_4 + t_5
t_7 = t_6 + t_2
if (t_7 <= 1.00005d0) then
tmp = (1.0d0 / (sqrt(x) + t_3)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
else if (t_7 <= 2.1d0) then
tmp = t_4 + (t_5 + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = t_6 + ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + x));
double t_4 = t_3 - Math.sqrt(x);
double t_5 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_6 = t_4 + t_5;
double t_7 = t_6 + t_2;
double tmp;
if (t_7 <= 1.00005) {
tmp = (1.0 / (Math.sqrt(x) + t_3)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
} else if (t_7 <= 2.1) {
tmp = t_4 + (t_5 + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = t_6 + ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = t_1 - math.sqrt(z) t_3 = math.sqrt((1.0 + x)) t_4 = t_3 - math.sqrt(x) t_5 = math.sqrt((y + 1.0)) - math.sqrt(y) t_6 = t_4 + t_5 t_7 = t_6 + t_2 tmp = 0 if t_7 <= 1.00005: tmp = (1.0 / (math.sqrt(x) + t_3)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) elif t_7 <= 2.1: tmp = t_4 + (t_5 + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = t_6 + ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = Float64(t_1 - sqrt(z)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(t_3 - sqrt(x)) t_5 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_6 = Float64(t_4 + t_5) t_7 = Float64(t_6 + t_2) tmp = 0.0 if (t_7 <= 1.00005) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); elseif (t_7 <= 2.1) tmp = Float64(t_4 + Float64(t_5 + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(t_6 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = t_1 - sqrt(z);
t_3 = sqrt((1.0 + x));
t_4 = t_3 - sqrt(x);
t_5 = sqrt((y + 1.0)) - sqrt(y);
t_6 = t_4 + t_5;
t_7 = t_6 + t_2;
tmp = 0.0;
if (t_7 <= 1.00005)
tmp = (1.0 / (sqrt(x) + t_3)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
elseif (t_7 <= 2.1)
tmp = t_4 + (t_5 + (1.0 / (t_1 + sqrt(z))));
else
tmp = t_6 + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$4 + t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$6 + t$95$2), $MachinePrecision]}, If[LessEqual[t$95$7, 1.00005], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$7, 2.1], N[(t$95$4 + N[(t$95$5 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$6 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{1 + x}\\
t_4 := t\_3 - \sqrt{x}\\
t_5 := \sqrt{y + 1} - \sqrt{y}\\
t_6 := t\_4 + t\_5\\
t_7 := t\_6 + t\_2\\
\mathbf{if}\;t\_7 \leq 1.00005:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\mathbf{elif}\;t\_7 \leq 2.1:\\
\;\;\;\;t\_4 + \left(t\_5 + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_6 + \left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + t\_2\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))) < 1.00005000000000011Initial program 80.0%
associate-+l+80.0%
associate-+l+80.0%
+-commutative80.0%
+-commutative80.0%
associate-+l-68.2%
+-commutative68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in t around inf 43.7%
Taylor expanded in y around inf 33.4%
Taylor expanded in z around inf 20.7%
+-commutative20.7%
distribute-lft-out20.7%
Simplified20.7%
flip--20.7%
div-inv20.7%
add-sqr-sqrt15.4%
+-commutative15.4%
add-sqr-sqrt20.7%
associate--l+24.2%
+-commutative24.2%
Applied egg-rr24.2%
+-inverses24.2%
metadata-eval24.2%
*-lft-identity24.2%
+-commutative24.2%
Simplified24.2%
if 1.00005000000000011 < (+.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.10000000000000009Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-74.8%
+-commutative74.8%
+-commutative74.8%
Simplified74.8%
associate--r-95.8%
flip--95.8%
flip--95.8%
frac-add95.8%
Applied egg-rr97.6%
Taylor expanded in t around inf 57.8%
if 2.10000000000000009 < (+.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 99.5%
associate-+l+99.5%
sub-neg99.5%
sub-neg99.5%
+-commutative99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
flip--99.6%
div-inv99.6%
add-sqr-sqrt78.3%
add-sqr-sqrt99.8%
associate--l+99.9%
Applied egg-rr99.8%
+-inverses99.9%
metadata-eval99.9%
*-lft-identity99.9%
+-commutative99.9%
Simplified99.8%
Final simplification45.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- t_2 (sqrt x)))
(t_4 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_5 (+ t_3 t_4))
(t_6 (+ t_5 (- t_1 (sqrt z)))))
(if (<= t_6 1.00005)
(+ (/ 1.0 (+ (sqrt x) t_2)) (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))
(if (<= t_6 2.9999995)
(+ t_3 (+ t_4 (/ 1.0 (+ t_1 (sqrt z)))))
(+ t_5 (+ (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) (- 1.0 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + x));
double t_3 = t_2 - sqrt(x);
double t_4 = sqrt((y + 1.0)) - sqrt(y);
double t_5 = t_3 + t_4;
double t_6 = t_5 + (t_1 - sqrt(z));
double tmp;
if (t_6 <= 1.00005) {
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
} else if (t_6 <= 2.9999995) {
tmp = t_3 + (t_4 + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = t_5 + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + (1.0 - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
t_3 = t_2 - sqrt(x)
t_4 = sqrt((y + 1.0d0)) - sqrt(y)
t_5 = t_3 + t_4
t_6 = t_5 + (t_1 - sqrt(z))
if (t_6 <= 1.00005d0) then
tmp = (1.0d0 / (sqrt(x) + t_2)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
else if (t_6 <= 2.9999995d0) then
tmp = t_3 + (t_4 + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = t_5 + ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + (1.0d0 - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_5 = t_3 + t_4;
double t_6 = t_5 + (t_1 - Math.sqrt(z));
double tmp;
if (t_6 <= 1.00005) {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
} else if (t_6 <= 2.9999995) {
tmp = t_3 + (t_4 + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = t_5 + ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + (1.0 - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + x)) t_3 = t_2 - math.sqrt(x) t_4 = math.sqrt((y + 1.0)) - math.sqrt(y) t_5 = t_3 + t_4 t_6 = t_5 + (t_1 - math.sqrt(z)) tmp = 0 if t_6 <= 1.00005: tmp = (1.0 / (math.sqrt(x) + t_2)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) elif t_6 <= 2.9999995: tmp = t_3 + (t_4 + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = t_5 + ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + (1.0 - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(t_2 - sqrt(x)) t_4 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_5 = Float64(t_3 + t_4) t_6 = Float64(t_5 + Float64(t_1 - sqrt(z))) tmp = 0.0 if (t_6 <= 1.00005) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); elseif (t_6 <= 2.9999995) tmp = Float64(t_3 + Float64(t_4 + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(t_5 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(1.0 - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + x));
t_3 = t_2 - sqrt(x);
t_4 = sqrt((y + 1.0)) - sqrt(y);
t_5 = t_3 + t_4;
t_6 = t_5 + (t_1 - sqrt(z));
tmp = 0.0;
if (t_6 <= 1.00005)
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
elseif (t_6 <= 2.9999995)
tmp = t_3 + (t_4 + (1.0 / (t_1 + sqrt(z))));
else
tmp = t_5 + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + (1.0 - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 + t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 1.00005], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.9999995], N[(t$95$3 + N[(t$95$4 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$5 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + x}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := \sqrt{y + 1} - \sqrt{y}\\
t_5 := t\_3 + t\_4\\
t_6 := t\_5 + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_6 \leq 1.00005:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\mathbf{elif}\;t\_6 \leq 2.9999995:\\
\;\;\;\;t\_3 + \left(t\_4 + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5 + \left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(1 - \sqrt{z}\right)\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))) < 1.00005000000000011Initial program 80.0%
associate-+l+80.0%
associate-+l+80.0%
+-commutative80.0%
+-commutative80.0%
associate-+l-68.2%
+-commutative68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in t around inf 43.7%
Taylor expanded in y around inf 33.4%
Taylor expanded in z around inf 20.7%
+-commutative20.7%
distribute-lft-out20.7%
Simplified20.7%
flip--20.7%
div-inv20.7%
add-sqr-sqrt15.4%
+-commutative15.4%
add-sqr-sqrt20.7%
associate--l+24.2%
+-commutative24.2%
Applied egg-rr24.2%
+-inverses24.2%
metadata-eval24.2%
*-lft-identity24.2%
+-commutative24.2%
Simplified24.2%
if 1.00005000000000011 < (+.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.99999949999999993Initial program 96.0%
associate-+l+96.0%
associate-+l+96.0%
+-commutative96.0%
+-commutative96.0%
associate-+l-73.3%
+-commutative73.3%
+-commutative73.3%
Simplified73.3%
associate--r-96.0%
flip--96.0%
flip--96.0%
frac-add95.9%
Applied egg-rr97.6%
Taylor expanded in t around inf 58.8%
if 2.99999949999999993 < (+.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 99.6%
associate-+l+99.6%
sub-neg99.6%
sub-neg99.6%
+-commutative99.6%
+-commutative99.6%
+-commutative99.6%
Simplified99.6%
flip--99.6%
div-inv99.6%
add-sqr-sqrt85.8%
add-sqr-sqrt99.8%
associate--l+99.9%
Applied egg-rr99.9%
+-inverses99.9%
metadata-eval99.9%
*-lft-identity99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
Final simplification45.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x)))
(t_2 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(t_3 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_4 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_3 5e-6)
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))
(+
(- t_1 (sqrt x))
(+
t_3
(/ (+ (* (+ 1.0 (- t t)) t_2) (* t_4 (+ z (- 1.0 z)))) (* t_2 t_4)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + z)) + sqrt(z);
double t_3 = sqrt((y + 1.0)) - sqrt(y);
double t_4 = sqrt((1.0 + t)) + sqrt(t);
double tmp;
if (t_3 <= 5e-6) {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
} else {
tmp = (t_1 - sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_2) + (t_4 * (z + (1.0 - z)))) / (t_2 * t_4)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z)) + sqrt(z)
t_3 = sqrt((y + 1.0d0)) - sqrt(y)
t_4 = sqrt((1.0d0 + t)) + sqrt(t)
if (t_3 <= 5d-6) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
else
tmp = (t_1 - sqrt(x)) + (t_3 + ((((1.0d0 + (t - t)) * t_2) + (t_4 * (z + (1.0d0 - z)))) / (t_2 * t_4)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + z)) + Math.sqrt(z);
double t_3 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_4 = Math.sqrt((1.0 + t)) + Math.sqrt(t);
double tmp;
if (t_3 <= 5e-6) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
} else {
tmp = (t_1 - Math.sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_2) + (t_4 * (z + (1.0 - z)))) / (t_2 * t_4)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + z)) + math.sqrt(z) t_3 = math.sqrt((y + 1.0)) - math.sqrt(y) t_4 = math.sqrt((1.0 + t)) + math.sqrt(t) tmp = 0 if t_3 <= 5e-6: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) else: tmp = (t_1 - math.sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_2) + (t_4 * (z + (1.0 - z)))) / (t_2 * t_4))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + z)) + sqrt(z)) t_3 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_4 = Float64(sqrt(Float64(1.0 + t)) + sqrt(t)) tmp = 0.0 if (t_3 <= 5e-6) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 + Float64(Float64(Float64(Float64(1.0 + Float64(t - t)) * t_2) + Float64(t_4 * Float64(z + Float64(1.0 - z)))) / Float64(t_2 * t_4)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + z)) + sqrt(z);
t_3 = sqrt((y + 1.0)) - sqrt(y);
t_4 = sqrt((1.0 + t)) + sqrt(t);
tmp = 0.0;
if (t_3 <= 5e-6)
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
else
tmp = (t_1 - sqrt(x)) + (t_3 + ((((1.0 + (t - t)) * t_2) + (t_4 * (z + (1.0 - z)))) / (t_2 * t_4)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 5e-6], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[(N[(N[(1.0 + N[(t - t), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$4 * N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z} + \sqrt{z}\\
t_3 := \sqrt{y + 1} - \sqrt{y}\\
t_4 := \sqrt{1 + t} + \sqrt{t}\\
\mathbf{if}\;t\_3 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(t\_3 + \frac{\left(1 + \left(t - t\right)\right) \cdot t\_2 + t\_4 \cdot \left(z + \left(1 - z\right)\right)}{t\_2 \cdot t\_4}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000041e-6Initial program 78.6%
associate-+l+78.6%
associate-+l+78.6%
+-commutative78.6%
+-commutative78.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 39.3%
Taylor expanded in y around inf 46.6%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
distribute-lft-out22.1%
Simplified22.1%
flip--22.1%
div-inv22.1%
add-sqr-sqrt16.5%
+-commutative16.5%
add-sqr-sqrt22.1%
associate--l+25.9%
+-commutative25.9%
Applied egg-rr25.9%
+-inverses25.9%
metadata-eval25.9%
*-lft-identity25.9%
+-commutative25.9%
Simplified25.9%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-80.7%
+-commutative80.7%
+-commutative80.7%
Simplified80.7%
associate--r-96.8%
flip--96.9%
flip--96.9%
frac-add96.9%
Applied egg-rr98.1%
Final simplification63.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 x))) (t_2 (- (sqrt (+ y 1.0)) (sqrt y))))
(if (<= t_2 5e-6)
(+ (/ 1.0 (+ (sqrt x) t_1)) (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))
(+
(+ (- t_1 (sqrt x)) t_2)
(+
(/ (+ z (- 1.0 z)) (+ (sqrt (+ 1.0 z)) (sqrt z)))
(- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double tmp;
if (t_2 <= 5e-6) {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
} else {
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0 - z)) / (sqrt((1.0 + z)) + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
if (t_2 <= 5d-6) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
else
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0d0 - z)) / (sqrt((1.0d0 + z)) + sqrt(z))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double tmp;
if (t_2 <= 5e-6) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
} else {
tmp = ((t_1 - Math.sqrt(x)) + t_2) + (((z + (1.0 - z)) / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) tmp = 0 if t_2 <= 5e-6: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) else: tmp = ((t_1 - math.sqrt(x)) + t_2) + (((z + (1.0 - z)) / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) tmp = 0.0 if (t_2 <= 5e-6) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + t_2) + Float64(Float64(Float64(z + Float64(1.0 - z)) / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((y + 1.0)) - sqrt(y);
tmp = 0.0;
if (t_2 <= 5e-6)
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
else
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0 - z)) / (sqrt((1.0 + z)) + sqrt(z))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e-6], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[(N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
\mathbf{if}\;t\_2 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + t\_2\right) + \left(\frac{z + \left(1 - z\right)}{\sqrt{1 + z} + \sqrt{z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 5.00000000000000041e-6Initial program 78.6%
associate-+l+78.6%
associate-+l+78.6%
+-commutative78.6%
+-commutative78.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 39.3%
Taylor expanded in y around inf 46.6%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
distribute-lft-out22.1%
Simplified22.1%
flip--22.1%
div-inv22.1%
add-sqr-sqrt16.5%
+-commutative16.5%
add-sqr-sqrt22.1%
associate--l+25.9%
+-commutative25.9%
Applied egg-rr25.9%
+-inverses25.9%
metadata-eval25.9%
*-lft-identity25.9%
+-commutative25.9%
Simplified25.9%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
flip--96.8%
add-sqr-sqrt74.8%
+-commutative74.8%
add-sqr-sqrt97.3%
associate--l+97.2%
Applied egg-rr97.2%
Final simplification62.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (- t_3 (sqrt x))))
(if (<= z 1.15e-15)
(+ (+ t_4 t_1) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- 1.0 (sqrt z))))
(if (<= z 2e+31)
(+ t_4 (+ t_1 (/ 1.0 (+ t_2 (sqrt z)))))
(+ (/ 1.0 (+ (sqrt x) t_3)) (+ t_1 (- t_2 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + x));
double t_4 = t_3 - sqrt(x);
double tmp;
if (z <= 1.15e-15) {
tmp = (t_4 + t_1) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 - sqrt(z)));
} else if (z <= 2e+31) {
tmp = t_4 + (t_1 + (1.0 / (t_2 + sqrt(z))));
} else {
tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + (t_2 - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + x))
t_4 = t_3 - sqrt(x)
if (z <= 1.15d-15) then
tmp = (t_4 + t_1) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 - sqrt(z)))
else if (z <= 2d+31) then
tmp = t_4 + (t_1 + (1.0d0 / (t_2 + sqrt(z))))
else
tmp = (1.0d0 / (sqrt(x) + t_3)) + (t_1 + (t_2 - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + x));
double t_4 = t_3 - Math.sqrt(x);
double tmp;
if (z <= 1.15e-15) {
tmp = (t_4 + t_1) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 - Math.sqrt(z)));
} else if (z <= 2e+31) {
tmp = t_4 + (t_1 + (1.0 / (t_2 + Math.sqrt(z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_3)) + (t_1 + (t_2 - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + x)) t_4 = t_3 - math.sqrt(x) tmp = 0 if z <= 1.15e-15: tmp = (t_4 + t_1) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 - math.sqrt(z))) elif z <= 2e+31: tmp = t_4 + (t_1 + (1.0 / (t_2 + math.sqrt(z)))) else: tmp = (1.0 / (math.sqrt(x) + t_3)) + (t_1 + (t_2 - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(t_3 - sqrt(x)) tmp = 0.0 if (z <= 1.15e-15) tmp = Float64(Float64(t_4 + t_1) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 - sqrt(z)))); elseif (z <= 2e+31) tmp = Float64(t_4 + Float64(t_1 + Float64(1.0 / Float64(t_2 + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(t_1 + Float64(t_2 - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + x));
t_4 = t_3 - sqrt(x);
tmp = 0.0;
if (z <= 1.15e-15)
tmp = (t_4 + t_1) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 - sqrt(z)));
elseif (z <= 2e+31)
tmp = t_4 + (t_1 + (1.0 / (t_2 + sqrt(z))));
else
tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + (t_2 - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.15e-15], N[(N[(t$95$4 + t$95$1), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+31], N[(t$95$4 + N[(t$95$1 + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + x}\\
t_4 := t\_3 - \sqrt{x}\\
\mathbf{if}\;z \leq 1.15 \cdot 10^{-15}:\\
\;\;\;\;\left(t\_4 + t\_1\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(1 - \sqrt{z}\right)\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+31}:\\
\;\;\;\;t\_4 + \left(t\_1 + \frac{1}{t\_2 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(t\_1 + \left(t\_2 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if z < 1.14999999999999995e-15Initial program 97.3%
associate-+l+97.3%
sub-neg97.3%
sub-neg97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in z around 0 97.3%
if 1.14999999999999995e-15 < z < 1.9999999999999999e31Initial program 81.4%
associate-+l+81.4%
associate-+l+81.4%
+-commutative81.4%
+-commutative81.4%
associate-+l-61.8%
+-commutative61.8%
+-commutative61.8%
Simplified61.8%
associate--r-81.4%
flip--81.4%
flip--81.2%
frac-add81.1%
Applied egg-rr87.9%
Taylor expanded in t around inf 55.0%
if 1.9999999999999999e31 < z Initial program 79.4%
associate-+l+79.4%
associate-+l+79.4%
+-commutative79.4%
+-commutative79.4%
associate-+l-79.4%
+-commutative79.4%
+-commutative79.4%
Simplified79.4%
Taylor expanded in t around inf 44.7%
flip--21.2%
div-inv21.2%
add-sqr-sqrt15.7%
+-commutative15.7%
add-sqr-sqrt21.2%
associate--l+25.3%
+-commutative25.3%
Applied egg-rr49.1%
+-inverses25.3%
metadata-eval25.3%
*-lft-identity25.3%
+-commutative25.3%
Simplified49.1%
Final simplification72.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ 1.0 x))) (t_3 (- t_2 (sqrt x))))
(if (<= y 5.6e-95)
(+
t_3
(+ (- 1.0 (sqrt y)) (- (+ t_1 (- (sqrt (+ 1.0 t)) (sqrt t))) (sqrt z))))
(if (<= y 29000000000.0)
(+ t_3 (+ (- (sqrt (+ y 1.0)) (sqrt y)) (/ 1.0 (+ t_1 (sqrt z)))))
(+
(/ 1.0 (+ (sqrt x) t_2))
(* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + x));
double t_3 = t_2 - sqrt(x);
double tmp;
if (y <= 5.6e-95) {
tmp = t_3 + ((1.0 - sqrt(y)) + ((t_1 + (sqrt((1.0 + t)) - sqrt(t))) - sqrt(z)));
} else if (y <= 29000000000.0) {
tmp = t_3 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + x))
t_3 = t_2 - sqrt(x)
if (y <= 5.6d-95) then
tmp = t_3 + ((1.0d0 - sqrt(y)) + ((t_1 + (sqrt((1.0d0 + t)) - sqrt(t))) - sqrt(z)))
else if (y <= 29000000000.0d0) then
tmp = t_3 + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = (1.0d0 / (sqrt(x) + t_2)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = t_2 - Math.sqrt(x);
double tmp;
if (y <= 5.6e-95) {
tmp = t_3 + ((1.0 - Math.sqrt(y)) + ((t_1 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) - Math.sqrt(z)));
} else if (y <= 29000000000.0) {
tmp = t_3 + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + x)) t_3 = t_2 - math.sqrt(x) tmp = 0 if y <= 5.6e-95: tmp = t_3 + ((1.0 - math.sqrt(y)) + ((t_1 + (math.sqrt((1.0 + t)) - math.sqrt(t))) - math.sqrt(z))) elif y <= 29000000000.0: tmp = t_3 + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = (1.0 / (math.sqrt(x) + t_2)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(t_2 - sqrt(x)) tmp = 0.0 if (y <= 5.6e-95) tmp = Float64(t_3 + Float64(Float64(1.0 - sqrt(y)) + Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) - sqrt(z)))); elseif (y <= 29000000000.0) tmp = Float64(t_3 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + x));
t_3 = t_2 - sqrt(x);
tmp = 0.0;
if (y <= 5.6e-95)
tmp = t_3 + ((1.0 - sqrt(y)) + ((t_1 + (sqrt((1.0 + t)) - sqrt(t))) - sqrt(z)));
elseif (y <= 29000000000.0)
tmp = t_3 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (t_1 + sqrt(z))));
else
tmp = (1.0 / (sqrt(x) + t_2)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.6e-95], N[(t$95$3 + N[(N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 29000000000.0], N[(t$95$3 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / 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 + z}\\
t_2 := \sqrt{1 + x}\\
t_3 := t\_2 - \sqrt{x}\\
\mathbf{if}\;y \leq 5.6 \cdot 10^{-95}:\\
\;\;\;\;t\_3 + \left(\left(1 - \sqrt{y}\right) + \left(\left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 29000000000:\\
\;\;\;\;t\_3 + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if y < 5.5999999999999998e-95Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
associate--r-97.3%
sub-neg97.3%
associate-+r+82.1%
Applied egg-rr82.1%
Taylor expanded in y around 0 82.1%
if 5.5999999999999998e-95 < y < 2.9e10Initial program 95.2%
associate-+l+95.2%
associate-+l+95.2%
+-commutative95.2%
+-commutative95.2%
associate-+l-74.9%
+-commutative74.9%
+-commutative74.9%
Simplified74.9%
associate--r-95.2%
flip--95.6%
flip--95.6%
frac-add95.6%
Applied egg-rr97.9%
Taylor expanded in t around inf 68.2%
if 2.9e10 < y Initial program 78.6%
associate-+l+78.6%
associate-+l+78.6%
+-commutative78.6%
+-commutative78.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 39.3%
Taylor expanded in y around inf 46.6%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
distribute-lft-out22.1%
Simplified22.1%
flip--22.1%
div-inv22.1%
add-sqr-sqrt16.5%
+-commutative16.5%
add-sqr-sqrt22.1%
associate--l+25.9%
+-commutative25.9%
Applied egg-rr25.9%
+-inverses25.9%
metadata-eval25.9%
*-lft-identity25.9%
+-commutative25.9%
Simplified25.9%
Final simplification53.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 14500000000.0)
(+
(- t_1 (sqrt x))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))))
(+
(/ 1.0 (+ (sqrt x) t_1))
(* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 14500000000.0) {
tmp = (t_1 - sqrt(x)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 14500000000.0d0) then
tmp = (t_1 - sqrt(x)) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 14500000000.0) {
tmp = (t_1 - Math.sqrt(x)) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 14500000000.0: tmp = (t_1 - math.sqrt(x)) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 14500000000.0) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 14500000000.0)
tmp = (t_1 - sqrt(x)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 14500000000.0], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / 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 + x}\\
\mathbf{if}\;y \leq 14500000000:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if y < 1.45e10Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-80.7%
+-commutative80.7%
+-commutative80.7%
Simplified80.7%
associate--r-96.8%
flip--96.9%
flip--96.9%
frac-add96.9%
Applied egg-rr98.1%
Taylor expanded in t around inf 60.3%
if 1.45e10 < y Initial program 78.6%
associate-+l+78.6%
associate-+l+78.6%
+-commutative78.6%
+-commutative78.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 39.3%
Taylor expanded in y around inf 46.6%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
distribute-lft-out22.1%
Simplified22.1%
flip--22.1%
div-inv22.1%
add-sqr-sqrt16.5%
+-commutative16.5%
add-sqr-sqrt22.1%
associate--l+25.9%
+-commutative25.9%
Applied egg-rr25.9%
+-inverses25.9%
metadata-eval25.9%
*-lft-identity25.9%
+-commutative25.9%
Simplified25.9%
Final simplification43.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= t 8.2e+18)
(+
(- t_1 (sqrt x))
(+ (- 1.0 (sqrt y)) (- (+ 1.0 (sqrt (+ 1.0 t))) (+ (sqrt z) (sqrt t)))))
(+
(/ 1.0 (+ (sqrt x) t_1))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- (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 + x));
double tmp;
if (t <= 8.2e+18) {
tmp = (t_1 - sqrt(x)) + ((1.0 - sqrt(y)) + ((1.0 + sqrt((1.0 + t))) - (sqrt(z) + sqrt(t))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + ((sqrt((y + 1.0)) - sqrt(y)) + (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) :: tmp
t_1 = sqrt((1.0d0 + x))
if (t <= 8.2d+18) then
tmp = (t_1 - sqrt(x)) + ((1.0d0 - sqrt(y)) + ((1.0d0 + sqrt((1.0d0 + t))) - (sqrt(z) + sqrt(t))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (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 + x));
double tmp;
if (t <= 8.2e+18) {
tmp = (t_1 - Math.sqrt(x)) + ((1.0 - Math.sqrt(y)) + ((1.0 + Math.sqrt((1.0 + t))) - (Math.sqrt(z) + Math.sqrt(t))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (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 + x)) tmp = 0 if t <= 8.2e+18: tmp = (t_1 - math.sqrt(x)) + ((1.0 - math.sqrt(y)) + ((1.0 + math.sqrt((1.0 + t))) - (math.sqrt(z) + math.sqrt(t)))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (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 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (t <= 8.2e+18) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 - sqrt(y)) + Float64(Float64(1.0 + sqrt(Float64(1.0 + t))) - Float64(sqrt(z) + sqrt(t))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + 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 + x));
tmp = 0.0;
if (t <= 8.2e+18)
tmp = (t_1 - sqrt(x)) + ((1.0 - sqrt(y)) + ((1.0 + sqrt((1.0 + t))) - (sqrt(z) + sqrt(t))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + ((sqrt((y + 1.0)) - sqrt(y)) + (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[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 8.2e+18], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;t \leq 8.2 \cdot 10^{+18}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\left(1 - \sqrt{y}\right) + \left(\left(1 + \sqrt{1 + t}\right) - \left(\sqrt{z} + \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 8.2e18Initial program 94.8%
associate-+l+94.8%
associate-+l+94.8%
+-commutative94.8%
+-commutative94.8%
associate-+l-94.8%
+-commutative94.8%
+-commutative94.8%
Simplified94.8%
Taylor expanded in z around 0 52.7%
Taylor expanded in y around 0 27.4%
if 8.2e18 < t Initial program 81.1%
associate-+l+81.1%
associate-+l+81.1%
+-commutative81.1%
+-commutative81.1%
associate-+l-45.7%
+-commutative45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in t around inf 81.1%
flip--19.9%
div-inv19.9%
add-sqr-sqrt14.9%
+-commutative14.9%
add-sqr-sqrt19.9%
associate--l+23.6%
+-commutative23.6%
Applied egg-rr85.2%
+-inverses23.6%
metadata-eval23.6%
*-lft-identity23.6%
+-commutative23.6%
Simplified85.2%
Final simplification56.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 (+ y 1.0))))
(if (<= z 2e+24)
(+ 1.0 (- (+ t_1 (sqrt (+ 1.0 z))) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= z 4.7e+188)
(+ 1.0 (- (- t_1 (sqrt x)) (sqrt y)))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))
(* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double tmp;
if (z <= 2e+24) {
tmp = 1.0 + ((t_1 + sqrt((1.0 + z))) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (z <= 4.7e+188) {
tmp = 1.0 + ((t_1 - sqrt(x)) - sqrt(y));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
if (z <= 2d+24) then
tmp = 1.0d0 + ((t_1 + sqrt((1.0d0 + z))) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (z <= 4.7d+188) then
tmp = 1.0d0 + ((t_1 - sqrt(x)) - sqrt(y))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 2e+24) {
tmp = 1.0 + ((t_1 + Math.sqrt((1.0 + z))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (z <= 4.7e+188) {
tmp = 1.0 + ((t_1 - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) tmp = 0 if z <= 2e+24: tmp = 1.0 + ((t_1 + math.sqrt((1.0 + z))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif z <= 4.7e+188: tmp = 1.0 + ((t_1 - math.sqrt(x)) - math.sqrt(y)) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 2e+24) tmp = Float64(1.0 + Float64(Float64(t_1 + sqrt(Float64(1.0 + z))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (z <= 4.7e+188) tmp = Float64(1.0 + Float64(Float64(t_1 - sqrt(x)) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 2e+24)
tmp = 1.0 + ((t_1 + sqrt((1.0 + z))) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (z <= 4.7e+188)
tmp = 1.0 + ((t_1 - sqrt(x)) - sqrt(y));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2e+24], N[(1.0 + N[(N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.7e+188], N[(1.0 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / 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{y + 1}\\
\mathbf{if}\;z \leq 2 \cdot 10^{+24}:\\
\;\;\;\;1 + \left(\left(t\_1 + \sqrt{1 + z}\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+188}:\\
\;\;\;\;1 + \left(\left(t\_1 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if z < 2e24Initial program 95.5%
associate-+l+95.5%
associate-+l+95.5%
+-commutative95.5%
+-commutative95.5%
associate-+l-62.6%
+-commutative62.6%
+-commutative62.6%
Simplified62.6%
Taylor expanded in t around inf 54.6%
Taylor expanded in x around 0 16.7%
associate--l+27.2%
+-commutative27.2%
+-commutative27.2%
Simplified27.2%
if 2e24 < z < 4.6999999999999997e188Initial program 80.6%
associate-+l+80.6%
associate-+l+80.6%
+-commutative80.6%
+-commutative80.6%
associate-+l-80.6%
+-commutative80.6%
+-commutative80.6%
Simplified80.6%
Taylor expanded in t around inf 47.1%
Taylor expanded in z around inf 21.8%
+-commutative21.8%
associate--l+41.1%
Simplified41.1%
Taylor expanded in x around 0 19.9%
associate--l+30.7%
associate--r+30.7%
Simplified30.7%
if 4.6999999999999997e188 < z Initial program 78.2%
associate-+l+78.2%
associate-+l+78.2%
+-commutative78.2%
+-commutative78.2%
associate-+l-78.2%
+-commutative78.2%
+-commutative78.2%
Simplified78.2%
Taylor expanded in t around inf 41.6%
Taylor expanded in y around inf 20.7%
Taylor expanded in z around inf 20.8%
+-commutative20.8%
distribute-lft-out20.8%
Simplified20.8%
flip--20.8%
div-inv20.8%
add-sqr-sqrt14.0%
+-commutative14.0%
add-sqr-sqrt20.8%
associate--l+25.3%
+-commutative25.3%
Applied egg-rr25.3%
+-inverses25.3%
metadata-eval25.3%
*-lft-identity25.3%
+-commutative25.3%
Simplified25.3%
Final simplification27.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 5200000000.0)
(+
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- (sqrt (+ 1.0 z)) (sqrt z)))
(- 1.0 (sqrt x)))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))
(* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5200000000.0) {
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z))) + (1.0 - sqrt(x));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 5200000000.0d0) then
tmp = ((sqrt((y + 1.0d0)) - sqrt(y)) + (sqrt((1.0d0 + z)) - sqrt(z))) + (1.0d0 - sqrt(x))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))) + (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5200000000.0) {
tmp = ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + (1.0 - Math.sqrt(x));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 5200000000.0: tmp = ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + (1.0 - math.sqrt(x)) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 5200000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + Float64(1.0 - sqrt(x))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 5200000000.0)
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((1.0 + z)) - sqrt(z))) + (1.0 - sqrt(x));
else
tmp = (1.0 / (sqrt(x) + sqrt((1.0 + x)))) + (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 5200000000.0], N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5200000000:\\
\;\;\;\;\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + \left(1 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}} + 0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if y < 5.2e9Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-80.7%
+-commutative80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in t around inf 59.7%
Taylor expanded in x around 0 27.7%
if 5.2e9 < y Initial program 78.6%
associate-+l+78.6%
associate-+l+78.6%
+-commutative78.6%
+-commutative78.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 39.3%
Taylor expanded in y around inf 46.6%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
distribute-lft-out22.1%
Simplified22.1%
flip--22.1%
div-inv22.1%
add-sqr-sqrt16.5%
+-commutative16.5%
add-sqr-sqrt22.1%
associate--l+25.9%
+-commutative25.9%
Applied egg-rr25.9%
+-inverses25.9%
metadata-eval25.9%
*-lft-identity25.9%
+-commutative25.9%
Simplified25.9%
Final simplification26.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (/ 1.0 z))) (t_2 (sqrt (+ y 1.0))) (t_3 (sqrt (+ 1.0 x))))
(if (<= z 3.1)
(- (+ 2.0 (+ t_2 (* 0.5 z))) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(if (<= z 2.7e+25)
(+ (+ (- t_3 (sqrt x)) (- 1.0 (sqrt y))) (* 0.5 t_1))
(if (<= z 4.7e+188)
(+ 1.0 (- (- t_2 (sqrt x)) (sqrt y)))
(+ (/ 1.0 (+ (sqrt x) t_3)) (* 0.5 (+ t_1 (sqrt (/ 1.0 y))))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 / z));
double t_2 = sqrt((y + 1.0));
double t_3 = sqrt((1.0 + x));
double tmp;
if (z <= 3.1) {
tmp = (2.0 + (t_2 + (0.5 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else if (z <= 2.7e+25) {
tmp = ((t_3 - sqrt(x)) + (1.0 - sqrt(y))) + (0.5 * t_1);
} else if (z <= 4.7e+188) {
tmp = 1.0 + ((t_2 - sqrt(x)) - sqrt(y));
} else {
tmp = (1.0 / (sqrt(x) + t_3)) + (0.5 * (t_1 + sqrt((1.0 / y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 / z))
t_2 = sqrt((y + 1.0d0))
t_3 = sqrt((1.0d0 + x))
if (z <= 3.1d0) then
tmp = (2.0d0 + (t_2 + (0.5d0 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else if (z <= 2.7d+25) then
tmp = ((t_3 - sqrt(x)) + (1.0d0 - sqrt(y))) + (0.5d0 * t_1)
else if (z <= 4.7d+188) then
tmp = 1.0d0 + ((t_2 - sqrt(x)) - sqrt(y))
else
tmp = (1.0d0 / (sqrt(x) + t_3)) + (0.5d0 * (t_1 + sqrt((1.0d0 / y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 / z));
double t_2 = Math.sqrt((y + 1.0));
double t_3 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 3.1) {
tmp = (2.0 + (t_2 + (0.5 * z))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else if (z <= 2.7e+25) {
tmp = ((t_3 - Math.sqrt(x)) + (1.0 - Math.sqrt(y))) + (0.5 * t_1);
} else if (z <= 4.7e+188) {
tmp = 1.0 + ((t_2 - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_3)) + (0.5 * (t_1 + Math.sqrt((1.0 / y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 / z)) t_2 = math.sqrt((y + 1.0)) t_3 = math.sqrt((1.0 + x)) tmp = 0 if z <= 3.1: tmp = (2.0 + (t_2 + (0.5 * z))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) elif z <= 2.7e+25: tmp = ((t_3 - math.sqrt(x)) + (1.0 - math.sqrt(y))) + (0.5 * t_1) elif z <= 4.7e+188: tmp = 1.0 + ((t_2 - math.sqrt(x)) - math.sqrt(y)) else: tmp = (1.0 / (math.sqrt(x) + t_3)) + (0.5 * (t_1 + math.sqrt((1.0 / y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 / z)) t_2 = sqrt(Float64(y + 1.0)) t_3 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 3.1) tmp = Float64(Float64(2.0 + Float64(t_2 + Float64(0.5 * z))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); elseif (z <= 2.7e+25) tmp = Float64(Float64(Float64(t_3 - sqrt(x)) + Float64(1.0 - sqrt(y))) + Float64(0.5 * t_1)); elseif (z <= 4.7e+188) tmp = Float64(1.0 + Float64(Float64(t_2 - sqrt(x)) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(0.5 * Float64(t_1 + sqrt(Float64(1.0 / y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 / z));
t_2 = sqrt((y + 1.0));
t_3 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 3.1)
tmp = (2.0 + (t_2 + (0.5 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
elseif (z <= 2.7e+25)
tmp = ((t_3 - sqrt(x)) + (1.0 - sqrt(y))) + (0.5 * t_1);
elseif (z <= 4.7e+188)
tmp = 1.0 + ((t_2 - sqrt(x)) - sqrt(y));
else
tmp = (1.0 / (sqrt(x) + t_3)) + (0.5 * (t_1 + sqrt((1.0 / y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3.1], N[(N[(2.0 + N[(t$95$2 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+25], N[(N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.7e+188], N[(1.0 + N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$1 + N[Sqrt[N[(1.0 / 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{\frac{1}{z}}\\
t_2 := \sqrt{y + 1}\\
t_3 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 3.1:\\
\;\;\;\;\left(2 + \left(t\_2 + 0.5 \cdot z\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;\left(\left(t\_3 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right) + 0.5 \cdot t\_1\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+188}:\\
\;\;\;\;1 + \left(\left(t\_2 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + 0.5 \cdot \left(t\_1 + \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if z < 3.10000000000000009Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-62.2%
+-commutative62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in t around inf 56.1%
Taylor expanded in z around 0 19.3%
Taylor expanded in x around 0 16.4%
if 3.10000000000000009 < z < 2.7e25Initial program 73.3%
associate-+l+73.3%
sub-neg73.3%
sub-neg73.3%
+-commutative73.3%
+-commutative73.3%
+-commutative73.3%
Simplified73.3%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around 0 46.0%
Taylor expanded in z around 0 31.2%
if 2.7e25 < z < 4.6999999999999997e188Initial program 80.5%
associate-+l+80.5%
associate-+l+80.5%
+-commutative80.5%
+-commutative80.5%
associate-+l-80.5%
+-commutative80.5%
+-commutative80.5%
Simplified80.5%
Taylor expanded in t around inf 46.4%
Taylor expanded in z around inf 20.6%
+-commutative20.6%
associate--l+40.3%
Simplified40.3%
Taylor expanded in x around 0 18.7%
associate--l+29.8%
associate--r+29.8%
Simplified29.8%
if 4.6999999999999997e188 < z Initial program 78.2%
associate-+l+78.2%
associate-+l+78.2%
+-commutative78.2%
+-commutative78.2%
associate-+l-78.2%
+-commutative78.2%
+-commutative78.2%
Simplified78.2%
Taylor expanded in t around inf 41.6%
Taylor expanded in y around inf 20.7%
Taylor expanded in z around inf 20.8%
+-commutative20.8%
distribute-lft-out20.8%
Simplified20.8%
flip--20.8%
div-inv20.8%
add-sqr-sqrt14.0%
+-commutative14.0%
add-sqr-sqrt20.8%
associate--l+25.3%
+-commutative25.3%
Applied egg-rr25.3%
+-inverses25.3%
metadata-eval25.3%
*-lft-identity25.3%
+-commutative25.3%
Simplified25.3%
Final simplification22.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 x))))
(if (<= z 1.0)
(+ 2.0 (- (+ t_1 (* 0.5 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= z 2.7e+25)
(+ (+ (- t_1 (sqrt x)) (- 1.0 (sqrt y))) (* 0.5 (sqrt (/ 1.0 z))))
(if (<= z 1.82e+186)
(+ 1.0 (- (- (sqrt (+ y 1.0)) (sqrt x)) (sqrt y)))
(/ 1.0 (+ (sqrt x) t_1)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (z <= 1.0) {
tmp = 2.0 + ((t_1 + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (z <= 2.7e+25) {
tmp = ((t_1 - sqrt(x)) + (1.0 - sqrt(y))) + (0.5 * sqrt((1.0 / z)));
} else if (z <= 1.82e+186) {
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (z <= 1.0d0) then
tmp = 2.0d0 + ((t_1 + (0.5d0 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (z <= 2.7d+25) then
tmp = ((t_1 - sqrt(x)) + (1.0d0 - sqrt(y))) + (0.5d0 * sqrt((1.0d0 / z)))
else if (z <= 1.82d+186) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) - sqrt(x)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 1.0) {
tmp = 2.0 + ((t_1 + (0.5 * z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (z <= 2.7e+25) {
tmp = ((t_1 - Math.sqrt(x)) + (1.0 - Math.sqrt(y))) + (0.5 * Math.sqrt((1.0 / z)));
} else if (z <= 1.82e+186) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if z <= 1.0: tmp = 2.0 + ((t_1 + (0.5 * z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif z <= 2.7e+25: tmp = ((t_1 - math.sqrt(x)) + (1.0 - math.sqrt(y))) + (0.5 * math.sqrt((1.0 / z))) elif z <= 1.82e+186: tmp = 1.0 + ((math.sqrt((y + 1.0)) - math.sqrt(x)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 1.0) tmp = Float64(2.0 + Float64(Float64(t_1 + Float64(0.5 * z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (z <= 2.7e+25) tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + Float64(1.0 - sqrt(y))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); elseif (z <= 1.82e+186) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(x)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 1.0)
tmp = 2.0 + ((t_1 + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (z <= 2.7e+25)
tmp = ((t_1 - sqrt(x)) + (1.0 - sqrt(y))) + (0.5 * sqrt((1.0 / z)));
elseif (z <= 1.82e+186)
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.0], N[(2.0 + N[(N[(t$95$1 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+25], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.82e+186], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 1:\\
\;\;\;\;2 + \left(\left(t\_1 + 0.5 \cdot z\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{elif}\;z \leq 1.82 \cdot 10^{+186}:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if z < 1Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-62.2%
+-commutative62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in t around inf 56.1%
Taylor expanded in z around 0 19.3%
Taylor expanded in y around 0 16.4%
associate--l+32.0%
+-commutative32.0%
+-commutative32.0%
Simplified32.0%
if 1 < z < 2.7e25Initial program 73.3%
associate-+l+73.3%
sub-neg73.3%
sub-neg73.3%
+-commutative73.3%
+-commutative73.3%
+-commutative73.3%
Simplified73.3%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around 0 46.0%
Taylor expanded in z around 0 31.2%
if 2.7e25 < z < 1.8200000000000001e186Initial program 81.2%
associate-+l+81.2%
associate-+l+81.2%
+-commutative81.2%
+-commutative81.2%
associate-+l-81.2%
+-commutative81.2%
+-commutative81.2%
Simplified81.2%
Taylor expanded in t around inf 45.2%
Taylor expanded in z around inf 19.8%
+-commutative19.8%
associate--l+38.7%
Simplified38.7%
Taylor expanded in x around 0 17.9%
associate--l+29.5%
associate--r+29.5%
Simplified29.5%
if 1.8200000000000001e186 < z Initial program 77.7%
associate-+l+77.7%
associate-+l+77.7%
+-commutative77.7%
+-commutative77.7%
associate-+l-77.7%
+-commutative77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in t around inf 42.9%
Taylor expanded in z around inf 17.6%
+-commutative17.6%
associate--l+36.4%
Simplified36.4%
Taylor expanded in y around inf 13.2%
flip--13.2%
add-sqr-sqrt13.8%
add-sqr-sqrt13.2%
Applied egg-rr13.2%
associate-+r-19.0%
+-inverses19.0%
metadata-eval19.0%
+-commutative19.0%
Simplified19.0%
Final simplification28.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))) (t_2 (sqrt (+ 1.0 x))))
(if (<= z 1.8)
(- (+ 2.0 (+ t_1 (* 0.5 z))) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(if (<= z 3.5e+25)
(+ (+ (- t_2 (sqrt x)) (- 1.0 (sqrt y))) (* 0.5 (sqrt (/ 1.0 z))))
(if (<= z 1.82e+186)
(+ 1.0 (- (- t_1 (sqrt x)) (sqrt y)))
(/ 1.0 (+ (sqrt x) t_2)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((1.0 + x));
double tmp;
if (z <= 1.8) {
tmp = (2.0 + (t_1 + (0.5 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else if (z <= 3.5e+25) {
tmp = ((t_2 - sqrt(x)) + (1.0 - sqrt(y))) + (0.5 * sqrt((1.0 / z)));
} else if (z <= 1.82e+186) {
tmp = 1.0 + ((t_1 - sqrt(x)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + 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) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((1.0d0 + x))
if (z <= 1.8d0) then
tmp = (2.0d0 + (t_1 + (0.5d0 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else if (z <= 3.5d+25) then
tmp = ((t_2 - sqrt(x)) + (1.0d0 - sqrt(y))) + (0.5d0 * sqrt((1.0d0 / z)))
else if (z <= 1.82d+186) then
tmp = 1.0d0 + ((t_1 - sqrt(x)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + 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((y + 1.0));
double t_2 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 1.8) {
tmp = (2.0 + (t_1 + (0.5 * z))) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else if (z <= 3.5e+25) {
tmp = ((t_2 - Math.sqrt(x)) + (1.0 - Math.sqrt(y))) + (0.5 * Math.sqrt((1.0 / z)));
} else if (z <= 1.82e+186) {
tmp = 1.0 + ((t_1 - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((1.0 + x)) tmp = 0 if z <= 1.8: tmp = (2.0 + (t_1 + (0.5 * z))) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) elif z <= 3.5e+25: tmp = ((t_2 - math.sqrt(x)) + (1.0 - math.sqrt(y))) + (0.5 * math.sqrt((1.0 / z))) elif z <= 1.82e+186: tmp = 1.0 + ((t_1 - math.sqrt(x)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 1.8) tmp = Float64(Float64(2.0 + Float64(t_1 + Float64(0.5 * z))) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); elseif (z <= 3.5e+25) tmp = Float64(Float64(Float64(t_2 - sqrt(x)) + Float64(1.0 - sqrt(y))) + Float64(0.5 * sqrt(Float64(1.0 / z)))); elseif (z <= 1.82e+186) tmp = Float64(1.0 + Float64(Float64(t_1 - sqrt(x)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + 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((y + 1.0));
t_2 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 1.8)
tmp = (2.0 + (t_1 + (0.5 * z))) - (sqrt(x) + (sqrt(y) + sqrt(z)));
elseif (z <= 3.5e+25)
tmp = ((t_2 - sqrt(x)) + (1.0 - sqrt(y))) + (0.5 * sqrt((1.0 / z)));
elseif (z <= 1.82e+186)
tmp = 1.0 + ((t_1 - sqrt(x)) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.8], N[(N[(2.0 + N[(t$95$1 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+25], N[(N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.82e+186], N[(1.0 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 1.8:\\
\;\;\;\;\left(2 + \left(t\_1 + 0.5 \cdot z\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+25}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right) + 0.5 \cdot \sqrt{\frac{1}{z}}\\
\mathbf{elif}\;z \leq 1.82 \cdot 10^{+186}:\\
\;\;\;\;1 + \left(\left(t\_1 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2}\\
\end{array}
\end{array}
if z < 1.80000000000000004Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-62.2%
+-commutative62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in t around inf 56.1%
Taylor expanded in z around 0 19.3%
Taylor expanded in x around 0 16.4%
if 1.80000000000000004 < z < 3.49999999999999999e25Initial program 73.3%
associate-+l+73.3%
sub-neg73.3%
sub-neg73.3%
+-commutative73.3%
+-commutative73.3%
+-commutative73.3%
Simplified73.3%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around 0 46.0%
Taylor expanded in z around 0 31.2%
if 3.49999999999999999e25 < z < 1.8200000000000001e186Initial program 81.2%
associate-+l+81.2%
associate-+l+81.2%
+-commutative81.2%
+-commutative81.2%
associate-+l-81.2%
+-commutative81.2%
+-commutative81.2%
Simplified81.2%
Taylor expanded in t around inf 45.2%
Taylor expanded in z around inf 19.8%
+-commutative19.8%
associate--l+38.7%
Simplified38.7%
Taylor expanded in x around 0 17.9%
associate--l+29.5%
associate--r+29.5%
Simplified29.5%
if 1.8200000000000001e186 < z Initial program 77.7%
associate-+l+77.7%
associate-+l+77.7%
+-commutative77.7%
+-commutative77.7%
associate-+l-77.7%
+-commutative77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in t around inf 42.9%
Taylor expanded in z around inf 17.6%
+-commutative17.6%
associate--l+36.4%
Simplified36.4%
Taylor expanded in y around inf 13.2%
flip--13.2%
add-sqr-sqrt13.8%
add-sqr-sqrt13.2%
Applied egg-rr13.2%
associate-+r-19.0%
+-inverses19.0%
metadata-eval19.0%
+-commutative19.0%
Simplified19.0%
Final simplification20.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= z 0.34)
(+ 2.0 (- (+ t_1 (* 0.5 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z)))))
(if (<= z 1.82e+186)
(+ 1.0 (- (- (sqrt (+ y 1.0)) (sqrt x)) (sqrt y)))
(/ 1.0 (+ (sqrt x) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (z <= 0.34) {
tmp = 2.0 + ((t_1 + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else if (z <= 1.82e+186) {
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (z <= 0.34d0) then
tmp = 2.0d0 + ((t_1 + (0.5d0 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z))))
else if (z <= 1.82d+186) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) - sqrt(x)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (z <= 0.34) {
tmp = 2.0 + ((t_1 + (0.5 * z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else if (z <= 1.82e+186) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if z <= 0.34: tmp = 2.0 + ((t_1 + (0.5 * z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) elif z <= 1.82e+186: tmp = 1.0 + ((math.sqrt((y + 1.0)) - math.sqrt(x)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (z <= 0.34) tmp = Float64(2.0 + Float64(Float64(t_1 + Float64(0.5 * z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); elseif (z <= 1.82e+186) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(x)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (z <= 0.34)
tmp = 2.0 + ((t_1 + (0.5 * z)) - (sqrt(x) + (sqrt(y) + sqrt(z))));
elseif (z <= 1.82e+186)
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.34], N[(2.0 + N[(N[(t$95$1 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.82e+186], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;z \leq 0.34:\\
\;\;\;\;2 + \left(\left(t\_1 + 0.5 \cdot z\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;z \leq 1.82 \cdot 10^{+186}:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if z < 0.340000000000000024Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-62.5%
+-commutative62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in t around inf 55.7%
Taylor expanded in z around 0 19.4%
Taylor expanded in y around 0 16.5%
associate--l+32.1%
+-commutative32.1%
+-commutative32.1%
Simplified32.1%
if 0.340000000000000024 < z < 1.8200000000000001e186Initial program 80.2%
associate-+l+80.2%
associate-+l+80.2%
+-commutative80.2%
+-commutative80.2%
associate-+l-78.4%
+-commutative78.4%
+-commutative78.4%
Simplified78.4%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 20.0%
+-commutative20.0%
associate--l+36.3%
Simplified36.3%
Taylor expanded in x around 0 18.3%
associate--l+30.8%
associate--r+30.8%
Simplified30.8%
if 1.8200000000000001e186 < z Initial program 77.7%
associate-+l+77.7%
associate-+l+77.7%
+-commutative77.7%
+-commutative77.7%
associate-+l-77.7%
+-commutative77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in t around inf 42.9%
Taylor expanded in z around inf 17.6%
+-commutative17.6%
associate--l+36.4%
Simplified36.4%
Taylor expanded in y around inf 13.2%
flip--13.2%
add-sqr-sqrt13.8%
add-sqr-sqrt13.2%
Applied egg-rr13.2%
associate-+r-19.0%
+-inverses19.0%
metadata-eval19.0%
+-commutative19.0%
Simplified19.0%
Final simplification28.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 75000000.0)
(+ 1.0 (- (- (sqrt (+ y 1.0)) (sqrt x)) (sqrt y)))
(if (<= y 1.6e+27)
(+ (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))) (- 1.0 (sqrt x)))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 75000000.0) {
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
} else if (y <= 1.6e+27) {
tmp = (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y)))) + (1.0 - sqrt(x));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 75000000.0d0) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) - sqrt(x)) - sqrt(y))
else if (y <= 1.6d+27) then
tmp = (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y)))) + (1.0d0 - sqrt(x))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 75000000.0) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) - Math.sqrt(x)) - Math.sqrt(y));
} else if (y <= 1.6e+27) {
tmp = (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y)))) + (1.0 - Math.sqrt(x));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 75000000.0: tmp = 1.0 + ((math.sqrt((y + 1.0)) - math.sqrt(x)) - math.sqrt(y)) elif y <= 1.6e+27: tmp = (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) + (1.0 - math.sqrt(x)) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 75000000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(x)) - sqrt(y))); elseif (y <= 1.6e+27) tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y)))) + Float64(1.0 - sqrt(x))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 75000000.0)
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
elseif (y <= 1.6e+27)
tmp = (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y)))) + (1.0 - sqrt(x));
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 75000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+27], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 75000000:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+27}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right) + \left(1 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 7.5e7Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-80.7%
+-commutative80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in t around inf 59.7%
Taylor expanded in z around inf 22.7%
+-commutative22.7%
associate--l+42.1%
Simplified42.1%
Taylor expanded in x around 0 18.9%
associate--l+18.9%
associate--r+18.9%
Simplified18.9%
if 7.5e7 < y < 1.60000000000000008e27Initial program 65.9%
associate-+l+65.9%
associate-+l+65.9%
+-commutative65.9%
+-commutative65.9%
associate-+l-58.6%
+-commutative58.6%
+-commutative58.6%
Simplified58.6%
Taylor expanded in t around inf 28.8%
Taylor expanded in y around inf 43.4%
Taylor expanded in z around inf 30.3%
+-commutative30.3%
distribute-lft-out30.3%
Simplified30.3%
Taylor expanded in x around 0 16.3%
if 1.60000000000000008e27 < y Initial program 79.6%
associate-+l+79.6%
associate-+l+79.6%
+-commutative79.6%
+-commutative79.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 40.1%
Taylor expanded in z around inf 3.2%
+-commutative3.2%
associate--l+4.1%
Simplified4.1%
Taylor expanded in y around inf 14.1%
flip--14.1%
add-sqr-sqrt14.2%
add-sqr-sqrt14.1%
Applied egg-rr14.1%
associate-+r-19.1%
+-inverses19.1%
metadata-eval19.1%
+-commutative19.1%
Simplified19.1%
Final simplification18.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 x))))
(if (<= y 54000000.0)
(+ 1.0 (- (- (sqrt (+ y 1.0)) (sqrt x)) (sqrt y)))
(if (<= y 1.6e+27)
(+ (- t_1 (sqrt x)) (* 0.5 (sqrt (/ 1.0 y))))
(/ 1.0 (+ (sqrt x) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 54000000.0) {
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
} else if (y <= 1.6e+27) {
tmp = (t_1 - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 54000000.0d0) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) - sqrt(x)) - sqrt(y))
else if (y <= 1.6d+27) then
tmp = (t_1 - sqrt(x)) + (0.5d0 * sqrt((1.0d0 / y)))
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 54000000.0) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) - Math.sqrt(x)) - Math.sqrt(y));
} else if (y <= 1.6e+27) {
tmp = (t_1 - Math.sqrt(x)) + (0.5 * Math.sqrt((1.0 / y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 54000000.0: tmp = 1.0 + ((math.sqrt((y + 1.0)) - math.sqrt(x)) - math.sqrt(y)) elif y <= 1.6e+27: tmp = (t_1 - math.sqrt(x)) + (0.5 * math.sqrt((1.0 / y))) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 54000000.0) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(x)) - sqrt(y))); elseif (y <= 1.6e+27) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(0.5 * sqrt(Float64(1.0 / y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 54000000.0)
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
elseif (y <= 1.6e+27)
tmp = (t_1 - sqrt(x)) + (0.5 * sqrt((1.0 / y)));
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 54000000.0], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+27], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 54000000:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+27}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + 0.5 \cdot \sqrt{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1}\\
\end{array}
\end{array}
if y < 5.4e7Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-80.7%
+-commutative80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in t around inf 59.7%
Taylor expanded in z around inf 22.7%
+-commutative22.7%
associate--l+42.1%
Simplified42.1%
Taylor expanded in x around 0 18.9%
associate--l+18.9%
associate--r+18.9%
Simplified18.9%
if 5.4e7 < y < 1.60000000000000008e27Initial program 65.9%
associate-+l+65.9%
associate-+l+65.9%
+-commutative65.9%
+-commutative65.9%
associate-+l-58.6%
+-commutative58.6%
+-commutative58.6%
Simplified58.6%
Taylor expanded in t around inf 28.8%
Taylor expanded in y around inf 43.4%
Taylor expanded in y around 0 33.9%
if 1.60000000000000008e27 < y Initial program 79.6%
associate-+l+79.6%
associate-+l+79.6%
+-commutative79.6%
+-commutative79.6%
associate-+l-59.5%
+-commutative59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in t around inf 40.1%
Taylor expanded in z around inf 3.2%
+-commutative3.2%
associate--l+4.1%
Simplified4.1%
Taylor expanded in y around inf 14.1%
flip--14.1%
add-sqr-sqrt14.2%
add-sqr-sqrt14.1%
Applied egg-rr14.1%
associate-+r-19.1%
+-inverses19.1%
metadata-eval19.1%
+-commutative19.1%
Simplified19.1%
Final simplification19.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 3.1) (+ 1.0 (- (- (sqrt (+ y 1.0)) (sqrt x)) (sqrt y))) (+ (* 0.5 (+ (sqrt (/ 1.0 z)) (sqrt (/ 1.0 y)))) (* 0.5 (sqrt (/ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.1) {
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
} else {
tmp = (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y)))) + (0.5 * sqrt((1.0 / x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 3.1d0) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) - sqrt(x)) - sqrt(y))
else
tmp = (0.5d0 * (sqrt((1.0d0 / z)) + sqrt((1.0d0 / y)))) + (0.5d0 * sqrt((1.0d0 / x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.1) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = (0.5 * (Math.sqrt((1.0 / z)) + Math.sqrt((1.0 / y)))) + (0.5 * Math.sqrt((1.0 / x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 3.1: tmp = 1.0 + ((math.sqrt((y + 1.0)) - math.sqrt(x)) - math.sqrt(y)) else: tmp = (0.5 * (math.sqrt((1.0 / z)) + math.sqrt((1.0 / y)))) + (0.5 * math.sqrt((1.0 / x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 3.1) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(x)) - sqrt(y))); else tmp = Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / z)) + sqrt(Float64(1.0 / y)))) + Float64(0.5 * sqrt(Float64(1.0 / x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 3.1)
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
else
tmp = (0.5 * (sqrt((1.0 / z)) + sqrt((1.0 / y)))) + (0.5 * sqrt((1.0 / x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 3.1], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{\frac{1}{z}} + \sqrt{\frac{1}{y}}\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 3.10000000000000009Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-78.5%
+-commutative78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in t around inf 55.6%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
associate--l+24.4%
Simplified24.4%
Taylor expanded in x around 0 23.9%
associate--l+34.8%
associate--r+34.8%
Simplified34.8%
if 3.10000000000000009 < x Initial program 82.0%
associate-+l+82.0%
associate-+l+82.0%
+-commutative82.0%
+-commutative82.0%
associate-+l-64.1%
+-commutative64.1%
+-commutative64.1%
Simplified64.1%
Taylor expanded in t around inf 45.3%
Taylor expanded in y around inf 25.0%
Taylor expanded in z around inf 12.6%
+-commutative12.6%
distribute-lft-out12.6%
Simplified12.6%
Taylor expanded in x around inf 15.9%
Final simplification24.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 (<= x 7.2e-16) (+ 1.0 (- (- (sqrt (+ y 1.0)) (sqrt x)) (sqrt y))) (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.2e-16) {
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 7.2d-16) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) - sqrt(x)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.2e-16) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) - Math.sqrt(x)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 7.2e-16: tmp = 1.0 + ((math.sqrt((y + 1.0)) - math.sqrt(x)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 7.2e-16) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(x)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 7.2e-16)
tmp = 1.0 + ((sqrt((y + 1.0)) - sqrt(x)) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 7.2e-16], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-16}:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if x < 7.19999999999999965e-16Initial program 95.6%
associate-+l+95.6%
associate-+l+95.6%
+-commutative95.6%
+-commutative95.6%
associate-+l-79.0%
+-commutative79.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in t around inf 55.1%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
associate--l+24.4%
Simplified24.4%
Taylor expanded in x around 0 24.4%
associate--l+35.3%
associate--r+35.3%
Simplified35.3%
if 7.19999999999999965e-16 < x Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-64.3%
+-commutative64.3%
+-commutative64.3%
Simplified64.3%
Taylor expanded in t around inf 46.1%
Taylor expanded in z around inf 6.1%
+-commutative6.1%
associate--l+24.2%
Simplified24.2%
Taylor expanded in y around inf 4.1%
flip--4.1%
add-sqr-sqrt4.8%
add-sqr-sqrt4.2%
Applied egg-rr4.2%
associate-+r-9.8%
+-inverses9.8%
metadata-eval9.8%
+-commutative9.8%
Simplified9.8%
Final simplification20.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x} + \sqrt{1 + x}}
\end{array}
Initial program 88.0%
associate-+l+88.0%
associate-+l+88.0%
+-commutative88.0%
+-commutative88.0%
associate-+l-70.4%
+-commutative70.4%
+-commutative70.4%
Simplified70.4%
Taylor expanded in t around inf 49.8%
Taylor expanded in z around inf 13.7%
+-commutative13.7%
associate--l+24.3%
Simplified24.3%
Taylor expanded in y around inf 12.4%
flip--12.4%
add-sqr-sqrt12.8%
add-sqr-sqrt12.4%
Applied egg-rr12.4%
associate-+r-15.6%
+-inverses15.6%
metadata-eval15.6%
+-commutative15.6%
Simplified15.6%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 1.3) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.3) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.3d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.3) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.3: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.3) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.3)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.3], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.30000000000000004Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-78.5%
+-commutative78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in t around inf 55.6%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
associate--l+24.4%
Simplified24.4%
Taylor expanded in y around inf 23.6%
Taylor expanded in x around 0 23.6%
if 1.30000000000000004 < x Initial program 82.0%
associate-+l+82.0%
associate-+l+82.0%
+-commutative82.0%
+-commutative82.0%
associate-+l-64.1%
+-commutative64.1%
+-commutative64.1%
Simplified64.1%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 5.4%
+-commutative5.4%
associate--l+24.2%
Simplified24.2%
Taylor expanded in y around inf 3.6%
Taylor expanded in x around inf 9.5%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 1.2) (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.2) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.2d0) then
tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.2) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.2: tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.2) tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.2)
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.2], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.2:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.19999999999999996Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-78.5%
+-commutative78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in t around inf 55.6%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
associate--l+24.4%
Simplified24.4%
Taylor expanded in y around inf 23.6%
Taylor expanded in x around 0 23.6%
associate--l+23.6%
Simplified23.6%
if 1.19999999999999996 < x Initial program 82.0%
associate-+l+82.0%
associate-+l+82.0%
+-commutative82.0%
+-commutative82.0%
associate-+l-64.1%
+-commutative64.1%
+-commutative64.1%
Simplified64.1%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 5.4%
+-commutative5.4%
associate--l+24.2%
Simplified24.2%
Taylor expanded in y around inf 3.6%
Taylor expanded in x around inf 9.5%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.75) (- (+ 1.0 (* x 0.5)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.75) {
tmp = (1.0 + (x * 0.5)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.75d0) then
tmp = (1.0d0 + (x * 0.5d0)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.75) {
tmp = (1.0 + (x * 0.5)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.75: tmp = (1.0 + (x * 0.5)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.75) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.75)
tmp = (1.0 + (x * 0.5)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.75], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.75:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.75Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-78.5%
+-commutative78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in t around inf 55.6%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
associate--l+24.4%
Simplified24.4%
Taylor expanded in y around inf 23.6%
Taylor expanded in x around 0 23.6%
if 0.75 < x Initial program 82.0%
associate-+l+82.0%
associate-+l+82.0%
+-commutative82.0%
+-commutative82.0%
associate-+l-64.1%
+-commutative64.1%
+-commutative64.1%
Simplified64.1%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 5.4%
+-commutative5.4%
associate--l+24.2%
Simplified24.2%
Taylor expanded in y around inf 3.6%
Taylor expanded in x around inf 9.5%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.05) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.05) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.05d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.05) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.05: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.05) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.05)
tmp = 1.0 - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.05], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.05:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.050000000000000003Initial program 95.8%
associate-+l+95.8%
associate-+l+95.8%
+-commutative95.8%
+-commutative95.8%
associate-+l-78.5%
+-commutative78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in t around inf 55.6%
Taylor expanded in z around inf 24.4%
+-commutative24.4%
associate--l+24.4%
Simplified24.4%
Taylor expanded in y around inf 23.6%
Taylor expanded in x around 0 23.6%
if 0.050000000000000003 < x Initial program 82.0%
associate-+l+82.0%
associate-+l+82.0%
+-commutative82.0%
+-commutative82.0%
associate-+l-64.1%
+-commutative64.1%
+-commutative64.1%
Simplified64.1%
Taylor expanded in t around inf 45.3%
Taylor expanded in z around inf 5.4%
+-commutative5.4%
associate--l+24.2%
Simplified24.2%
Taylor expanded in y around inf 3.6%
Taylor expanded in x around inf 9.5%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 88.0%
associate-+l+88.0%
associate-+l+88.0%
+-commutative88.0%
+-commutative88.0%
associate-+l-70.4%
+-commutative70.4%
+-commutative70.4%
Simplified70.4%
Taylor expanded in t around inf 49.8%
Taylor expanded in z around inf 13.7%
+-commutative13.7%
associate--l+24.3%
Simplified24.3%
Taylor expanded in y around inf 12.4%
Taylor expanded in x around 0 11.1%
Final simplification11.1%
(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 2024074
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))