
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ t 1.0)))
(t_2 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_3 (sqrt (+ z 1.0)))
(t_4 (- t_3 (sqrt z)))
(t_5 (sqrt (+ x 1.0)))
(t_6 (- t_5 (sqrt x)))
(t_7 (+ t_6 t_2))
(t_8 (+ t_4 t_7)))
(if (<= t_8 1.002)
(+
(/ 1.0 (+ t_5 (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ t_1 (- t_4 (sqrt t)))))
(if (<= t_8 2.05)
(+ t_6 (+ t_2 (+ (* 0.5 (sqrt (/ 1.0 t))) (/ 1.0 (+ t_3 (sqrt z))))))
(+ t_7 (+ t_4 (/ 1.0 (+ t_1 (sqrt t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((t + 1.0));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double t_3 = sqrt((z + 1.0));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt((x + 1.0));
double t_6 = t_5 - sqrt(x);
double t_7 = t_6 + t_2;
double t_8 = t_4 + t_7;
double tmp;
if (t_8 <= 1.002) {
tmp = (1.0 / (t_5 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_1 + (t_4 - sqrt(t))));
} else if (t_8 <= 2.05) {
tmp = t_6 + (t_2 + ((0.5 * sqrt((1.0 / t))) + (1.0 / (t_3 + sqrt(z)))));
} else {
tmp = t_7 + (t_4 + (1.0 / (t_1 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: tmp
t_1 = sqrt((t + 1.0d0))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
t_3 = sqrt((z + 1.0d0))
t_4 = t_3 - sqrt(z)
t_5 = sqrt((x + 1.0d0))
t_6 = t_5 - sqrt(x)
t_7 = t_6 + t_2
t_8 = t_4 + t_7
if (t_8 <= 1.002d0) then
tmp = (1.0d0 / (t_5 + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (t_1 + (t_4 - sqrt(t))))
else if (t_8 <= 2.05d0) then
tmp = t_6 + (t_2 + ((0.5d0 * sqrt((1.0d0 / t))) + (1.0d0 / (t_3 + sqrt(z)))))
else
tmp = t_7 + (t_4 + (1.0d0 / (t_1 + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((t + 1.0));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_3 = Math.sqrt((z + 1.0));
double t_4 = t_3 - Math.sqrt(z);
double t_5 = Math.sqrt((x + 1.0));
double t_6 = t_5 - Math.sqrt(x);
double t_7 = t_6 + t_2;
double t_8 = t_4 + t_7;
double tmp;
if (t_8 <= 1.002) {
tmp = (1.0 / (t_5 + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) + (t_1 + (t_4 - Math.sqrt(t))));
} else if (t_8 <= 2.05) {
tmp = t_6 + (t_2 + ((0.5 * Math.sqrt((1.0 / t))) + (1.0 / (t_3 + Math.sqrt(z)))));
} else {
tmp = t_7 + (t_4 + (1.0 / (t_1 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((t + 1.0)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) t_3 = math.sqrt((z + 1.0)) t_4 = t_3 - math.sqrt(z) t_5 = math.sqrt((x + 1.0)) t_6 = t_5 - math.sqrt(x) t_7 = t_6 + t_2 t_8 = t_4 + t_7 tmp = 0 if t_8 <= 1.002: tmp = (1.0 / (t_5 + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) + (t_1 + (t_4 - math.sqrt(t)))) elif t_8 <= 2.05: tmp = t_6 + (t_2 + ((0.5 * math.sqrt((1.0 / t))) + (1.0 / (t_3 + math.sqrt(z))))) else: tmp = t_7 + (t_4 + (1.0 / (t_1 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(t + 1.0)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_3 = sqrt(Float64(z + 1.0)) t_4 = Float64(t_3 - sqrt(z)) t_5 = sqrt(Float64(x + 1.0)) t_6 = Float64(t_5 - sqrt(x)) t_7 = Float64(t_6 + t_2) t_8 = Float64(t_4 + t_7) tmp = 0.0 if (t_8 <= 1.002) tmp = Float64(Float64(1.0 / Float64(t_5 + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(t_1 + Float64(t_4 - sqrt(t))))); elseif (t_8 <= 2.05) tmp = Float64(t_6 + Float64(t_2 + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(1.0 / Float64(t_3 + sqrt(z)))))); else tmp = Float64(t_7 + Float64(t_4 + Float64(1.0 / Float64(t_1 + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((t + 1.0));
t_2 = sqrt((y + 1.0)) - sqrt(y);
t_3 = sqrt((z + 1.0));
t_4 = t_3 - sqrt(z);
t_5 = sqrt((x + 1.0));
t_6 = t_5 - sqrt(x);
t_7 = t_6 + t_2;
t_8 = t_4 + t_7;
tmp = 0.0;
if (t_8 <= 1.002)
tmp = (1.0 / (t_5 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_1 + (t_4 - sqrt(t))));
elseif (t_8 <= 2.05)
tmp = t_6 + (t_2 + ((0.5 * sqrt((1.0 / t))) + (1.0 / (t_3 + sqrt(z)))));
else
tmp = t_7 + (t_4 + (1.0 / (t_1 + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$6 + t$95$2), $MachinePrecision]}, Block[{t$95$8 = N[(t$95$4 + t$95$7), $MachinePrecision]}, If[LessEqual[t$95$8, 1.002], N[(N[(1.0 / N[(t$95$5 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$8, 2.05], N[(t$95$6 + N[(t$95$2 + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$7 + N[(t$95$4 + N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{t + 1}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
t_3 := \sqrt{z + 1}\\
t_4 := t\_3 - \sqrt{z}\\
t_5 := \sqrt{x + 1}\\
t_6 := t\_5 - \sqrt{x}\\
t_7 := t\_6 + t\_2\\
t_8 := t\_4 + t\_7\\
\mathbf{if}\;t\_8 \leq 1.002:\\
\;\;\;\;\frac{1}{t\_5 + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(t\_1 + \left(t\_4 - \sqrt{t}\right)\right)\right)\\
\mathbf{elif}\;t\_8 \leq 2.05:\\
\;\;\;\;t\_6 + \left(t\_2 + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \frac{1}{t\_3 + \sqrt{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_7 + \left(t\_4 + \frac{1}{t\_1 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 1.002Initial program 87.3%
associate-+l+87.3%
associate-+l+87.3%
+-commutative87.3%
+-commutative87.3%
associate-+l-73.4%
+-commutative73.4%
+-commutative73.4%
Simplified73.4%
flip--73.5%
div-inv73.5%
add-sqr-sqrt51.8%
+-commutative51.8%
add-sqr-sqrt73.5%
associate--l+76.6%
+-commutative76.6%
Applied egg-rr76.6%
+-inverses76.6%
metadata-eval76.6%
*-lft-identity76.6%
+-commutative76.6%
Simplified76.6%
Taylor expanded in y around inf 53.3%
if 1.002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 2.0499999999999998Initial program 97.5%
associate-+l+97.5%
associate-+l+97.5%
+-commutative97.5%
+-commutative97.5%
associate-+l-68.7%
+-commutative68.7%
+-commutative68.7%
Simplified68.7%
associate--r-97.5%
flip--97.8%
flip--97.8%
frac-add97.7%
Applied egg-rr99.1%
Taylor expanded in t around inf 54.7%
if 2.0499999999999998 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) Initial program 98.3%
associate-+l+98.3%
sub-neg98.3%
sub-neg98.3%
+-commutative98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
flip--98.8%
div-inv98.8%
add-sqr-sqrt66.3%
add-sqr-sqrt99.9%
associate--l+99.9%
Applied egg-rr99.9%
+-inverses99.9%
metadata-eval99.9%
*-lft-identity99.9%
+-commutative99.9%
Simplified99.9%
Final simplification60.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 (+ t 1.0)))
(t_2 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_3 (sqrt (+ z 1.0)))
(t_4 (- t_3 (sqrt z)))
(t_5 (sqrt (+ x 1.0)))
(t_6 (- t_5 (sqrt x)))
(t_7 (+ t_6 t_2))
(t_8 (+ t_4 t_7)))
(if (<= t_8 1.002)
(+
(/ 1.0 (+ t_5 (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ t_1 (- t_4 (sqrt t)))))
(if (<= t_8 2.9999998)
(+ t_6 (+ t_2 (+ (* 0.5 (sqrt (/ 1.0 t))) (/ 1.0 (+ t_3 (sqrt z))))))
(+ t_7 (+ (/ 1.0 (+ t_1 (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((t + 1.0));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double t_3 = sqrt((z + 1.0));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt((x + 1.0));
double t_6 = t_5 - sqrt(x);
double t_7 = t_6 + t_2;
double t_8 = t_4 + t_7;
double tmp;
if (t_8 <= 1.002) {
tmp = (1.0 / (t_5 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_1 + (t_4 - sqrt(t))));
} else if (t_8 <= 2.9999998) {
tmp = t_6 + (t_2 + ((0.5 * sqrt((1.0 / t))) + (1.0 / (t_3 + sqrt(z)))));
} else {
tmp = t_7 + ((1.0 / (t_1 + 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) :: t_7
real(8) :: t_8
real(8) :: tmp
t_1 = sqrt((t + 1.0d0))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
t_3 = sqrt((z + 1.0d0))
t_4 = t_3 - sqrt(z)
t_5 = sqrt((x + 1.0d0))
t_6 = t_5 - sqrt(x)
t_7 = t_6 + t_2
t_8 = t_4 + t_7
if (t_8 <= 1.002d0) then
tmp = (1.0d0 / (t_5 + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (t_1 + (t_4 - sqrt(t))))
else if (t_8 <= 2.9999998d0) then
tmp = t_6 + (t_2 + ((0.5d0 * sqrt((1.0d0 / t))) + (1.0d0 / (t_3 + sqrt(z)))))
else
tmp = t_7 + ((1.0d0 / (t_1 + 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((t + 1.0));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_3 = Math.sqrt((z + 1.0));
double t_4 = t_3 - Math.sqrt(z);
double t_5 = Math.sqrt((x + 1.0));
double t_6 = t_5 - Math.sqrt(x);
double t_7 = t_6 + t_2;
double t_8 = t_4 + t_7;
double tmp;
if (t_8 <= 1.002) {
tmp = (1.0 / (t_5 + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) + (t_1 + (t_4 - Math.sqrt(t))));
} else if (t_8 <= 2.9999998) {
tmp = t_6 + (t_2 + ((0.5 * Math.sqrt((1.0 / t))) + (1.0 / (t_3 + Math.sqrt(z)))));
} else {
tmp = t_7 + ((1.0 / (t_1 + 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((t + 1.0)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) t_3 = math.sqrt((z + 1.0)) t_4 = t_3 - math.sqrt(z) t_5 = math.sqrt((x + 1.0)) t_6 = t_5 - math.sqrt(x) t_7 = t_6 + t_2 t_8 = t_4 + t_7 tmp = 0 if t_8 <= 1.002: tmp = (1.0 / (t_5 + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) + (t_1 + (t_4 - math.sqrt(t)))) elif t_8 <= 2.9999998: tmp = t_6 + (t_2 + ((0.5 * math.sqrt((1.0 / t))) + (1.0 / (t_3 + math.sqrt(z))))) else: tmp = t_7 + ((1.0 / (t_1 + 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(t + 1.0)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_3 = sqrt(Float64(z + 1.0)) t_4 = Float64(t_3 - sqrt(z)) t_5 = sqrt(Float64(x + 1.0)) t_6 = Float64(t_5 - sqrt(x)) t_7 = Float64(t_6 + t_2) t_8 = Float64(t_4 + t_7) tmp = 0.0 if (t_8 <= 1.002) tmp = Float64(Float64(1.0 / Float64(t_5 + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(t_1 + Float64(t_4 - sqrt(t))))); elseif (t_8 <= 2.9999998) tmp = Float64(t_6 + Float64(t_2 + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(1.0 / Float64(t_3 + sqrt(z)))))); else tmp = Float64(t_7 + Float64(Float64(1.0 / Float64(t_1 + 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((t + 1.0));
t_2 = sqrt((y + 1.0)) - sqrt(y);
t_3 = sqrt((z + 1.0));
t_4 = t_3 - sqrt(z);
t_5 = sqrt((x + 1.0));
t_6 = t_5 - sqrt(x);
t_7 = t_6 + t_2;
t_8 = t_4 + t_7;
tmp = 0.0;
if (t_8 <= 1.002)
tmp = (1.0 / (t_5 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_1 + (t_4 - sqrt(t))));
elseif (t_8 <= 2.9999998)
tmp = t_6 + (t_2 + ((0.5 * sqrt((1.0 / t))) + (1.0 / (t_3 + sqrt(z)))));
else
tmp = t_7 + ((1.0 / (t_1 + 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[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$6 + t$95$2), $MachinePrecision]}, Block[{t$95$8 = N[(t$95$4 + t$95$7), $MachinePrecision]}, If[LessEqual[t$95$8, 1.002], N[(N[(1.0 / N[(t$95$5 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$8, 2.9999998], N[(t$95$6 + N[(t$95$2 + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$7 + N[(N[(1.0 / N[(t$95$1 + 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{t + 1}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
t_3 := \sqrt{z + 1}\\
t_4 := t\_3 - \sqrt{z}\\
t_5 := \sqrt{x + 1}\\
t_6 := t\_5 - \sqrt{x}\\
t_7 := t\_6 + t\_2\\
t_8 := t\_4 + t\_7\\
\mathbf{if}\;t\_8 \leq 1.002:\\
\;\;\;\;\frac{1}{t\_5 + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(t\_1 + \left(t\_4 - \sqrt{t}\right)\right)\right)\\
\mathbf{elif}\;t\_8 \leq 2.9999998:\\
\;\;\;\;t\_6 + \left(t\_2 + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \frac{1}{t\_3 + \sqrt{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_7 + \left(\frac{1}{t\_1 + \sqrt{t}} + \left(1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 1.002Initial program 87.3%
associate-+l+87.3%
associate-+l+87.3%
+-commutative87.3%
+-commutative87.3%
associate-+l-73.4%
+-commutative73.4%
+-commutative73.4%
Simplified73.4%
flip--73.5%
div-inv73.5%
add-sqr-sqrt51.8%
+-commutative51.8%
add-sqr-sqrt73.5%
associate--l+76.6%
+-commutative76.6%
Applied egg-rr76.6%
+-inverses76.6%
metadata-eval76.6%
*-lft-identity76.6%
+-commutative76.6%
Simplified76.6%
Taylor expanded in y around inf 53.3%
if 1.002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 2.99999979999999988Initial program 97.5%
associate-+l+97.5%
associate-+l+97.5%
+-commutative97.5%
+-commutative97.5%
associate-+l-67.4%
+-commutative67.4%
+-commutative67.4%
Simplified67.4%
associate--r-97.5%
flip--97.8%
flip--97.8%
frac-add97.8%
Applied egg-rr99.2%
Taylor expanded in t around inf 55.9%
if 2.99999979999999988 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) Initial program 98.2%
associate-+l+98.2%
sub-neg98.2%
sub-neg98.2%
+-commutative98.2%
+-commutative98.2%
+-commutative98.2%
Simplified98.2%
flip--98.7%
div-inv98.7%
add-sqr-sqrt66.1%
add-sqr-sqrt99.9%
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 simplification60.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_3 (sqrt (+ t 1.0)))
(t_4 (+ t_3 (sqrt t)))
(t_5 (sqrt (+ z 1.0)))
(t_6 (+ t_5 (sqrt z))))
(if (<= t_2 0.0001)
(+
(/ 1.0 (+ t_1 (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ t_3 (- (- t_5 (sqrt z)) (sqrt t)))))
(+
(- t_1 (sqrt x))
(+
t_2
(/ (+ (* (+ (- t t) 1.0) t_6) (* t_4 (+ z (- 1.0 z)))) (* t_6 t_4)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double t_3 = sqrt((t + 1.0));
double t_4 = t_3 + sqrt(t);
double t_5 = sqrt((z + 1.0));
double t_6 = t_5 + sqrt(z);
double tmp;
if (t_2 <= 0.0001) {
tmp = (1.0 / (t_1 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_3 + ((t_5 - sqrt(z)) - sqrt(t))));
} else {
tmp = (t_1 - sqrt(x)) + (t_2 + (((((t - t) + 1.0) * t_6) + (t_4 * (z + (1.0 - z)))) / (t_6 * 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) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
t_3 = sqrt((t + 1.0d0))
t_4 = t_3 + sqrt(t)
t_5 = sqrt((z + 1.0d0))
t_6 = t_5 + sqrt(z)
if (t_2 <= 0.0001d0) then
tmp = (1.0d0 / (t_1 + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (t_3 + ((t_5 - sqrt(z)) - sqrt(t))))
else
tmp = (t_1 - sqrt(x)) + (t_2 + (((((t - t) + 1.0d0) * t_6) + (t_4 * (z + (1.0d0 - z)))) / (t_6 * 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((x + 1.0));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_3 = Math.sqrt((t + 1.0));
double t_4 = t_3 + Math.sqrt(t);
double t_5 = Math.sqrt((z + 1.0));
double t_6 = t_5 + Math.sqrt(z);
double tmp;
if (t_2 <= 0.0001) {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) + (t_3 + ((t_5 - Math.sqrt(z)) - Math.sqrt(t))));
} else {
tmp = (t_1 - Math.sqrt(x)) + (t_2 + (((((t - t) + 1.0) * t_6) + (t_4 * (z + (1.0 - z)))) / (t_6 * t_4)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) t_3 = math.sqrt((t + 1.0)) t_4 = t_3 + math.sqrt(t) t_5 = math.sqrt((z + 1.0)) t_6 = t_5 + math.sqrt(z) tmp = 0 if t_2 <= 0.0001: tmp = (1.0 / (t_1 + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) + (t_3 + ((t_5 - math.sqrt(z)) - math.sqrt(t)))) else: tmp = (t_1 - math.sqrt(x)) + (t_2 + (((((t - t) + 1.0) * t_6) + (t_4 * (z + (1.0 - z)))) / (t_6 * t_4))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_3 = sqrt(Float64(t + 1.0)) t_4 = Float64(t_3 + sqrt(t)) t_5 = sqrt(Float64(z + 1.0)) t_6 = Float64(t_5 + sqrt(z)) tmp = 0.0 if (t_2 <= 0.0001) tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(t_3 + Float64(Float64(t_5 - sqrt(z)) - sqrt(t))))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(t_2 + Float64(Float64(Float64(Float64(Float64(t - t) + 1.0) * t_6) + Float64(t_4 * Float64(z + Float64(1.0 - z)))) / Float64(t_6 * 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((x + 1.0));
t_2 = sqrt((y + 1.0)) - sqrt(y);
t_3 = sqrt((t + 1.0));
t_4 = t_3 + sqrt(t);
t_5 = sqrt((z + 1.0));
t_6 = t_5 + sqrt(z);
tmp = 0.0;
if (t_2 <= 0.0001)
tmp = (1.0 / (t_1 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_3 + ((t_5 - sqrt(z)) - sqrt(t))));
else
tmp = (t_1 - sqrt(x)) + (t_2 + (((((t - t) + 1.0) * t_6) + (t_4 * (z + (1.0 - z)))) / (t_6 * 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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0001], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[(t$95$5 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(N[(N[(N[(N[(t - t), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$6), $MachinePrecision] + N[(t$95$4 * N[(z + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$6 * 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{x + 1}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
t_3 := \sqrt{t + 1}\\
t_4 := t\_3 + \sqrt{t}\\
t_5 := \sqrt{z + 1}\\
t_6 := t\_5 + \sqrt{z}\\
\mathbf{if}\;t\_2 \leq 0.0001:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(t\_3 + \left(\left(t\_5 - \sqrt{z}\right) - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(t\_2 + \frac{\left(\left(t - t\right) + 1\right) \cdot t\_6 + t\_4 \cdot \left(z + \left(1 - z\right)\right)}{t\_6 \cdot t\_4}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 1.00000000000000005e-4Initial program 88.0%
associate-+l+88.0%
associate-+l+88.0%
+-commutative88.0%
+-commutative88.0%
associate-+l-64.3%
+-commutative64.3%
+-commutative64.3%
Simplified64.3%
flip--64.3%
div-inv64.3%
add-sqr-sqrt49.9%
+-commutative49.9%
add-sqr-sqrt64.3%
associate--l+66.9%
+-commutative66.9%
Applied egg-rr66.9%
+-inverses66.9%
metadata-eval66.9%
*-lft-identity66.9%
+-commutative66.9%
Simplified66.9%
Taylor expanded in y around inf 69.2%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-72.0%
+-commutative72.0%
+-commutative72.0%
Simplified72.0%
associate--r-96.8%
flip--97.1%
flip--97.1%
frac-add97.1%
Applied egg-rr98.5%
Final simplification86.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_3 (sqrt (+ t 1.0)))
(t_4 (sqrt (+ z 1.0))))
(if (<= t_2 0.0001)
(+
(/ 1.0 (+ t_1 (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ t_3 (- (- t_4 (sqrt z)) (sqrt t)))))
(+
(+ (- t_1 (sqrt x)) t_2)
(+ (/ (+ z (- 1.0 z)) (+ t_4 (sqrt z))) (- t_3 (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double t_3 = sqrt((t + 1.0));
double t_4 = sqrt((z + 1.0));
double tmp;
if (t_2 <= 0.0001) {
tmp = (1.0 / (t_1 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_3 + ((t_4 - sqrt(z)) - sqrt(t))));
} else {
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0 - z)) / (t_4 + sqrt(z))) + (t_3 - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
t_3 = sqrt((t + 1.0d0))
t_4 = sqrt((z + 1.0d0))
if (t_2 <= 0.0001d0) then
tmp = (1.0d0 / (t_1 + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (t_3 + ((t_4 - sqrt(z)) - sqrt(t))))
else
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0d0 - z)) / (t_4 + sqrt(z))) + (t_3 - 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((x + 1.0));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_3 = Math.sqrt((t + 1.0));
double t_4 = Math.sqrt((z + 1.0));
double tmp;
if (t_2 <= 0.0001) {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) + (t_3 + ((t_4 - Math.sqrt(z)) - Math.sqrt(t))));
} else {
tmp = ((t_1 - Math.sqrt(x)) + t_2) + (((z + (1.0 - z)) / (t_4 + Math.sqrt(z))) + (t_3 - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) t_3 = math.sqrt((t + 1.0)) t_4 = math.sqrt((z + 1.0)) tmp = 0 if t_2 <= 0.0001: tmp = (1.0 / (t_1 + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) + (t_3 + ((t_4 - math.sqrt(z)) - math.sqrt(t)))) else: tmp = ((t_1 - math.sqrt(x)) + t_2) + (((z + (1.0 - z)) / (t_4 + math.sqrt(z))) + (t_3 - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_3 = sqrt(Float64(t + 1.0)) t_4 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t_2 <= 0.0001) tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(t_3 + Float64(Float64(t_4 - sqrt(z)) - sqrt(t))))); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + t_2) + Float64(Float64(Float64(z + Float64(1.0 - z)) / Float64(t_4 + sqrt(z))) + Float64(t_3 - 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((x + 1.0));
t_2 = sqrt((y + 1.0)) - sqrt(y);
t_3 = sqrt((t + 1.0));
t_4 = sqrt((z + 1.0));
tmp = 0.0;
if (t_2 <= 0.0001)
tmp = (1.0 / (t_1 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_3 + ((t_4 - sqrt(z)) - sqrt(t))));
else
tmp = ((t_1 - sqrt(x)) + t_2) + (((z + (1.0 - z)) / (t_4 + sqrt(z))) + (t_3 - 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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.0001], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $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[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - 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{x + 1}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
t_3 := \sqrt{t + 1}\\
t_4 := \sqrt{z + 1}\\
\mathbf{if}\;t\_2 \leq 0.0001:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(t\_3 + \left(\left(t\_4 - \sqrt{z}\right) - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + t\_2\right) + \left(\frac{z + \left(1 - z\right)}{t\_4 + \sqrt{z}} + \left(t\_3 - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 1.00000000000000005e-4Initial program 88.0%
associate-+l+88.0%
associate-+l+88.0%
+-commutative88.0%
+-commutative88.0%
associate-+l-64.3%
+-commutative64.3%
+-commutative64.3%
Simplified64.3%
flip--64.3%
div-inv64.3%
add-sqr-sqrt49.9%
+-commutative49.9%
add-sqr-sqrt64.3%
associate--l+66.9%
+-commutative66.9%
Applied egg-rr66.9%
+-inverses66.9%
metadata-eval66.9%
*-lft-identity66.9%
+-commutative66.9%
Simplified66.9%
Taylor expanded in y around inf 69.2%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 y 1)) (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-sqrt78.2%
+-commutative78.2%
add-sqr-sqrt97.4%
associate--l+97.4%
Applied egg-rr97.4%
Final simplification85.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 (+ x 1.0)) (sqrt x)))
(t_2 (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))))
(if (<= t_1 1e-7)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ (* 0.5 (sqrt (/ 1.0 y))) t_2))
(+ t_1 (+ t_2 (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = 1.0 / (sqrt((z + 1.0)) + sqrt(z));
double tmp;
if (t_1 <= 1e-7) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_2);
} else {
tmp = t_1 + (t_2 + (1.0 / (sqrt((y + 1.0)) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = 1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))
if (t_1 <= 1d-7) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + t_2)
else
tmp = t_1 + (t_2 + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = 1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z));
double tmp;
if (t_1 <= 1e-7) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + t_2);
} else {
tmp = t_1 + (t_2 + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = 1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)) tmp = 0 if t_1 <= 1e-7: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + t_2) else: tmp = t_1 + (t_2 + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) tmp = 0.0 if (t_1 <= 1e-7) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_2)); else tmp = Float64(t_1 + Float64(t_2 + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
t_2 = 1.0 / (sqrt((z + 1.0)) + sqrt(z));
tmp = 0.0;
if (t_1 <= 1e-7)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_2);
else
tmp = t_1 + (t_2 + (1.0 / (sqrt((y + 1.0)) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-7], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \frac{1}{\sqrt{z + 1} + \sqrt{z}}\\
\mathbf{if}\;t\_1 \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 89.8%
associate-+l+89.8%
associate-+l+89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l-63.8%
+-commutative63.8%
+-commutative63.8%
Simplified63.8%
associate--r-89.8%
flip--89.8%
flip--89.8%
frac-add89.8%
Applied egg-rr93.5%
Taylor expanded in t around inf 49.6%
Taylor expanded in y around inf 5.1%
Taylor expanded in x around inf 25.4%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
associate--r-96.4%
flip--96.8%
flip--97.1%
frac-add97.0%
Applied egg-rr99.1%
Taylor expanded in t around inf 60.9%
flip--60.9%
div-inv60.9%
add-sqr-sqrt47.2%
add-sqr-sqrt61.0%
associate--l+61.0%
Applied egg-rr61.0%
+-inverses61.0%
metadata-eval61.0%
*-lft-identity61.0%
+-commutative61.0%
Simplified61.0%
Final simplification43.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_2 (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))))
(if (<= t_1 1e-7)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ (* 0.5 (sqrt (/ 1.0 y))) t_2))
(+ t_1 (+ (- (sqrt (+ y 1.0)) (sqrt y)) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double t_2 = 1.0 / (sqrt((z + 1.0)) + sqrt(z));
double tmp;
if (t_1 <= 1e-7) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_2);
} else {
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
t_2 = 1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))
if (t_1 <= 1d-7) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + t_2)
else
tmp = t_1 + ((sqrt((y + 1.0d0)) - sqrt(y)) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_2 = 1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z));
double tmp;
if (t_1 <= 1e-7) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + t_2);
} else {
tmp = t_1 + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) t_2 = 1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)) tmp = 0 if t_1 <= 1e-7: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + t_2) else: tmp = t_1 + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_2 = Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) tmp = 0.0 if (t_1 <= 1e-7) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_2)); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
t_2 = 1.0 / (sqrt((z + 1.0)) + sqrt(z));
tmp = 0.0;
if (t_1 <= 1e-7)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_2);
else
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-7], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
t_2 := \frac{1}{\sqrt{z + 1} + \sqrt{z}}\\
\mathbf{if}\;t\_1 \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + t\_2\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 89.8%
associate-+l+89.8%
associate-+l+89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l-63.8%
+-commutative63.8%
+-commutative63.8%
Simplified63.8%
associate--r-89.8%
flip--89.8%
flip--89.8%
frac-add89.8%
Applied egg-rr93.5%
Taylor expanded in t around inf 49.6%
Taylor expanded in y around inf 5.1%
Taylor expanded in x around inf 25.4%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
associate--r-96.4%
flip--96.8%
flip--97.1%
frac-add97.0%
Applied egg-rr99.1%
Taylor expanded in t around inf 60.9%
Final simplification43.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)) (sqrt y))) (t_2 (sqrt (+ x 1.0))))
(if (<= (- t_2 (sqrt x)) 0.95)
(+ (/ 1.0 (+ t_2 (sqrt x))) (+ t_1 (* 0.5 (sqrt (/ 1.0 t)))))
(+ (+ t_1 (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- 1.0 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((x + 1.0));
double tmp;
if ((t_2 - sqrt(x)) <= 0.95) {
tmp = (1.0 / (t_2 + sqrt(x))) + (t_1 + (0.5 * sqrt((1.0 / t))));
} else {
tmp = (t_1 + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (1.0 - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((x + 1.0d0))
if ((t_2 - sqrt(x)) <= 0.95d0) then
tmp = (1.0d0 / (t_2 + sqrt(x))) + (t_1 + (0.5d0 * sqrt((1.0d0 / t))))
else
tmp = (t_1 + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (1.0d0 - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if ((t_2 - Math.sqrt(x)) <= 0.95) {
tmp = (1.0 / (t_2 + Math.sqrt(x))) + (t_1 + (0.5 * Math.sqrt((1.0 / t))));
} else {
tmp = (t_1 + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (1.0 - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((x + 1.0)) tmp = 0 if (t_2 - math.sqrt(x)) <= 0.95: tmp = (1.0 / (t_2 + math.sqrt(x))) + (t_1 + (0.5 * math.sqrt((1.0 / t)))) else: tmp = (t_1 + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (1.0 - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_2 - sqrt(x)) <= 0.95) tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / t))))); else tmp = Float64(Float64(t_1 + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(1.0 - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0)) - sqrt(y);
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_2 - sqrt(x)) <= 0.95)
tmp = (1.0 / (t_2 + sqrt(x))) + (t_1 + (0.5 * sqrt((1.0 / t))));
else
tmp = (t_1 + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (1.0 - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.95], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;t\_2 - \sqrt{x} \leq 0.95:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}} + \left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(1 - \sqrt{x}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.94999999999999996Initial program 89.6%
associate-+l+89.6%
associate-+l+89.6%
+-commutative89.6%
+-commutative89.6%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in z around inf 40.3%
Taylor expanded in t around inf 18.9%
flip--63.3%
div-inv63.3%
add-sqr-sqrt34.9%
+-commutative34.9%
add-sqr-sqrt63.3%
associate--l+65.8%
+-commutative65.8%
Applied egg-rr20.5%
+-inverses65.8%
metadata-eval65.8%
*-lft-identity65.8%
+-commutative65.8%
Simplified20.5%
if 0.94999999999999996 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.2%
associate-+l+97.2%
associate-+l+97.2%
+-commutative97.2%
+-commutative97.2%
associate-+l-75.2%
+-commutative75.2%
+-commutative75.2%
Simplified75.2%
associate--r-97.2%
flip--97.6%
flip--97.8%
frac-add97.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 61.4%
Taylor expanded in x around 0 61.2%
Final simplification39.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 (+ y 1.0)))
(t_2 (- t_1 (sqrt y)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (- t_3 (sqrt x))))
(if (<= z 9e-23)
(+ (+ t_4 t_2) (+ (/ 1.0 (+ (sqrt (+ t 1.0)) (sqrt t))) (- 1.0 (sqrt z))))
(if (<= z 4.5e+154)
(+
t_4
(+ (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))) (/ 1.0 (+ t_1 (sqrt y)))))
(+ (/ 1.0 (+ t_3 (sqrt x))) (+ t_2 (* 0.5 (sqrt (/ 1.0 t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = t_1 - sqrt(y);
double t_3 = sqrt((x + 1.0));
double t_4 = t_3 - sqrt(x);
double tmp;
if (z <= 9e-23) {
tmp = (t_4 + t_2) + ((1.0 / (sqrt((t + 1.0)) + sqrt(t))) + (1.0 - sqrt(z)));
} else if (z <= 4.5e+154) {
tmp = t_4 + ((1.0 / (sqrt((z + 1.0)) + sqrt(z))) + (1.0 / (t_1 + sqrt(y))));
} else {
tmp = (1.0 / (t_3 + sqrt(x))) + (t_2 + (0.5 * sqrt((1.0 / t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = t_1 - sqrt(y)
t_3 = sqrt((x + 1.0d0))
t_4 = t_3 - sqrt(x)
if (z <= 9d-23) then
tmp = (t_4 + t_2) + ((1.0d0 / (sqrt((t + 1.0d0)) + sqrt(t))) + (1.0d0 - sqrt(z)))
else if (z <= 4.5d+154) then
tmp = t_4 + ((1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))) + (1.0d0 / (t_1 + sqrt(y))))
else
tmp = (1.0d0 / (t_3 + sqrt(x))) + (t_2 + (0.5d0 * sqrt((1.0d0 / t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((y + 1.0));
double t_2 = t_1 - Math.sqrt(y);
double t_3 = Math.sqrt((x + 1.0));
double t_4 = t_3 - Math.sqrt(x);
double tmp;
if (z <= 9e-23) {
tmp = (t_4 + t_2) + ((1.0 / (Math.sqrt((t + 1.0)) + Math.sqrt(t))) + (1.0 - Math.sqrt(z)));
} else if (z <= 4.5e+154) {
tmp = t_4 + ((1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))) + (1.0 / (t_1 + Math.sqrt(y))));
} else {
tmp = (1.0 / (t_3 + Math.sqrt(x))) + (t_2 + (0.5 * Math.sqrt((1.0 / t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = t_1 - math.sqrt(y) t_3 = math.sqrt((x + 1.0)) t_4 = t_3 - math.sqrt(x) tmp = 0 if z <= 9e-23: tmp = (t_4 + t_2) + ((1.0 / (math.sqrt((t + 1.0)) + math.sqrt(t))) + (1.0 - math.sqrt(z))) elif z <= 4.5e+154: tmp = t_4 + ((1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z))) + (1.0 / (t_1 + math.sqrt(y)))) else: tmp = (1.0 / (t_3 + math.sqrt(x))) + (t_2 + (0.5 * math.sqrt((1.0 / t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = Float64(t_1 - sqrt(y)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(t_3 - sqrt(x)) tmp = 0.0 if (z <= 9e-23) tmp = Float64(Float64(t_4 + t_2) + Float64(Float64(1.0 / Float64(sqrt(Float64(t + 1.0)) + sqrt(t))) + Float64(1.0 - sqrt(z)))); elseif (z <= 4.5e+154) tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) + Float64(1.0 / Float64(t_1 + sqrt(y))))); else tmp = Float64(Float64(1.0 / Float64(t_3 + sqrt(x))) + Float64(t_2 + Float64(0.5 * sqrt(Float64(1.0 / t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = t_1 - sqrt(y);
t_3 = sqrt((x + 1.0));
t_4 = t_3 - sqrt(x);
tmp = 0.0;
if (z <= 9e-23)
tmp = (t_4 + t_2) + ((1.0 / (sqrt((t + 1.0)) + sqrt(t))) + (1.0 - sqrt(z)));
elseif (z <= 4.5e+154)
tmp = t_4 + ((1.0 / (sqrt((z + 1.0)) + sqrt(z))) + (1.0 / (t_1 + sqrt(y))));
else
tmp = (1.0 / (t_3 + sqrt(x))) + (t_2 + (0.5 * sqrt((1.0 / t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9e-23], N[(N[(t$95$4 + t$95$2), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+154], N[(t$95$4 + N[(N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := t\_1 - \sqrt{y}\\
t_3 := \sqrt{x + 1}\\
t_4 := t\_3 - \sqrt{x}\\
\mathbf{if}\;z \leq 9 \cdot 10^{-23}:\\
\;\;\;\;\left(t\_4 + t\_2\right) + \left(\frac{1}{\sqrt{t + 1} + \sqrt{t}} + \left(1 - \sqrt{z}\right)\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+154}:\\
\;\;\;\;t\_4 + \left(\frac{1}{\sqrt{z + 1} + \sqrt{z}} + \frac{1}{t\_1 + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_3 + \sqrt{x}} + \left(t\_2 + 0.5 \cdot \sqrt{\frac{1}{t}}\right)\\
\end{array}
\end{array}
if z < 8.9999999999999995e-23Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
sub-neg97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
flip--97.9%
div-inv97.9%
add-sqr-sqrt71.4%
add-sqr-sqrt98.4%
associate--l+98.5%
Applied egg-rr98.5%
+-inverses98.5%
metadata-eval98.5%
*-lft-identity98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in z around 0 98.5%
if 8.9999999999999995e-23 < z < 4.50000000000000009e154Initial program 90.6%
associate-+l+90.6%
associate-+l+90.6%
+-commutative90.6%
+-commutative90.6%
associate-+l-85.2%
+-commutative85.2%
+-commutative85.2%
Simplified85.2%
associate--r-90.6%
flip--90.8%
flip--91.3%
frac-add91.3%
Applied egg-rr95.2%
Taylor expanded in t around inf 47.5%
flip--47.5%
div-inv47.5%
add-sqr-sqrt40.3%
add-sqr-sqrt48.7%
associate--l+48.7%
Applied egg-rr48.7%
+-inverses48.7%
metadata-eval48.7%
*-lft-identity48.7%
+-commutative48.7%
Simplified48.7%
if 4.50000000000000009e154 < z Initial program 85.2%
associate-+l+85.2%
associate-+l+85.2%
+-commutative85.2%
+-commutative85.2%
associate-+l-85.2%
+-commutative85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in z around inf 85.2%
Taylor expanded in t around inf 46.9%
flip--85.3%
div-inv85.3%
add-sqr-sqrt76.1%
+-commutative76.1%
add-sqr-sqrt85.3%
associate--l+90.1%
+-commutative90.1%
Applied egg-rr50.2%
+-inverses90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
Simplified50.2%
Final simplification75.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 (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))))
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ (* 0.5 (sqrt (/ 1.0 y))) t_1))
(+ (+ (- (sqrt (+ y 1.0)) (sqrt y)) t_1) (- 1.0 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((z + 1.0)) + sqrt(z));
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_1);
} else {
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + t_1) + (1.0 - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + t_1)
else
tmp = ((sqrt((y + 1.0d0)) - sqrt(y)) + t_1) + (1.0d0 - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z));
double tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + t_1);
} else {
tmp = ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + t_1) + (1.0 - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)) tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + t_1) else: tmp = ((math.sqrt((y + 1.0)) - math.sqrt(y)) + t_1) + (1.0 - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + t_1)); else tmp = Float64(Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + t_1) + Float64(1.0 - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 / (sqrt((z + 1.0)) + sqrt(z));
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + t_1);
else
tmp = ((sqrt((y + 1.0)) - sqrt(y)) + t_1) + (1.0 - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{z + 1} + \sqrt{z}}\\
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{y + 1} - \sqrt{y}\right) + t\_1\right) + \left(1 - \sqrt{x}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 89.8%
associate-+l+89.8%
associate-+l+89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l-63.8%
+-commutative63.8%
+-commutative63.8%
Simplified63.8%
associate--r-89.8%
flip--89.8%
flip--89.8%
frac-add89.8%
Applied egg-rr93.5%
Taylor expanded in t around inf 49.6%
Taylor expanded in y around inf 5.1%
Taylor expanded in x around inf 25.4%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
associate--r-96.4%
flip--96.8%
flip--97.1%
frac-add97.0%
Applied egg-rr99.1%
Taylor expanded in t around inf 60.9%
Taylor expanded in x around 0 58.0%
Final simplification41.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 (+ z 1.0)))
(t_2 (- t_1 (sqrt z)))
(t_3 (sqrt (+ y 1.0)))
(t_4 (sqrt (+ x 1.0)))
(t_5 (- t_4 (sqrt x))))
(if (<= y 4.8e-125)
(+ (+ t_5 (- 1.0 (sqrt y))) (+ t_2 (- (sqrt (+ t 1.0)) (sqrt t))))
(if (<= y 2.1e+29)
(+ t_5 (+ (/ 1.0 (+ t_1 (sqrt z))) (/ 1.0 (+ t_3 (sqrt y)))))
(+ (/ 1.0 (+ t_4 (sqrt x))) (+ t_2 (- t_3 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = t_1 - sqrt(z);
double t_3 = sqrt((y + 1.0));
double t_4 = sqrt((x + 1.0));
double t_5 = t_4 - sqrt(x);
double tmp;
if (y <= 4.8e-125) {
tmp = (t_5 + (1.0 - sqrt(y))) + (t_2 + (sqrt((t + 1.0)) - sqrt(t)));
} else if (y <= 2.1e+29) {
tmp = t_5 + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (t_3 + sqrt(y))));
} else {
tmp = (1.0 / (t_4 + sqrt(x))) + (t_2 + (t_3 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((y + 1.0d0))
t_4 = sqrt((x + 1.0d0))
t_5 = t_4 - sqrt(x)
if (y <= 4.8d-125) then
tmp = (t_5 + (1.0d0 - sqrt(y))) + (t_2 + (sqrt((t + 1.0d0)) - sqrt(t)))
else if (y <= 2.1d+29) then
tmp = t_5 + ((1.0d0 / (t_1 + sqrt(z))) + (1.0d0 / (t_3 + sqrt(y))))
else
tmp = (1.0d0 / (t_4 + sqrt(x))) + (t_2 + (t_3 - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double t_2 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((y + 1.0));
double t_4 = Math.sqrt((x + 1.0));
double t_5 = t_4 - Math.sqrt(x);
double tmp;
if (y <= 4.8e-125) {
tmp = (t_5 + (1.0 - Math.sqrt(y))) + (t_2 + (Math.sqrt((t + 1.0)) - Math.sqrt(t)));
} else if (y <= 2.1e+29) {
tmp = t_5 + ((1.0 / (t_1 + Math.sqrt(z))) + (1.0 / (t_3 + Math.sqrt(y))));
} else {
tmp = (1.0 / (t_4 + Math.sqrt(x))) + (t_2 + (t_3 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = t_1 - math.sqrt(z) t_3 = math.sqrt((y + 1.0)) t_4 = math.sqrt((x + 1.0)) t_5 = t_4 - math.sqrt(x) tmp = 0 if y <= 4.8e-125: tmp = (t_5 + (1.0 - math.sqrt(y))) + (t_2 + (math.sqrt((t + 1.0)) - math.sqrt(t))) elif y <= 2.1e+29: tmp = t_5 + ((1.0 / (t_1 + math.sqrt(z))) + (1.0 / (t_3 + math.sqrt(y)))) else: tmp = (1.0 / (t_4 + math.sqrt(x))) + (t_2 + (t_3 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = Float64(t_1 - sqrt(z)) t_3 = sqrt(Float64(y + 1.0)) t_4 = sqrt(Float64(x + 1.0)) t_5 = Float64(t_4 - sqrt(x)) tmp = 0.0 if (y <= 4.8e-125) tmp = Float64(Float64(t_5 + Float64(1.0 - sqrt(y))) + Float64(t_2 + Float64(sqrt(Float64(t + 1.0)) - sqrt(t)))); elseif (y <= 2.1e+29) tmp = Float64(t_5 + Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(1.0 / Float64(t_3 + sqrt(y))))); else tmp = Float64(Float64(1.0 / Float64(t_4 + sqrt(x))) + Float64(t_2 + Float64(t_3 - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
t_2 = t_1 - sqrt(z);
t_3 = sqrt((y + 1.0));
t_4 = sqrt((x + 1.0));
t_5 = t_4 - sqrt(x);
tmp = 0.0;
if (y <= 4.8e-125)
tmp = (t_5 + (1.0 - sqrt(y))) + (t_2 + (sqrt((t + 1.0)) - sqrt(t)));
elseif (y <= 2.1e+29)
tmp = t_5 + ((1.0 / (t_1 + sqrt(z))) + (1.0 / (t_3 + sqrt(y))));
else
tmp = (1.0 / (t_4 + sqrt(x))) + (t_2 + (t_3 - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4.8e-125], N[(N[(t$95$5 + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+29], N[(t$95$5 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$4 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
t_2 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{y + 1}\\
t_4 := \sqrt{x + 1}\\
t_5 := t\_4 - \sqrt{x}\\
\mathbf{if}\;y \leq 4.8 \cdot 10^{-125}:\\
\;\;\;\;\left(t\_5 + \left(1 - \sqrt{y}\right)\right) + \left(t\_2 + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+29}:\\
\;\;\;\;t\_5 + \left(\frac{1}{t\_1 + \sqrt{z}} + \frac{1}{t\_3 + \sqrt{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_4 + \sqrt{x}} + \left(t\_2 + \left(t\_3 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if y < 4.8000000000000003e-125Initial program 97.2%
associate-+l+97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in y around 0 97.2%
if 4.8000000000000003e-125 < y < 2.1000000000000002e29Initial program 92.1%
associate-+l+92.1%
associate-+l+92.1%
+-commutative92.1%
+-commutative92.1%
associate-+l-67.4%
+-commutative67.4%
+-commutative67.4%
Simplified67.4%
associate--r-92.1%
flip--92.4%
flip--92.4%
frac-add92.4%
Applied egg-rr94.3%
Taylor expanded in t around inf 54.6%
flip--54.6%
div-inv54.6%
add-sqr-sqrt55.3%
add-sqr-sqrt56.3%
associate--l+58.3%
Applied egg-rr58.3%
+-inverses58.3%
metadata-eval58.3%
*-lft-identity58.3%
+-commutative58.3%
Simplified58.3%
if 2.1000000000000002e29 < y Initial program 90.0%
associate-+l+90.0%
associate-+l+90.0%
+-commutative90.0%
+-commutative90.0%
associate-+l-66.2%
+-commutative66.2%
+-commutative66.2%
Simplified66.2%
flip--66.2%
div-inv66.2%
add-sqr-sqrt52.4%
+-commutative52.4%
add-sqr-sqrt66.2%
associate--l+68.9%
+-commutative68.9%
Applied egg-rr68.9%
+-inverses68.9%
metadata-eval68.9%
*-lft-identity68.9%
+-commutative68.9%
Simplified68.9%
Taylor expanded in t around inf 54.6%
Final simplification70.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 1e-7)
(+
(* 0.5 (sqrt (/ 1.0 x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))))
(+
(- 1.0 (sqrt x))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (- (sqrt (+ t 1.0)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z))));
} else {
tmp = (1.0 - sqrt(x)) + ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((t + 1.0)) - 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) :: tmp
if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 1d-7) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))))
else
tmp = (1.0d0 - sqrt(x)) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (sqrt((t + 1.0d0)) - 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 tmp;
if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 1e-7) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))));
} else {
tmp = (1.0 - Math.sqrt(x)) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (Math.sqrt((t + 1.0)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 1e-7: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) else: tmp = (1.0 - math.sqrt(x)) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (math.sqrt((t + 1.0)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 1e-7) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))))); else tmp = Float64(Float64(1.0 - sqrt(x)) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((sqrt((x + 1.0)) - sqrt(x)) <= 1e-7)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z))));
else
tmp = (1.0 - sqrt(x)) + ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((t + 1.0)) - 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_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $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}
\mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 89.8%
associate-+l+89.8%
associate-+l+89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l-63.8%
+-commutative63.8%
+-commutative63.8%
Simplified63.8%
associate--r-89.8%
flip--89.8%
flip--89.8%
frac-add89.8%
Applied egg-rr93.5%
Taylor expanded in t around inf 49.6%
Taylor expanded in y around inf 5.1%
Taylor expanded in x around inf 25.4%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in z around inf 54.7%
Taylor expanded in x around 0 52.0%
Final simplification38.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 (+ x 1.0))))
(if (<= (- t_1 (sqrt x)) 1e-7)
(+
(* 0.5 (sqrt (/ 1.0 x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))))
(+ t_1 (- (sqrt (+ y 1.0)) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if ((t_1 - sqrt(x)) <= 1e-7) {
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z))));
} else {
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if ((t_1 - sqrt(x)) <= 1d-7) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))))
else
tmp = t_1 + (sqrt((y + 1.0d0)) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 1e-7) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + ((0.5 * Math.sqrt((1.0 / y))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))));
} else {
tmp = t_1 + (Math.sqrt((y + 1.0)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if (t_1 - math.sqrt(x)) <= 1e-7: tmp = (0.5 * math.sqrt((1.0 / x))) + ((0.5 * math.sqrt((1.0 / y))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) else: tmp = t_1 + (math.sqrt((y + 1.0)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 1e-7) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))))); else tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 1e-7)
tmp = (0.5 * sqrt((1.0 / x))) + ((0.5 * sqrt((1.0 / y))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z))));
else
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 1e-7], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;t\_1 - \sqrt{x} \leq 10^{-7}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 9.9999999999999995e-8Initial program 89.8%
associate-+l+89.8%
associate-+l+89.8%
+-commutative89.8%
+-commutative89.8%
associate-+l-63.8%
+-commutative63.8%
+-commutative63.8%
Simplified63.8%
associate--r-89.8%
flip--89.8%
flip--89.8%
frac-add89.8%
Applied egg-rr93.5%
Taylor expanded in t around inf 49.6%
Taylor expanded in y around inf 5.1%
Taylor expanded in x around inf 25.4%
if 9.9999999999999995e-8 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 96.4%
associate-+l+96.4%
associate-+l+96.4%
+-commutative96.4%
+-commutative96.4%
associate-+l-73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in z around inf 54.7%
Taylor expanded in t around inf 20.6%
associate--l+36.8%
Simplified36.8%
Final simplification31.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 (+ z 1.0))))
(if (<= t 2.7e+15)
(-
(+ (+ (sqrt (+ t 1.0)) 2.0) (+ t_1 (* y 0.5)))
(+ (+ (sqrt t) (sqrt x)) (+ (sqrt z) (sqrt y))))
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(+ (- t_1 (sqrt z)) (- (sqrt (+ y 1.0)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double tmp;
if (t <= 2.7e+15) {
tmp = ((sqrt((t + 1.0)) + 2.0) + (t_1 + (y * 0.5))) - ((sqrt(t) + sqrt(x)) + (sqrt(z) + sqrt(y)));
} else {
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((t_1 - sqrt(z)) + (sqrt((y + 1.0)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
if (t <= 2.7d+15) then
tmp = ((sqrt((t + 1.0d0)) + 2.0d0) + (t_1 + (y * 0.5d0))) - ((sqrt(t) + sqrt(x)) + (sqrt(z) + sqrt(y)))
else
tmp = (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + ((t_1 - sqrt(z)) + (sqrt((y + 1.0d0)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double tmp;
if (t <= 2.7e+15) {
tmp = ((Math.sqrt((t + 1.0)) + 2.0) + (t_1 + (y * 0.5))) - ((Math.sqrt(t) + Math.sqrt(x)) + (Math.sqrt(z) + Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + ((t_1 - Math.sqrt(z)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) tmp = 0 if t <= 2.7e+15: tmp = ((math.sqrt((t + 1.0)) + 2.0) + (t_1 + (y * 0.5))) - ((math.sqrt(t) + math.sqrt(x)) + (math.sqrt(z) + math.sqrt(y))) else: tmp = (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + ((t_1 - math.sqrt(z)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t <= 2.7e+15) tmp = Float64(Float64(Float64(sqrt(Float64(t + 1.0)) + 2.0) + Float64(t_1 + Float64(y * 0.5))) - Float64(Float64(sqrt(t) + sqrt(x)) + Float64(sqrt(z) + sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(Float64(t_1 - sqrt(z)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
tmp = 0.0;
if (t <= 2.7e+15)
tmp = ((sqrt((t + 1.0)) + 2.0) + (t_1 + (y * 0.5))) - ((sqrt(t) + sqrt(x)) + (sqrt(z) + sqrt(y)));
else
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((t_1 - sqrt(z)) + (sqrt((y + 1.0)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 2.7e+15], N[(N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] + N[(t$95$1 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
\mathbf{if}\;t \leq 2.7 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(\sqrt{t + 1} + 2\right) + \left(t\_1 + y \cdot 0.5\right)\right) - \left(\left(\sqrt{t} + \sqrt{x}\right) + \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \left(\left(t\_1 - \sqrt{z}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 2.7e15Initial program 95.9%
associate-+l+95.9%
associate-+l+95.9%
+-commutative95.9%
+-commutative95.9%
associate-+l-95.9%
+-commutative95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in y around 0 59.8%
Taylor expanded in x around 0 15.9%
associate-+r+16.0%
associate-+r+16.0%
+-commutative16.0%
Simplified16.0%
if 2.7e15 < t Initial program 90.3%
associate-+l+90.3%
associate-+l+90.3%
+-commutative90.3%
+-commutative90.3%
associate-+l-40.4%
+-commutative40.4%
+-commutative40.4%
Simplified40.4%
flip--40.4%
div-inv40.4%
add-sqr-sqrt34.8%
+-commutative34.8%
add-sqr-sqrt40.4%
associate--l+42.7%
+-commutative42.7%
Applied egg-rr42.7%
+-inverses42.7%
metadata-eval42.7%
*-lft-identity42.7%
+-commutative42.7%
Simplified42.7%
Taylor expanded in t around inf 92.7%
Final simplification53.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 (+ y 1.0))))
(if (<= x 7000.0)
(+ (sqrt (+ x 1.0)) (- t_1 (+ (sqrt x) (sqrt y))))
(+
(+ (- t_1 (sqrt y)) (* 0.5 (sqrt (/ 1.0 t))))
(* 0.5 (sqrt (/ 1.0 x)))))))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 (x <= 7000.0) {
tmp = sqrt((x + 1.0)) + (t_1 - (sqrt(x) + sqrt(y)));
} else {
tmp = ((t_1 - sqrt(y)) + (0.5 * sqrt((1.0 / t)))) + (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) :: t_1
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
if (x <= 7000.0d0) then
tmp = sqrt((x + 1.0d0)) + (t_1 - (sqrt(x) + sqrt(y)))
else
tmp = ((t_1 - sqrt(y)) + (0.5d0 * sqrt((1.0d0 / t)))) + (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 t_1 = Math.sqrt((y + 1.0));
double tmp;
if (x <= 7000.0) {
tmp = Math.sqrt((x + 1.0)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((t_1 - Math.sqrt(y)) + (0.5 * Math.sqrt((1.0 / t)))) + (0.5 * Math.sqrt((1.0 / x)));
}
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 x <= 7000.0: tmp = math.sqrt((x + 1.0)) + (t_1 - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((t_1 - math.sqrt(y)) + (0.5 * math.sqrt((1.0 / t)))) + (0.5 * math.sqrt((1.0 / x))) 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 (x <= 7000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(t_1 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(t_1 - sqrt(y)) + Float64(0.5 * sqrt(Float64(1.0 / t)))) + 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)
t_1 = sqrt((y + 1.0));
tmp = 0.0;
if (x <= 7000.0)
tmp = sqrt((x + 1.0)) + (t_1 - (sqrt(x) + sqrt(y)));
else
tmp = ((t_1 - sqrt(y)) + (0.5 * sqrt((1.0 / t)))) + (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_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 7000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $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}
t_1 := \sqrt{y + 1}\\
\mathbf{if}\;x \leq 7000:\\
\;\;\;\;\sqrt{x + 1} + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{y}\right) + 0.5 \cdot \sqrt{\frac{1}{t}}\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 7e3Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
associate-+l-75.3%
+-commutative75.3%
+-commutative75.3%
Simplified75.3%
Taylor expanded in z around inf 55.6%
Taylor expanded in t around inf 20.8%
associate--l+37.3%
Simplified37.3%
if 7e3 < x Initial program 89.5%
associate-+l+89.5%
associate-+l+89.5%
+-commutative89.5%
+-commutative89.5%
associate-+l-62.7%
+-commutative62.7%
+-commutative62.7%
Simplified62.7%
Taylor expanded in z around inf 39.9%
Taylor expanded in t around inf 19.2%
Taylor expanded in x around inf 20.8%
Final simplification28.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (sqrt (+ x 1.0)) (- (sqrt (+ y 1.0)) (+ (sqrt x) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) + (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y)));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) + (sqrt((y + 1.0d0)) - (sqrt(x) + sqrt(y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) + (Math.sqrt((y + 1.0)) - (Math.sqrt(x) + Math.sqrt(y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) + (math.sqrt((y + 1.0)) - (math.sqrt(x) + math.sqrt(y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(x) + sqrt(y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) + (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} + \left(\sqrt{y + 1} - \left(\sqrt{x} + \sqrt{y}\right)\right)
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l+93.1%
+-commutative93.1%
+-commutative93.1%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in z around inf 47.6%
Taylor expanded in t around inf 12.3%
associate--l+20.8%
Simplified20.8%
Final simplification20.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 0.45)
(-
(+ (+ (+ (* 0.5 (sqrt (/ 1.0 t))) (* y 0.5)) 1.0) 1.0)
(+ (sqrt x) (sqrt y)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ x 1.0)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.45) {
tmp = ((((0.5 * sqrt((1.0 / t))) + (y * 0.5)) + 1.0) + 1.0) - (sqrt(x) + sqrt(y));
} else {
tmp = (0.5 * sqrt((1.0 / y))) + (sqrt((x + 1.0)) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 0.45d0) then
tmp = ((((0.5d0 * sqrt((1.0d0 / t))) + (y * 0.5d0)) + 1.0d0) + 1.0d0) - (sqrt(x) + sqrt(y))
else
tmp = (0.5d0 * sqrt((1.0d0 / y))) + (sqrt((x + 1.0d0)) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.45) {
tmp = ((((0.5 * Math.sqrt((1.0 / t))) + (y * 0.5)) + 1.0) + 1.0) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((x + 1.0)) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.45: tmp = ((((0.5 * math.sqrt((1.0 / t))) + (y * 0.5)) + 1.0) + 1.0) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (0.5 * math.sqrt((1.0 / y))) + (math.sqrt((x + 1.0)) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.45) tmp = Float64(Float64(Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(y * 0.5)) + 1.0) + 1.0) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(x + 1.0)) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 0.45)
tmp = ((((0.5 * sqrt((1.0 / t))) + (y * 0.5)) + 1.0) + 1.0) - (sqrt(x) + sqrt(y));
else
tmp = (0.5 * sqrt((1.0 / y))) + (sqrt((x + 1.0)) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 0.45], N[(N[(N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.45:\\
\;\;\;\;\left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + y \cdot 0.5\right) + 1\right) + 1\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{x + 1} - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 0.450000000000000011Initial program 97.0%
associate-+l+97.0%
associate-+l+97.0%
+-commutative97.0%
+-commutative97.0%
associate-+l-72.7%
+-commutative72.7%
+-commutative72.7%
Simplified72.7%
Taylor expanded in z around inf 53.4%
Taylor expanded in t around inf 26.0%
Taylor expanded in y around 0 16.9%
Taylor expanded in x around 0 15.2%
if 0.450000000000000011 < y Initial program 87.9%
associate-+l+87.9%
associate-+l+87.9%
+-commutative87.9%
+-commutative87.9%
associate-+l-63.5%
+-commutative63.5%
+-commutative63.5%
Simplified63.5%
associate--r-87.9%
flip--88.0%
flip--88.3%
frac-add88.2%
Applied egg-rr93.1%
Taylor expanded in t around inf 53.0%
Taylor expanded in y around inf 34.6%
Taylor expanded in z around inf 22.7%
+-commutative22.7%
associate--l+26.5%
Simplified26.5%
Final simplification20.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 0.41) (- (+ (* y 0.5) 1.0) (+ (sqrt x) (+ (sqrt z) (sqrt y)))) (+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ x 1.0)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.41) {
tmp = ((y * 0.5) + 1.0) - (sqrt(x) + (sqrt(z) + sqrt(y)));
} else {
tmp = (0.5 * sqrt((1.0 / y))) + (sqrt((x + 1.0)) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.41d0) then
tmp = ((y * 0.5d0) + 1.0d0) - (sqrt(x) + (sqrt(z) + sqrt(y)))
else
tmp = (0.5d0 * sqrt((1.0d0 / y))) + (sqrt((x + 1.0d0)) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.41) {
tmp = ((y * 0.5) + 1.0) - (Math.sqrt(x) + (Math.sqrt(z) + Math.sqrt(y)));
} else {
tmp = (0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((x + 1.0)) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.41: tmp = ((y * 0.5) + 1.0) - (math.sqrt(x) + (math.sqrt(z) + math.sqrt(y))) else: tmp = (0.5 * math.sqrt((1.0 / y))) + (math.sqrt((x + 1.0)) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.41) tmp = Float64(Float64(Float64(y * 0.5) + 1.0) - Float64(sqrt(x) + Float64(sqrt(z) + sqrt(y)))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(x + 1.0)) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.41)
tmp = ((y * 0.5) + 1.0) - (sqrt(x) + (sqrt(z) + sqrt(y)));
else
tmp = (0.5 * sqrt((1.0 / y))) + (sqrt((x + 1.0)) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.41], N[(N[(N[(y * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.41:\\
\;\;\;\;\left(y \cdot 0.5 + 1\right) - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{x + 1} - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 0.409999999999999976Initial program 97.7%
associate-+l+97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
associate-+l-54.9%
+-commutative54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in y around 0 33.1%
Taylor expanded in t around inf 22.5%
Taylor expanded in y around inf 6.9%
*-commutative6.9%
Simplified6.9%
if 0.409999999999999976 < z Initial program 87.5%
associate-+l+87.5%
associate-+l+87.5%
+-commutative87.5%
+-commutative87.5%
associate-+l-86.1%
+-commutative86.1%
+-commutative86.1%
Simplified86.1%
associate--r-87.5%
flip--87.6%
flip--87.8%
frac-add87.8%
Applied egg-rr93.6%
Taylor expanded in t around inf 46.2%
Taylor expanded in y around inf 19.9%
Taylor expanded in z around inf 19.9%
+-commutative19.9%
associate--l+23.2%
Simplified23.2%
Final simplification14.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (* 0.5 (sqrt (/ 1.0 y))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (0.5 * sqrt((1.0 / y))) + (sqrt((x + 1.0)) - sqrt(x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.5d0 * sqrt((1.0d0 / y))) + (sqrt((x + 1.0d0)) - sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (0.5 * Math.sqrt((1.0 / y))) + (Math.sqrt((x + 1.0)) - Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (0.5 * math.sqrt((1.0 / y))) + (math.sqrt((x + 1.0)) - math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(sqrt(Float64(x + 1.0)) - sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (0.5 * sqrt((1.0 / y))) + (sqrt((x + 1.0)) - sqrt(x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{y}} + \left(\sqrt{x + 1} - \sqrt{x}\right)
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l+93.1%
+-commutative93.1%
+-commutative93.1%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
associate--r-93.1%
flip--93.3%
flip--93.4%
frac-add93.4%
Applied egg-rr96.3%
Taylor expanded in t around inf 55.3%
Taylor expanded in y around inf 18.2%
Taylor expanded in z around inf 13.1%
+-commutative13.1%
associate--l+15.2%
Simplified15.2%
Final simplification15.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (+ (sqrt (+ x 1.0)) (* 0.5 (sqrt (/ 1.0 t)))) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / t)))) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (sqrt((x + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / t)))) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((x + 1.0)) + (0.5 * Math.sqrt((1.0 / t)))) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (math.sqrt((x + 1.0)) + (0.5 * math.sqrt((1.0 / t)))) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / t)))) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / t)))) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{x + 1} + 0.5 \cdot \sqrt{\frac{1}{t}}\right) - \sqrt{x}
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l+93.1%
+-commutative93.1%
+-commutative93.1%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in z around inf 47.6%
Taylor expanded in t around inf 26.4%
Taylor expanded in y around inf 14.0%
+-commutative14.0%
Simplified14.0%
Final simplification14.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.5 (sqrt (/ 1.0 t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * sqrt((1.0 / t));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * sqrt((1.0d0 / t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.sqrt((1.0 / t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.sqrt((1.0 / t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * sqrt(Float64(1.0 / t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * sqrt((1.0 / t));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{t}}
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l+93.1%
+-commutative93.1%
+-commutative93.1%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in z around inf 47.6%
Taylor expanded in t around inf 26.4%
Taylor expanded in t around 0 8.5%
Final simplification8.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.5 (sqrt (/ 1.0 y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * sqrt((1.0 / y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * sqrt((1.0d0 / y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.sqrt((1.0 / y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.sqrt((1.0 / y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * sqrt(Float64(1.0 / y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * sqrt((1.0 / y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot \sqrt{\frac{1}{y}}
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l+93.1%
+-commutative93.1%
+-commutative93.1%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
associate--r-93.1%
flip--93.3%
flip--93.4%
frac-add93.4%
Applied egg-rr96.3%
Taylor expanded in t around inf 55.3%
Taylor expanded in y around inf 18.2%
Taylor expanded in y around 0 7.7%
Final simplification7.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[y], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{y}
\end{array}
Initial program 93.1%
associate-+l+93.1%
associate-+l+93.1%
+-commutative93.1%
+-commutative93.1%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in y around 0 43.6%
Taylor expanded in y around inf 3.3%
Taylor expanded in y around 0 1.6%
mul-1-neg1.6%
Simplified1.6%
Final simplification1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024055
(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))))