
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt y) (- (sqrt t) (sqrt (+ t 1.0)))))
(t_2 (sqrt (+ y 1.0)))
(t_3 (sqrt (+ z 1.0)))
(t_4 (- t_3 (sqrt z)))
(t_5 (sqrt (+ x 1.0)))
(t_6 (+ (sqrt x) t_5)))
(if (<= y 6.5e+15)
(-
t_5
(+ (sqrt x) (+ t_1 (- (/ (+ (- z z) 1.0) (- (- (sqrt z)) t_3)) t_2))))
(/
(fma
1.0
(+ t_2 (+ t_4 t_1))
(* t_6 (- (pow (+ t_2 t_4) 2.0) (pow t_1 2.0))))
(* t_6 (+ t_2 (- (+ (sqrt y) -1.0) (- (sqrt z) t_3))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(y) + (sqrt(t) - sqrt((t + 1.0)));
double t_2 = sqrt((y + 1.0));
double t_3 = sqrt((z + 1.0));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt((x + 1.0));
double t_6 = sqrt(x) + t_5;
double tmp;
if (y <= 6.5e+15) {
tmp = t_5 - (sqrt(x) + (t_1 + ((((z - z) + 1.0) / (-sqrt(z) - t_3)) - t_2)));
} else {
tmp = fma(1.0, (t_2 + (t_4 + t_1)), (t_6 * (pow((t_2 + t_4), 2.0) - pow(t_1, 2.0)))) / (t_6 * (t_2 + ((sqrt(y) + -1.0) - (sqrt(z) - t_3))));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(y) + Float64(sqrt(t) - sqrt(Float64(t + 1.0)))) t_2 = sqrt(Float64(y + 1.0)) t_3 = sqrt(Float64(z + 1.0)) t_4 = Float64(t_3 - sqrt(z)) t_5 = sqrt(Float64(x + 1.0)) t_6 = Float64(sqrt(x) + t_5) tmp = 0.0 if (y <= 6.5e+15) tmp = Float64(t_5 - Float64(sqrt(x) + Float64(t_1 + Float64(Float64(Float64(Float64(z - z) + 1.0) / Float64(Float64(-sqrt(z)) - t_3)) - t_2)))); else tmp = Float64(fma(1.0, Float64(t_2 + Float64(t_4 + t_1)), Float64(t_6 * Float64((Float64(t_2 + t_4) ^ 2.0) - (t_1 ^ 2.0)))) / Float64(t_6 * Float64(t_2 + Float64(Float64(sqrt(y) + -1.0) - Float64(sqrt(z) - t_3))))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $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[(N[Sqrt[x], $MachinePrecision] + t$95$5), $MachinePrecision]}, If[LessEqual[y, 6.5e+15], N[(t$95$5 - N[(N[Sqrt[x], $MachinePrecision] + N[(t$95$1 + N[(N[(N[(N[(z - z), $MachinePrecision] + 1.0), $MachinePrecision] / N[((-N[Sqrt[z], $MachinePrecision]) - t$95$3), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(t$95$2 + N[(t$95$4 + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(t$95$6 * N[(N[Power[N[(t$95$2 + t$95$4), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$6 * N[(t$95$2 + N[(N[(N[Sqrt[y], $MachinePrecision] + -1.0), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] - t$95$3), $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} + \left(\sqrt{t} - \sqrt{t + 1}\right)\\
t_2 := \sqrt{y + 1}\\
t_3 := \sqrt{z + 1}\\
t_4 := t_3 - \sqrt{z}\\
t_5 := \sqrt{x + 1}\\
t_6 := \sqrt{x} + t_5\\
\mathbf{if}\;y \leq 6.5 \cdot 10^{+15}:\\
\;\;\;\;t_5 - \left(\sqrt{x} + \left(t_1 + \left(\frac{\left(z - z\right) + 1}{\left(-\sqrt{z}\right) - t_3} - t_2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1, t_2 + \left(t_4 + t_1\right), t_6 \cdot \left({\left(t_2 + t_4\right)}^{2} - {t_1}^{2}\right)\right)}{t_6 \cdot \left(t_2 + \left(\left(\sqrt{y} + -1\right) - \left(\sqrt{z} - t_3\right)\right)\right)}\\
\end{array}
\end{array}
if y < 6.5e15Initial program 96.5%
associate-+l+96.5%
associate-+l+96.5%
+-commutative96.5%
associate-+l+96.5%
+-commutative96.5%
associate-+l-49.5%
Simplified49.5%
flip--49.5%
frac-2neg49.5%
add-sqr-sqrt41.7%
add-sqr-sqrt49.7%
Applied egg-rr49.7%
neg-sub049.7%
+-inverses49.7%
associate--l+49.8%
associate--r+49.8%
+-inverses49.8%
metadata-eval49.8%
+-inverses49.8%
neg-sub049.8%
+-inverses49.8%
metadata-eval49.8%
metadata-eval49.8%
neg-sub049.8%
+-inverses49.8%
+-commutative49.8%
associate--r+49.8%
+-inverses49.8%
neg-sub049.8%
Simplified49.8%
if 6.5e15 < y Initial program 85.3%
associate-+l+85.3%
associate-+l+85.3%
+-commutative85.3%
associate-+l+85.3%
+-commutative85.3%
associate-+l-52.3%
Simplified21.1%
Applied egg-rr17.7%
Simplified26.7%
Taylor expanded in t around 0 26.7%
Final simplification39.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 (+ z 1.0)))
(t_2 (sqrt (+ y 1.0)))
(t_3 (+ (sqrt x) (sqrt (+ x 1.0))))
(t_4 (+ (sqrt y) (- (sqrt t) (sqrt (+ t 1.0)))))
(t_5 (- t_1 (sqrt z))))
(/
(fma
1.0
(+ t_2 (+ (/ (- (+ z 1.0) z) (+ t_1 (sqrt z))) t_4))
(* t_3 (- (pow (+ t_2 t_5) 2.0) (pow t_4 2.0))))
(* t_3 (+ t_2 (+ t_5 t_4))))))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 = sqrt((y + 1.0));
double t_3 = sqrt(x) + sqrt((x + 1.0));
double t_4 = sqrt(y) + (sqrt(t) - sqrt((t + 1.0)));
double t_5 = t_1 - sqrt(z);
return fma(1.0, (t_2 + ((((z + 1.0) - z) / (t_1 + sqrt(z))) + t_4)), (t_3 * (pow((t_2 + t_5), 2.0) - pow(t_4, 2.0)))) / (t_3 * (t_2 + (t_5 + t_4)));
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(y + 1.0)) t_3 = Float64(sqrt(x) + sqrt(Float64(x + 1.0))) t_4 = Float64(sqrt(y) + Float64(sqrt(t) - sqrt(Float64(t + 1.0)))) t_5 = Float64(t_1 - sqrt(z)) return Float64(fma(1.0, Float64(t_2 + Float64(Float64(Float64(Float64(z + 1.0) - z) / Float64(t_1 + sqrt(z))) + t_4)), Float64(t_3 * Float64((Float64(t_2 + t_5) ^ 2.0) - (t_4 ^ 2.0)))) / Float64(t_3 * Float64(t_2 + Float64(t_5 + t_4)))) 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[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 * N[(t$95$2 + N[(N[(N[(N[(z + 1.0), $MachinePrecision] - z), $MachinePrecision] / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(N[Power[N[(t$95$2 + t$95$5), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[t$95$4, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * N[(t$95$2 + N[(t$95$5 + 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{z + 1}\\
t_2 := \sqrt{y + 1}\\
t_3 := \sqrt{x} + \sqrt{x + 1}\\
t_4 := \sqrt{y} + \left(\sqrt{t} - \sqrt{t + 1}\right)\\
t_5 := t_1 - \sqrt{z}\\
\frac{\mathsf{fma}\left(1, t_2 + \left(\frac{\left(z + 1\right) - z}{t_1 + \sqrt{z}} + t_4\right), t_3 \cdot \left({\left(t_2 + t_5\right)}^{2} - {t_4}^{2}\right)\right)}{t_3 \cdot \left(t_2 + \left(t_5 + t_4\right)\right)}
\end{array}
\end{array}
Initial program 91.4%
associate-+l+91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l-50.8%
Simplified36.7%
Applied egg-rr50.2%
Simplified56.3%
flip--36.7%
add-sqr-sqrt30.2%
add-sqr-sqrt36.8%
Applied egg-rr56.4%
Final simplification56.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 (+ y 1.0)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (+ (sqrt x) t_2))
(t_4 (+ (sqrt y) (- (sqrt t) (sqrt (+ t 1.0)))))
(t_5 (sqrt (+ z 1.0)))
(t_6 (- t_5 (sqrt z))))
(if (<= x 3.3e+15)
(-
t_2
(+ (sqrt x) (+ t_4 (- (/ (+ (- z z) 1.0) (- (- (sqrt z)) t_5)) t_1))))
(/
(fma
1.0
(+ t_1 (+ t_6 t_4))
(* t_3 (- (pow (+ t_1 t_6) 2.0) (pow t_4 2.0))))
(* t_3 (+ t_1 (- (+ t_5 (sqrt y)) (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt(x) + t_2;
double t_4 = sqrt(y) + (sqrt(t) - sqrt((t + 1.0)));
double t_5 = sqrt((z + 1.0));
double t_6 = t_5 - sqrt(z);
double tmp;
if (x <= 3.3e+15) {
tmp = t_2 - (sqrt(x) + (t_4 + ((((z - z) + 1.0) / (-sqrt(z) - t_5)) - t_1)));
} else {
tmp = fma(1.0, (t_1 + (t_6 + t_4)), (t_3 * (pow((t_1 + t_6), 2.0) - pow(t_4, 2.0)))) / (t_3 * (t_1 + ((t_5 + sqrt(y)) - sqrt(z))));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(sqrt(x) + t_2) t_4 = Float64(sqrt(y) + Float64(sqrt(t) - sqrt(Float64(t + 1.0)))) t_5 = sqrt(Float64(z + 1.0)) t_6 = Float64(t_5 - sqrt(z)) tmp = 0.0 if (x <= 3.3e+15) tmp = Float64(t_2 - Float64(sqrt(x) + Float64(t_4 + Float64(Float64(Float64(Float64(z - z) + 1.0) / Float64(Float64(-sqrt(z)) - t_5)) - t_1)))); else tmp = Float64(fma(1.0, Float64(t_1 + Float64(t_6 + t_4)), Float64(t_3 * Float64((Float64(t_1 + t_6) ^ 2.0) - (t_4 ^ 2.0)))) / Float64(t_3 * Float64(t_1 + Float64(Float64(t_5 + sqrt(y)) - sqrt(z))))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $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[x, 3.3e+15], N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[(t$95$4 + N[(N[(N[(N[(z - z), $MachinePrecision] + 1.0), $MachinePrecision] / N[((-N[Sqrt[z], $MachinePrecision]) - t$95$5), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(t$95$1 + N[(t$95$6 + t$95$4), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(N[Power[N[(t$95$1 + t$95$6), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[t$95$4, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * N[(t$95$1 + N[(N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{x} + t_2\\
t_4 := \sqrt{y} + \left(\sqrt{t} - \sqrt{t + 1}\right)\\
t_5 := \sqrt{z + 1}\\
t_6 := t_5 - \sqrt{z}\\
\mathbf{if}\;x \leq 3.3 \cdot 10^{+15}:\\
\;\;\;\;t_2 - \left(\sqrt{x} + \left(t_4 + \left(\frac{\left(z - z\right) + 1}{\left(-\sqrt{z}\right) - t_5} - t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1, t_1 + \left(t_6 + t_4\right), t_3 \cdot \left({\left(t_1 + t_6\right)}^{2} - {t_4}^{2}\right)\right)}{t_3 \cdot \left(t_1 + \left(\left(t_5 + \sqrt{y}\right) - \sqrt{z}\right)\right)}\\
\end{array}
\end{array}
if x < 3.3e15Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+l-97.3%
Simplified68.0%
flip--68.0%
frac-2neg68.0%
add-sqr-sqrt55.3%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
neg-sub068.3%
+-inverses68.3%
associate--l+68.4%
associate--r+68.4%
+-inverses68.4%
metadata-eval68.4%
+-inverses68.4%
neg-sub068.4%
+-inverses68.4%
metadata-eval68.4%
metadata-eval68.4%
neg-sub068.4%
+-inverses68.4%
+-commutative68.4%
associate--r+68.4%
+-inverses68.4%
neg-sub068.4%
Simplified68.4%
if 3.3e15 < x Initial program 86.0%
associate-+l+86.0%
associate-+l+86.0%
+-commutative86.0%
associate-+l+86.0%
+-commutative86.0%
associate-+l-7.7%
Simplified7.7%
Applied egg-rr47.3%
Simplified52.2%
Taylor expanded in t around inf 34.6%
+-commutative34.6%
Simplified34.6%
Final simplification50.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (+ (sqrt x) t_2))
(t_4 (+ (sqrt y) (- (sqrt t) (sqrt (+ t 1.0)))))
(t_5 (sqrt (+ z 1.0)))
(t_6 (- t_5 (sqrt z))))
(if (<= x 3.3e+15)
(-
t_2
(+ (sqrt x) (+ t_4 (- (/ (+ (- z z) 1.0) (- (- (sqrt z)) t_5)) t_1))))
(/
(fma
1.0
(+ t_1 (- (+ t_5 (sqrt y)) (sqrt z)))
(* t_3 (- (pow (+ t_1 t_6) 2.0) (pow t_4 2.0))))
(* t_3 (+ t_1 (+ 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((y + 1.0));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt(x) + t_2;
double t_4 = sqrt(y) + (sqrt(t) - sqrt((t + 1.0)));
double t_5 = sqrt((z + 1.0));
double t_6 = t_5 - sqrt(z);
double tmp;
if (x <= 3.3e+15) {
tmp = t_2 - (sqrt(x) + (t_4 + ((((z - z) + 1.0) / (-sqrt(z) - t_5)) - t_1)));
} else {
tmp = fma(1.0, (t_1 + ((t_5 + sqrt(y)) - sqrt(z))), (t_3 * (pow((t_1 + t_6), 2.0) - pow(t_4, 2.0)))) / (t_3 * (t_1 + (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(y + 1.0)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(sqrt(x) + t_2) t_4 = Float64(sqrt(y) + Float64(sqrt(t) - sqrt(Float64(t + 1.0)))) t_5 = sqrt(Float64(z + 1.0)) t_6 = Float64(t_5 - sqrt(z)) tmp = 0.0 if (x <= 3.3e+15) tmp = Float64(t_2 - Float64(sqrt(x) + Float64(t_4 + Float64(Float64(Float64(Float64(z - z) + 1.0) / Float64(Float64(-sqrt(z)) - t_5)) - t_1)))); else tmp = Float64(fma(1.0, Float64(t_1 + Float64(Float64(t_5 + sqrt(y)) - sqrt(z))), Float64(t_3 * Float64((Float64(t_1 + t_6) ^ 2.0) - (t_4 ^ 2.0)))) / Float64(t_3 * Float64(t_1 + Float64(t_6 + t_4)))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $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[x, 3.3e+15], N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[(t$95$4 + N[(N[(N[(N[(z - z), $MachinePrecision] + 1.0), $MachinePrecision] / N[((-N[Sqrt[z], $MachinePrecision]) - t$95$5), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(t$95$1 + N[(N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(N[Power[N[(t$95$1 + t$95$6), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[t$95$4, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * N[(t$95$1 + 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{y + 1}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{x} + t_2\\
t_4 := \sqrt{y} + \left(\sqrt{t} - \sqrt{t + 1}\right)\\
t_5 := \sqrt{z + 1}\\
t_6 := t_5 - \sqrt{z}\\
\mathbf{if}\;x \leq 3.3 \cdot 10^{+15}:\\
\;\;\;\;t_2 - \left(\sqrt{x} + \left(t_4 + \left(\frac{\left(z - z\right) + 1}{\left(-\sqrt{z}\right) - t_5} - t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1, t_1 + \left(\left(t_5 + \sqrt{y}\right) - \sqrt{z}\right), t_3 \cdot \left({\left(t_1 + t_6\right)}^{2} - {t_4}^{2}\right)\right)}{t_3 \cdot \left(t_1 + \left(t_6 + t_4\right)\right)}\\
\end{array}
\end{array}
if x < 3.3e15Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+l-97.3%
Simplified68.0%
flip--68.0%
frac-2neg68.0%
add-sqr-sqrt55.3%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
neg-sub068.3%
+-inverses68.3%
associate--l+68.4%
associate--r+68.4%
+-inverses68.4%
metadata-eval68.4%
+-inverses68.4%
neg-sub068.4%
+-inverses68.4%
metadata-eval68.4%
metadata-eval68.4%
neg-sub068.4%
+-inverses68.4%
+-commutative68.4%
associate--r+68.4%
+-inverses68.4%
neg-sub068.4%
Simplified68.4%
if 3.3e15 < x Initial program 86.0%
associate-+l+86.0%
associate-+l+86.0%
+-commutative86.0%
associate-+l+86.0%
+-commutative86.0%
associate-+l-7.7%
Simplified7.7%
Applied egg-rr47.3%
Simplified52.2%
Taylor expanded in t around inf 50.1%
+-commutative34.6%
Simplified50.1%
Final simplification58.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (+ (sqrt x) t_2))
(t_4 (+ (sqrt y) (- (sqrt t) (sqrt (+ t 1.0)))))
(t_5 (sqrt (+ z 1.0)))
(t_6 (- t_5 (sqrt z)))
(t_7 (+ t_1 (+ t_6 t_4))))
(if (<= x 3.5e-5)
(-
t_2
(+ (sqrt x) (+ t_4 (- (/ (+ (- z z) 1.0) (- (- (sqrt z)) t_5)) t_1))))
(/ (fma 1.0 t_7 (* t_3 (- (pow (+ t_1 t_6) 2.0) y))) (* t_3 t_7)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt(x) + t_2;
double t_4 = sqrt(y) + (sqrt(t) - sqrt((t + 1.0)));
double t_5 = sqrt((z + 1.0));
double t_6 = t_5 - sqrt(z);
double t_7 = t_1 + (t_6 + t_4);
double tmp;
if (x <= 3.5e-5) {
tmp = t_2 - (sqrt(x) + (t_4 + ((((z - z) + 1.0) / (-sqrt(z) - t_5)) - t_1)));
} else {
tmp = fma(1.0, t_7, (t_3 * (pow((t_1 + t_6), 2.0) - y))) / (t_3 * t_7);
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(sqrt(x) + t_2) t_4 = Float64(sqrt(y) + Float64(sqrt(t) - sqrt(Float64(t + 1.0)))) t_5 = sqrt(Float64(z + 1.0)) t_6 = Float64(t_5 - sqrt(z)) t_7 = Float64(t_1 + Float64(t_6 + t_4)) tmp = 0.0 if (x <= 3.5e-5) tmp = Float64(t_2 - Float64(sqrt(x) + Float64(t_4 + Float64(Float64(Float64(Float64(z - z) + 1.0) / Float64(Float64(-sqrt(z)) - t_5)) - t_1)))); else tmp = Float64(fma(1.0, t_7, Float64(t_3 * Float64((Float64(t_1 + t_6) ^ 2.0) - y))) / Float64(t_3 * t_7)); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $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]}, Block[{t$95$7 = N[(t$95$1 + N[(t$95$6 + t$95$4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.5e-5], N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[(t$95$4 + N[(N[(N[(N[(z - z), $MachinePrecision] + 1.0), $MachinePrecision] / N[((-N[Sqrt[z], $MachinePrecision]) - t$95$5), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * t$95$7 + N[(t$95$3 * N[(N[Power[N[(t$95$1 + t$95$6), $MachinePrecision], 2.0], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * t$95$7), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{x} + t_2\\
t_4 := \sqrt{y} + \left(\sqrt{t} - \sqrt{t + 1}\right)\\
t_5 := \sqrt{z + 1}\\
t_6 := t_5 - \sqrt{z}\\
t_7 := t_1 + \left(t_6 + t_4\right)\\
\mathbf{if}\;x \leq 3.5 \cdot 10^{-5}:\\
\;\;\;\;t_2 - \left(\sqrt{x} + \left(t_4 + \left(\frac{\left(z - z\right) + 1}{\left(-\sqrt{z}\right) - t_5} - t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1, t_7, t_3 \cdot \left({\left(t_1 + t_6\right)}^{2} - y\right)\right)}{t_3 \cdot t_7}\\
\end{array}
\end{array}
if x < 3.4999999999999997e-5Initial program 97.5%
associate-+l+97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+l-97.5%
Simplified69.9%
flip--69.9%
frac-2neg69.9%
add-sqr-sqrt56.7%
add-sqr-sqrt70.1%
Applied egg-rr70.1%
neg-sub070.1%
+-inverses70.1%
associate--l+70.2%
associate--r+70.2%
+-inverses70.2%
metadata-eval70.2%
+-inverses70.2%
neg-sub070.2%
+-inverses70.2%
metadata-eval70.2%
metadata-eval70.2%
neg-sub070.2%
+-inverses70.2%
+-commutative70.2%
associate--r+70.2%
+-inverses70.2%
neg-sub070.2%
Simplified70.2%
if 3.4999999999999997e-5 < x Initial program 86.1%
associate-+l+86.1%
associate-+l+86.1%
+-commutative86.1%
associate-+l+86.1%
+-commutative86.1%
associate-+l-10.1%
Simplified7.9%
Applied egg-rr46.2%
Simplified51.1%
Taylor expanded in t around inf 19.5%
associate-+r-34.4%
Simplified34.4%
Final simplification51.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))) (t_2 (sqrt (+ x 1.0))))
(if (<= (- t_1 (sqrt z)) 0.9999995)
(-
t_2
(+ (sqrt x) (+ (/ -1.0 (+ t_1 (sqrt z))) (- (sqrt y) (sqrt (+ y 1.0))))))
(+
(- t_2 (sqrt x))
(+
(/ 1.0 (+ (sqrt t) (sqrt (+ t 1.0))))
(- (- (+ t_1 1.0) (sqrt z)) (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 = sqrt((x + 1.0));
double tmp;
if ((t_1 - sqrt(z)) <= 0.9999995) {
tmp = t_2 - (sqrt(x) + ((-1.0 / (t_1 + sqrt(z))) + (sqrt(y) - sqrt((y + 1.0)))));
} else {
tmp = (t_2 - sqrt(x)) + ((1.0 / (sqrt(t) + sqrt((t + 1.0)))) + (((t_1 + 1.0) - sqrt(z)) - 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((z + 1.0d0))
t_2 = sqrt((x + 1.0d0))
if ((t_1 - sqrt(z)) <= 0.9999995d0) then
tmp = t_2 - (sqrt(x) + (((-1.0d0) / (t_1 + sqrt(z))) + (sqrt(y) - sqrt((y + 1.0d0)))))
else
tmp = (t_2 - sqrt(x)) + ((1.0d0 / (sqrt(t) + sqrt((t + 1.0d0)))) + (((t_1 + 1.0d0) - sqrt(z)) - 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 = Math.sqrt((x + 1.0));
double tmp;
if ((t_1 - Math.sqrt(z)) <= 0.9999995) {
tmp = t_2 - (Math.sqrt(x) + ((-1.0 / (t_1 + Math.sqrt(z))) + (Math.sqrt(y) - Math.sqrt((y + 1.0)))));
} else {
tmp = (t_2 - Math.sqrt(x)) + ((1.0 / (Math.sqrt(t) + Math.sqrt((t + 1.0)))) + (((t_1 + 1.0) - Math.sqrt(z)) - 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 = math.sqrt((x + 1.0)) tmp = 0 if (t_1 - math.sqrt(z)) <= 0.9999995: tmp = t_2 - (math.sqrt(x) + ((-1.0 / (t_1 + math.sqrt(z))) + (math.sqrt(y) - math.sqrt((y + 1.0))))) else: tmp = (t_2 - math.sqrt(x)) + ((1.0 / (math.sqrt(t) + math.sqrt((t + 1.0)))) + (((t_1 + 1.0) - math.sqrt(z)) - 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 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_1 - sqrt(z)) <= 0.9999995) tmp = Float64(t_2 - Float64(sqrt(x) + Float64(Float64(-1.0 / Float64(t_1 + sqrt(z))) + Float64(sqrt(y) - sqrt(Float64(y + 1.0)))))); else tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(t + 1.0)))) + Float64(Float64(Float64(t_1 + 1.0) - sqrt(z)) - 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 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_1 - sqrt(z)) <= 0.9999995)
tmp = t_2 - (sqrt(x) + ((-1.0 / (t_1 + sqrt(z))) + (sqrt(y) - sqrt((y + 1.0)))));
else
tmp = (t_2 - sqrt(x)) + ((1.0 / (sqrt(t) + sqrt((t + 1.0)))) + (((t_1 + 1.0) - sqrt(z)) - 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[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.9999995], N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[(N[(-1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 + 1.0), $MachinePrecision] - N[Sqrt[z], $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}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;t_1 - \sqrt{z} \leq 0.9999995:\\
\;\;\;\;t_2 - \left(\sqrt{x} + \left(\frac{-1}{t_1 + \sqrt{z}} + \left(\sqrt{y} - \sqrt{y + 1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_2 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{t} + \sqrt{t + 1}} + \left(\left(\left(t_1 + 1\right) - \sqrt{z}\right) - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.999999500000000041Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
associate-+l+86.7%
+-commutative86.7%
associate-+l-48.3%
Simplified38.4%
flip--38.4%
frac-2neg38.4%
add-sqr-sqrt26.3%
add-sqr-sqrt38.7%
Applied egg-rr38.7%
neg-sub038.7%
+-inverses38.7%
associate--l+38.7%
associate--r+38.7%
+-inverses38.7%
metadata-eval38.7%
+-inverses38.7%
neg-sub038.7%
+-inverses38.7%
metadata-eval38.7%
metadata-eval38.7%
neg-sub038.7%
+-inverses38.7%
+-commutative38.7%
associate--r+38.7%
+-inverses38.7%
neg-sub038.7%
Simplified38.7%
Taylor expanded in t around inf 32.0%
+-commutative32.0%
associate--l+32.8%
+-commutative32.8%
Simplified32.8%
if 0.999999500000000041 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 96.9%
associate-+l+96.9%
associate-+l+96.9%
+-commutative96.9%
+-commutative96.9%
associate-+r+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
Simplified63.6%
Taylor expanded in y around 0 53.9%
flip--53.9%
div-inv53.9%
add-sqr-sqrt42.3%
add-sqr-sqrt54.1%
associate--l+54.2%
Applied egg-rr54.2%
associate-*r/54.2%
+-inverses54.2%
metadata-eval54.2%
metadata-eval54.2%
Simplified54.2%
Final simplification42.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 x)
(+
(+ (sqrt y) (- (sqrt t) (sqrt (+ t 1.0))))
(-
(/ (+ (- z z) 1.0) (- (- (sqrt z)) (sqrt (+ z 1.0))))
(sqrt (+ y 1.0)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - (sqrt(x) + ((sqrt(y) + (sqrt(t) - sqrt((t + 1.0)))) + ((((z - z) + 1.0) / (-sqrt(z) - sqrt((z + 1.0)))) - sqrt((y + 1.0)))));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - (sqrt(x) + ((sqrt(y) + (sqrt(t) - sqrt((t + 1.0d0)))) + ((((z - z) + 1.0d0) / (-sqrt(z) - sqrt((z + 1.0d0)))) - sqrt((y + 1.0d0)))))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - (Math.sqrt(x) + ((Math.sqrt(y) + (Math.sqrt(t) - Math.sqrt((t + 1.0)))) + ((((z - z) + 1.0) / (-Math.sqrt(z) - Math.sqrt((z + 1.0)))) - Math.sqrt((y + 1.0)))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - (math.sqrt(x) + ((math.sqrt(y) + (math.sqrt(t) - math.sqrt((t + 1.0)))) + ((((z - z) + 1.0) / (-math.sqrt(z) - math.sqrt((z + 1.0)))) - math.sqrt((y + 1.0)))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - Float64(sqrt(x) + Float64(Float64(sqrt(y) + Float64(sqrt(t) - sqrt(Float64(t + 1.0)))) + Float64(Float64(Float64(Float64(z - z) + 1.0) / Float64(Float64(-sqrt(z)) - sqrt(Float64(z + 1.0)))) - sqrt(Float64(y + 1.0)))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - (sqrt(x) + ((sqrt(y) + (sqrt(t) - sqrt((t + 1.0)))) + ((((z - z) + 1.0) / (-sqrt(z) - sqrt((z + 1.0)))) - sqrt((y + 1.0)))));
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[x], $MachinePrecision] + N[(N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] - N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(z - z), $MachinePrecision] + 1.0), $MachinePrecision] / N[((-N[Sqrt[z], $MachinePrecision]) - N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \left(\sqrt{x} + \left(\left(\sqrt{y} + \left(\sqrt{t} - \sqrt{t + 1}\right)\right) + \left(\frac{\left(z - z\right) + 1}{\left(-\sqrt{z}\right) - \sqrt{z + 1}} - \sqrt{y + 1}\right)\right)\right)
\end{array}
Initial program 91.4%
associate-+l+91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l-50.8%
Simplified36.7%
flip--36.7%
frac-2neg36.7%
add-sqr-sqrt30.2%
add-sqr-sqrt36.8%
Applied egg-rr36.8%
neg-sub036.8%
+-inverses36.8%
associate--l+36.9%
associate--r+36.9%
+-inverses36.9%
metadata-eval36.9%
+-inverses36.9%
neg-sub036.9%
+-inverses36.9%
metadata-eval36.9%
metadata-eval36.9%
neg-sub036.9%
+-inverses36.9%
+-commutative36.9%
associate--r+36.9%
+-inverses36.9%
neg-sub036.9%
Simplified36.9%
Final simplification36.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(+
(sqrt (+ x 1.0))
(-
(+
(+ (sqrt (+ y 1.0)) (/ (- (+ z 1.0) z) (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (- (sqrt (+ t 1.0)) (sqrt t)) (sqrt y)))
(sqrt x))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) + (((sqrt((y + 1.0)) + (((z + 1.0) - z) / (sqrt((z + 1.0)) + sqrt(z)))) + ((sqrt((t + 1.0)) - sqrt(t)) - sqrt(y))) - sqrt(x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) + (((sqrt((y + 1.0d0)) + (((z + 1.0d0) - z) / (sqrt((z + 1.0d0)) + sqrt(z)))) + ((sqrt((t + 1.0d0)) - sqrt(t)) - sqrt(y))) - sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) + (((Math.sqrt((y + 1.0)) + (((z + 1.0) - z) / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + ((Math.sqrt((t + 1.0)) - Math.sqrt(t)) - Math.sqrt(y))) - Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) + (((math.sqrt((y + 1.0)) + (((z + 1.0) - z) / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + ((math.sqrt((t + 1.0)) - math.sqrt(t)) - math.sqrt(y))) - math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(Float64(z + 1.0) - z) / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) - sqrt(y))) - sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) + (((sqrt((y + 1.0)) + (((z + 1.0) - z) / (sqrt((z + 1.0)) + sqrt(z)))) + ((sqrt((t + 1.0)) - sqrt(t)) - sqrt(y))) - sqrt(x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(z + 1.0), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} + \left(\left(\left(\sqrt{y + 1} + \frac{\left(z + 1\right) - z}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\left(\sqrt{t + 1} - \sqrt{t}\right) - \sqrt{y}\right)\right) - \sqrt{x}\right)
\end{array}
Initial program 91.4%
associate-+l+91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l-50.8%
Simplified36.7%
flip--36.7%
add-sqr-sqrt30.2%
add-sqr-sqrt36.8%
Applied egg-rr36.8%
Final simplification36.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 (+ z 1.0)) (sqrt z)))
(- (sqrt y) (/ 1.0 (+ (sqrt t) (sqrt (+ t 1.0))))))
(sqrt x))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) + (((sqrt((y + 1.0)) + (sqrt((z + 1.0)) - sqrt(z))) - (sqrt(y) - (1.0 / (sqrt(t) + sqrt((t + 1.0)))))) - sqrt(x));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) + (((sqrt((y + 1.0d0)) + (sqrt((z + 1.0d0)) - sqrt(z))) - (sqrt(y) - (1.0d0 / (sqrt(t) + sqrt((t + 1.0d0)))))) - sqrt(x))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) + (((Math.sqrt((y + 1.0)) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) - (Math.sqrt(y) - (1.0 / (Math.sqrt(t) + Math.sqrt((t + 1.0)))))) - Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) + (((math.sqrt((y + 1.0)) + (math.sqrt((z + 1.0)) - math.sqrt(z))) - (math.sqrt(y) - (1.0 / (math.sqrt(t) + math.sqrt((t + 1.0)))))) - math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) - Float64(sqrt(y) - Float64(1.0 / Float64(sqrt(t) + sqrt(Float64(t + 1.0)))))) - sqrt(x))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) + (((sqrt((y + 1.0)) + (sqrt((z + 1.0)) - sqrt(z))) - (sqrt(y) - (1.0 / (sqrt(t) + sqrt((t + 1.0)))))) - sqrt(x));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] - N[(1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} + \left(\left(\left(\sqrt{y + 1} + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) - \left(\sqrt{y} - \frac{1}{\sqrt{t} + \sqrt{t + 1}}\right)\right) - \sqrt{x}\right)
\end{array}
Initial program 91.4%
associate-+l+91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l-50.8%
Simplified36.7%
flip--30.8%
div-inv30.8%
add-sqr-sqrt24.5%
add-sqr-sqrt30.9%
associate--l+31.2%
Applied egg-rr36.8%
associate-*r/31.2%
+-inverses31.2%
metadata-eval31.2%
metadata-eval31.2%
Simplified36.8%
Final simplification36.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 (<= t 2.15e+17)
(- (+ (sqrt (+ t 1.0)) 3.0) (+ (sqrt y) (sqrt t)))
(-
(sqrt (+ x 1.0))
(+
(sqrt x)
(+
(/ -1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))
(- (sqrt y) (sqrt (+ y 1.0))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.15e+17) {
tmp = (sqrt((t + 1.0)) + 3.0) - (sqrt(y) + sqrt(t));
} else {
tmp = sqrt((x + 1.0)) - (sqrt(x) + ((-1.0 / (sqrt((z + 1.0)) + sqrt(z))) + (sqrt(y) - sqrt((y + 1.0)))));
}
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 (t <= 2.15d+17) then
tmp = (sqrt((t + 1.0d0)) + 3.0d0) - (sqrt(y) + sqrt(t))
else
tmp = sqrt((x + 1.0d0)) - (sqrt(x) + (((-1.0d0) / (sqrt((z + 1.0d0)) + sqrt(z))) + (sqrt(y) - sqrt((y + 1.0d0)))))
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 (t <= 2.15e+17) {
tmp = (Math.sqrt((t + 1.0)) + 3.0) - (Math.sqrt(y) + Math.sqrt(t));
} else {
tmp = Math.sqrt((x + 1.0)) - (Math.sqrt(x) + ((-1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))) + (Math.sqrt(y) - Math.sqrt((y + 1.0)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 2.15e+17: tmp = (math.sqrt((t + 1.0)) + 3.0) - (math.sqrt(y) + math.sqrt(t)) else: tmp = math.sqrt((x + 1.0)) - (math.sqrt(x) + ((-1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z))) + (math.sqrt(y) - math.sqrt((y + 1.0))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 2.15e+17) tmp = Float64(Float64(sqrt(Float64(t + 1.0)) + 3.0) - Float64(sqrt(y) + sqrt(t))); else tmp = Float64(sqrt(Float64(x + 1.0)) - Float64(sqrt(x) + Float64(Float64(-1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) + Float64(sqrt(y) - sqrt(Float64(y + 1.0)))))); 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 (t <= 2.15e+17)
tmp = (sqrt((t + 1.0)) + 3.0) - (sqrt(y) + sqrt(t));
else
tmp = sqrt((x + 1.0)) - (sqrt(x) + ((-1.0 / (sqrt((z + 1.0)) + sqrt(z))) + (sqrt(y) - sqrt((y + 1.0)))));
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[t, 2.15e+17], N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[(-1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.15 \cdot 10^{+17}:\\
\;\;\;\;\left(\sqrt{t + 1} + 3\right) - \left(\sqrt{y} + \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \left(\sqrt{x} + \left(\frac{-1}{\sqrt{z + 1} + \sqrt{z}} + \left(\sqrt{y} - \sqrt{y + 1}\right)\right)\right)\\
\end{array}
\end{array}
if t < 2.15e17Initial program 95.7%
associate-+l+95.7%
associate-+l+95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
Simplified51.6%
Taylor expanded in y around 0 31.4%
Taylor expanded in x around 0 17.2%
associate-+r+17.2%
+-commutative17.2%
+-commutative17.2%
Simplified17.2%
Taylor expanded in z around 0 19.7%
if 2.15e17 < t Initial program 86.6%
associate-+l+86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+l-50.6%
Simplified45.3%
flip--45.3%
frac-2neg45.3%
add-sqr-sqrt35.5%
add-sqr-sqrt45.6%
Applied egg-rr45.6%
neg-sub045.6%
+-inverses45.6%
associate--l+45.6%
associate--r+45.6%
+-inverses45.6%
metadata-eval45.6%
+-inverses45.6%
neg-sub045.6%
+-inverses45.6%
metadata-eval45.6%
metadata-eval45.6%
neg-sub045.6%
+-inverses45.6%
+-commutative45.6%
associate--r+45.6%
+-inverses45.6%
neg-sub045.6%
Simplified45.6%
Taylor expanded in t around inf 45.6%
+-commutative45.6%
associate--l+51.3%
+-commutative51.3%
Simplified51.3%
Final simplification34.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t 5e+18)
(- (+ (sqrt (+ t 1.0)) 3.0) (+ (sqrt y) (sqrt t)))
(+
(sqrt (+ x 1.0))
(-
(- (sqrt (+ y 1.0)) (+ (sqrt y) (- (sqrt z) (sqrt (+ z 1.0)))))
(sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 5e+18) {
tmp = (sqrt((t + 1.0)) + 3.0) - (sqrt(y) + sqrt(t));
} else {
tmp = sqrt((x + 1.0)) + ((sqrt((y + 1.0)) - (sqrt(y) + (sqrt(z) - 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) :: tmp
if (t <= 5d+18) then
tmp = (sqrt((t + 1.0d0)) + 3.0d0) - (sqrt(y) + sqrt(t))
else
tmp = sqrt((x + 1.0d0)) + ((sqrt((y + 1.0d0)) - (sqrt(y) + (sqrt(z) - 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 tmp;
if (t <= 5e+18) {
tmp = (Math.sqrt((t + 1.0)) + 3.0) - (Math.sqrt(y) + Math.sqrt(t));
} else {
tmp = Math.sqrt((x + 1.0)) + ((Math.sqrt((y + 1.0)) - (Math.sqrt(y) + (Math.sqrt(z) - 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): tmp = 0 if t <= 5e+18: tmp = (math.sqrt((t + 1.0)) + 3.0) - (math.sqrt(y) + math.sqrt(t)) else: tmp = math.sqrt((x + 1.0)) + ((math.sqrt((y + 1.0)) - (math.sqrt(y) + (math.sqrt(z) - 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) tmp = 0.0 if (t <= 5e+18) tmp = Float64(Float64(sqrt(Float64(t + 1.0)) + 3.0) - Float64(sqrt(y) + sqrt(t))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + Float64(sqrt(z) - sqrt(Float64(z + 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 (t <= 5e+18)
tmp = (sqrt((t + 1.0)) + 3.0) - (sqrt(y) + sqrt(t));
else
tmp = sqrt((x + 1.0)) + ((sqrt((y + 1.0)) - (sqrt(y) + (sqrt(z) - 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_] := If[LessEqual[t, 5e+18], N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{+18}:\\
\;\;\;\;\left(\sqrt{t + 1} + 3\right) - \left(\sqrt{y} + \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\left(\sqrt{y + 1} - \left(\sqrt{y} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if t < 5e18Initial program 95.7%
associate-+l+95.7%
associate-+l+95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
Simplified51.6%
Taylor expanded in y around 0 31.4%
Taylor expanded in x around 0 17.2%
associate-+r+17.2%
+-commutative17.2%
+-commutative17.2%
Simplified17.2%
Taylor expanded in z around 0 19.7%
if 5e18 < t Initial program 86.6%
associate-+l+86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+l-50.6%
Simplified45.3%
Taylor expanded in t around inf 31.8%
associate--l+39.9%
+-commutative39.9%
associate--l-45.3%
Simplified45.3%
Final simplification31.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= t 5e+18) (- (+ (sqrt (+ t 1.0)) 3.0) (+ (sqrt y) (sqrt t))) (+ (- (sqrt (+ y 1.0)) (+ (sqrt y) (- (sqrt z) (sqrt (+ z 1.0))))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 5e+18) {
tmp = (sqrt((t + 1.0)) + 3.0) - (sqrt(y) + sqrt(t));
} else {
tmp = (sqrt((y + 1.0)) - (sqrt(y) + (sqrt(z) - sqrt((z + 1.0))))) + 1.0;
}
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 (t <= 5d+18) then
tmp = (sqrt((t + 1.0d0)) + 3.0d0) - (sqrt(y) + sqrt(t))
else
tmp = (sqrt((y + 1.0d0)) - (sqrt(y) + (sqrt(z) - sqrt((z + 1.0d0))))) + 1.0d0
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 (t <= 5e+18) {
tmp = (Math.sqrt((t + 1.0)) + 3.0) - (Math.sqrt(y) + Math.sqrt(t));
} else {
tmp = (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + (Math.sqrt(z) - Math.sqrt((z + 1.0))))) + 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 5e+18: tmp = (math.sqrt((t + 1.0)) + 3.0) - (math.sqrt(y) + math.sqrt(t)) else: tmp = (math.sqrt((y + 1.0)) - (math.sqrt(y) + (math.sqrt(z) - math.sqrt((z + 1.0))))) + 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 5e+18) tmp = Float64(Float64(sqrt(Float64(t + 1.0)) + 3.0) - Float64(sqrt(y) + sqrt(t))); else tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + Float64(sqrt(z) - sqrt(Float64(z + 1.0))))) + 1.0); 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 (t <= 5e+18)
tmp = (sqrt((t + 1.0)) + 3.0) - (sqrt(y) + sqrt(t));
else
tmp = (sqrt((y + 1.0)) - (sqrt(y) + (sqrt(z) - sqrt((z + 1.0))))) + 1.0;
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[t, 5e+18], N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{+18}:\\
\;\;\;\;\left(\sqrt{t + 1} + 3\right) - \left(\sqrt{y} + \sqrt{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{y + 1} - \left(\sqrt{y} + \left(\sqrt{z} - \sqrt{z + 1}\right)\right)\right) + 1\\
\end{array}
\end{array}
if t < 5e18Initial program 95.7%
associate-+l+95.7%
associate-+l+95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
sub-neg95.7%
sub-neg95.7%
+-commutative95.7%
Simplified51.6%
Taylor expanded in y around 0 31.4%
Taylor expanded in x around 0 17.2%
associate-+r+17.2%
+-commutative17.2%
+-commutative17.2%
Simplified17.2%
Taylor expanded in z around 0 19.7%
if 5e18 < t Initial program 86.6%
associate-+l+86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+l-50.6%
Simplified45.3%
Taylor expanded in t around inf 17.8%
+-commutative17.8%
associate--l+31.6%
+-commutative31.6%
+-commutative31.6%
+-commutative31.6%
Simplified31.6%
+-commutative31.6%
associate--r+31.8%
associate-+l-45.1%
associate--r+39.3%
associate-+r-71.4%
+-commutative71.4%
associate-+l-39.3%
associate--r+53.5%
+-commutative53.5%
Applied egg-rr53.5%
Taylor expanded in x around 0 20.0%
associate--l+56.3%
associate--l+51.4%
+-commutative51.4%
associate--r+56.6%
Simplified56.6%
Final simplification37.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 2.8e+14) (- (+ (sqrt (+ z 1.0)) 2.0) (+ (sqrt z) (sqrt y))) (+ (sqrt (+ x 1.0)) (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.8e+14) {
tmp = (sqrt((z + 1.0)) + 2.0) - (sqrt(z) + sqrt(y));
} else {
tmp = sqrt((x + 1.0)) + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 2.8d+14) then
tmp = (sqrt((z + 1.0d0)) + 2.0d0) - (sqrt(z) + sqrt(y))
else
tmp = sqrt((x + 1.0d0)) + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.8e+14) {
tmp = (Math.sqrt((z + 1.0)) + 2.0) - (Math.sqrt(z) + Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 2.8e+14: tmp = (math.sqrt((z + 1.0)) + 2.0) - (math.sqrt(z) + math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 2.8e+14) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) + 2.0) - Float64(sqrt(z) + sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 2.8e+14)
tmp = (sqrt((z + 1.0)) + 2.0) - (sqrt(z) + sqrt(y));
else
tmp = sqrt((x + 1.0)) + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 2.8e+14], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.8 \cdot 10^{+14}:\\
\;\;\;\;\left(\sqrt{z + 1} + 2\right) - \left(\sqrt{z} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if z < 2.8e14Initial program 96.3%
associate-+l+96.3%
associate-+l+96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
Simplified62.3%
Taylor expanded in y around 0 52.1%
Taylor expanded in x around 0 18.0%
associate-+r+18.0%
+-commutative18.0%
+-commutative18.0%
Simplified18.0%
Taylor expanded in t around inf 33.1%
if 2.8e14 < z Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
associate-+l+86.7%
+-commutative86.7%
associate-+l-47.6%
Simplified39.4%
Taylor expanded in t around inf 3.8%
+-commutative3.8%
associate--l+19.5%
+-commutative19.5%
+-commutative19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in z around inf 20.4%
associate--l+32.0%
+-commutative32.0%
+-commutative32.0%
Simplified32.0%
Final simplification32.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 1.15e+14) (- (+ (sqrt (+ z 1.0)) 2.0) (+ (sqrt z) (sqrt y))) (+ (- (sqrt (+ y 1.0)) (sqrt y)) (- (sqrt (+ x 1.0)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.15e+14) {
tmp = (sqrt((z + 1.0)) + 2.0) - (sqrt(z) + sqrt(y));
} else {
tmp = (sqrt((y + 1.0)) - sqrt(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 <= 1.15d+14) then
tmp = (sqrt((z + 1.0d0)) + 2.0d0) - (sqrt(z) + sqrt(y))
else
tmp = (sqrt((y + 1.0d0)) - sqrt(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 <= 1.15e+14) {
tmp = (Math.sqrt((z + 1.0)) + 2.0) - (Math.sqrt(z) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((y + 1.0)) - Math.sqrt(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 <= 1.15e+14: tmp = (math.sqrt((z + 1.0)) + 2.0) - (math.sqrt(z) + math.sqrt(y)) else: tmp = (math.sqrt((y + 1.0)) - math.sqrt(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 <= 1.15e+14) tmp = Float64(Float64(sqrt(Float64(z + 1.0)) + 2.0) - Float64(sqrt(z) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(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 <= 1.15e+14)
tmp = (sqrt((z + 1.0)) + 2.0) - (sqrt(z) + sqrt(y));
else
tmp = (sqrt((y + 1.0)) - sqrt(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, 1.15e+14], N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $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 1.15 \cdot 10^{+14}:\\
\;\;\;\;\left(\sqrt{z + 1} + 2\right) - \left(\sqrt{z} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{x + 1} - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 1.15e14Initial program 96.3%
associate-+l+96.3%
associate-+l+96.3%
+-commutative96.3%
+-commutative96.3%
associate-+r+96.3%
sub-neg96.3%
sub-neg96.3%
+-commutative96.3%
Simplified62.3%
Taylor expanded in y around 0 52.1%
Taylor expanded in x around 0 18.0%
associate-+r+18.0%
+-commutative18.0%
+-commutative18.0%
Simplified18.0%
Taylor expanded in t around inf 33.1%
if 1.15e14 < z Initial program 86.7%
associate-+l+86.7%
associate-+l+86.7%
+-commutative86.7%
associate-+l+86.7%
+-commutative86.7%
associate-+l-47.6%
Simplified39.4%
Taylor expanded in t around inf 3.8%
+-commutative3.8%
associate--l+19.5%
+-commutative19.5%
+-commutative19.5%
+-commutative19.5%
Simplified19.5%
+-commutative19.5%
associate--r+19.2%
associate-+l-20.9%
associate--r+14.9%
associate-+r-48.0%
+-commutative48.0%
associate-+l-14.9%
associate--r+15.0%
+-commutative15.0%
Applied egg-rr15.0%
Taylor expanded in z around inf 48.0%
Final simplification40.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 1.6) (+ 2.0 (- (sqrt (+ z 1.0)) (+ (sqrt z) (sqrt y)))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.6) {
tmp = 2.0 + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.6d0) then
tmp = 2.0d0 + (sqrt((z + 1.0d0)) - (sqrt(z) + sqrt(y)))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.6) {
tmp = 2.0 + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.6: tmp = 2.0 + (math.sqrt((z + 1.0)) - (math.sqrt(z) + math.sqrt(y))) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.6) tmp = Float64(2.0 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + sqrt(y)))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.6)
tmp = 2.0 + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.6], N[(2.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.6:\\
\;\;\;\;2 + \left(\sqrt{z + 1} - \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.6000000000000001Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+r+97.3%
sub-neg97.3%
sub-neg97.3%
+-commutative97.3%
Simplified57.5%
Taylor expanded in y around 0 56.8%
Taylor expanded in x around 0 18.3%
associate-+r+18.3%
+-commutative18.3%
+-commutative18.3%
Simplified18.3%
Taylor expanded in t around inf 33.4%
associate--l+59.3%
Simplified59.3%
if 1.6000000000000001 < y Initial program 84.8%
associate-+l+84.8%
associate-+l+84.8%
+-commutative84.8%
associate-+l+84.8%
+-commutative84.8%
associate-+l-51.0%
Simplified21.1%
Taylor expanded in t around inf 3.9%
+-commutative3.9%
associate--l+20.7%
+-commutative20.7%
+-commutative20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in y around inf 26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in z around inf 20.2%
Final simplification41.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ x 1.0)))) (if (<= y 2.8) (- (+ t_1 1.0) (sqrt x)) (- t_1 (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 2.8) {
tmp = (t_1 + 1.0) - sqrt(x);
} else {
tmp = t_1 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if (y <= 2.8d0) then
tmp = (t_1 + 1.0d0) - sqrt(x)
else
tmp = t_1 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 2.8) {
tmp = (t_1 + 1.0) - Math.sqrt(x);
} else {
tmp = t_1 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 2.8: tmp = (t_1 + 1.0) - math.sqrt(x) else: tmp = t_1 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 2.8) tmp = Float64(Float64(t_1 + 1.0) - sqrt(x)); else tmp = Float64(t_1 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 2.8)
tmp = (t_1 + 1.0) - sqrt(x);
else
tmp = t_1 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 2.8], N[(N[(t$95$1 + 1.0), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 2.8:\\
\;\;\;\;\left(t_1 + 1\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;t_1 - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.7999999999999998Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+l-50.5%
Simplified50.5%
Taylor expanded in t around inf 17.8%
+-commutative17.8%
associate--l+21.5%
+-commutative21.5%
+-commutative21.5%
+-commutative21.5%
Simplified21.5%
Taylor expanded in y around inf 11.3%
+-commutative11.3%
Simplified11.3%
Taylor expanded in z around 0 23.7%
if 2.7999999999999998 < y Initial program 84.8%
associate-+l+84.8%
associate-+l+84.8%
+-commutative84.8%
associate-+l+84.8%
+-commutative84.8%
associate-+l-51.0%
Simplified21.1%
Taylor expanded in t around inf 3.9%
+-commutative3.9%
associate--l+20.7%
+-commutative20.7%
+-commutative20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in y around inf 26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in z around inf 20.2%
Final simplification22.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 91.4%
associate-+l+91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l-50.8%
Simplified36.7%
Taylor expanded in t around inf 11.3%
+-commutative11.3%
associate--l+21.1%
+-commutative21.1%
+-commutative21.1%
+-commutative21.1%
Simplified21.1%
Taylor expanded in y around inf 18.3%
+-commutative18.3%
Simplified18.3%
Taylor expanded in z around inf 14.7%
Final simplification14.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 91.4%
associate-+l+91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l+91.4%
+-commutative91.4%
associate-+l-50.8%
Simplified36.7%
Taylor expanded in t around inf 11.3%
+-commutative11.3%
associate--l+21.1%
+-commutative21.1%
+-commutative21.1%
+-commutative21.1%
Simplified21.1%
Taylor expanded in y around inf 18.3%
+-commutative18.3%
Simplified18.3%
Taylor expanded in z around inf 14.7%
Taylor expanded in x around 0 37.1%
Final simplification37.1%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2023301
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:herbie-target
(+ (+ (+ (/ 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))))