
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 x))))
(+
(/
(/ (+ t_1 (+ (+ (sqrt y) t_2) (sqrt x))) (+ t_1 (sqrt y)))
(+ (sqrt x) t_2))
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + x));
return (((t_1 + ((sqrt(y) + t_2) + sqrt(x))) / (t_1 + sqrt(y))) / (sqrt(x) + t_2)) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(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
real(8) :: t_1
real(8) :: t_2
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + x))
code = (((t_1 + ((sqrt(y) + t_2) + sqrt(x))) / (t_1 + sqrt(y))) / (sqrt(x) + t_2)) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + x));
return (((t_1 + ((Math.sqrt(y) + t_2) + Math.sqrt(x))) / (t_1 + Math.sqrt(y))) / (Math.sqrt(x) + t_2)) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + x)) return (((t_1 + ((math.sqrt(y) + t_2) + math.sqrt(x))) / (t_1 + math.sqrt(y))) / (math.sqrt(x) + t_2)) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + x)) return Float64(Float64(Float64(Float64(t_1 + Float64(Float64(sqrt(y) + t_2) + sqrt(x))) / Float64(t_1 + sqrt(y))) / Float64(sqrt(x) + t_2)) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + x));
tmp = (((t_1 + ((sqrt(y) + t_2) + sqrt(x))) / (t_1 + sqrt(y))) / (sqrt(x) + t_2)) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(t$95$1 + N[(N[(N[Sqrt[y], $MachinePrecision] + t$95$2), $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + x}\\
\frac{\frac{t_1 + \left(\left(\sqrt{y} + t_2\right) + \sqrt{x}\right)}{t_1 + \sqrt{y}}}{\sqrt{x} + t_2} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
\end{array}
Initial program 92.9%
associate-+l+92.9%
associate-+l-69.3%
+-commutative69.3%
sub-neg69.3%
sub-neg69.3%
+-commutative69.3%
+-commutative69.3%
Simplified69.3%
flip--69.3%
add-sqr-sqrt52.8%
add-sqr-sqrt69.8%
Applied egg-rr69.8%
associate--l+70.0%
+-inverses70.0%
metadata-eval70.0%
Simplified70.0%
add-exp-log70.0%
associate--r-94.8%
Applied egg-rr94.8%
flip--94.8%
add-sqr-sqrt71.6%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
+-commutative95.0%
associate--l+96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
add-exp-log96.7%
frac-add96.6%
+-inverses96.6%
metadata-eval96.6%
*-un-lft-identity96.6%
Applied egg-rr96.6%
*-commutative96.6%
associate-/r*96.6%
*-rgt-identity96.6%
associate-+l+96.6%
+-commutative96.6%
associate-+r+96.6%
Simplified96.6%
Final simplification96.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (- t_1 (sqrt x))) (t_3 (sqrt (+ 1.0 y))))
(if (<= (+ t_2 (- t_3 (sqrt y))) 0.01)
(/ 1.0 (+ (sqrt x) t_1))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ (/ 1.0 (+ t_3 (sqrt y))) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = t_1 - sqrt(x);
double t_3 = sqrt((1.0 + y));
double tmp;
if ((t_2 + (t_3 - sqrt(y))) <= 0.01) {
tmp = 1.0 / (sqrt(x) + t_1);
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 / (t_3 + sqrt(y))) + t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = t_1 - sqrt(x)
t_3 = sqrt((1.0d0 + y))
if ((t_2 + (t_3 - sqrt(y))) <= 0.01d0) then
tmp = 1.0d0 / (sqrt(x) + t_1)
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 / (t_3 + sqrt(y))) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = t_1 - Math.sqrt(x);
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if ((t_2 + (t_3 - Math.sqrt(y))) <= 0.01) {
tmp = 1.0 / (Math.sqrt(x) + t_1);
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 / (t_3 + Math.sqrt(y))) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = t_1 - math.sqrt(x) t_3 = math.sqrt((1.0 + y)) tmp = 0 if (t_2 + (t_3 - math.sqrt(y))) <= 0.01: tmp = 1.0 / (math.sqrt(x) + t_1) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 / (t_3 + math.sqrt(y))) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(t_1 - sqrt(x)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(t_2 + Float64(t_3 - sqrt(y))) <= 0.01) tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 / Float64(t_3 + sqrt(y))) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = t_1 - sqrt(x);
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if ((t_2 + (t_3 - sqrt(y))) <= 0.01)
tmp = 1.0 / (sqrt(x) + t_1);
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 / (t_3 + sqrt(y))) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.01], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := t_1 - \sqrt{x}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;t_2 + \left(t_3 - \sqrt{y}\right) \leq 0.01:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\frac{1}{t_3 + \sqrt{y}} + t_2\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 0.0100000000000000002Initial program 74.2%
associate-+l+74.2%
+-commutative74.2%
associate-+r-70.9%
associate-+l-11.2%
+-commutative11.2%
associate--l+11.2%
+-commutative11.2%
Simplified8.6%
Taylor expanded in t around inf 6.2%
+-commutative6.2%
+-commutative6.2%
associate--l+6.9%
Simplified6.9%
Taylor expanded in z around inf 5.6%
+-commutative5.6%
Simplified5.6%
Taylor expanded in y around inf 5.1%
flip--5.4%
add-sqr-sqrt6.2%
add-sqr-sqrt5.4%
associate-+r-14.8%
+-inverses14.8%
metadata-eval14.8%
+-commutative14.8%
Applied egg-rr14.8%
if 0.0100000000000000002 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.9%
associate-+l+97.9%
associate-+l-68.8%
+-commutative68.8%
sub-neg68.8%
sub-neg68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
flip--68.9%
add-sqr-sqrt52.7%
add-sqr-sqrt69.5%
Applied egg-rr69.5%
associate--l+69.8%
+-inverses69.8%
metadata-eval69.8%
Simplified69.8%
sub-neg69.8%
Applied egg-rr69.8%
unsub-neg69.8%
associate-+l-98.8%
+-commutative98.8%
+-commutative98.8%
Simplified98.8%
Final simplification81.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= (+ (- t_1 (sqrt x)) (- t_2 (sqrt y))) 0.01)
(/ 1.0 (+ (sqrt x) t_1))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ t_1 (- (/ 1.0 (+ t_2 (sqrt y))) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 0.01) {
tmp = 1.0 / (sqrt(x) + t_1);
} else {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + ((1.0 / (t_2 + 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 0.01d0) then
tmp = 1.0d0 / (sqrt(x) + t_1)
else
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_1 + ((1.0d0 / (t_2 + 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 t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (((t_1 - Math.sqrt(x)) + (t_2 - Math.sqrt(y))) <= 0.01) {
tmp = 1.0 / (Math.sqrt(x) + t_1);
} else {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_1 + ((1.0 / (t_2 + Math.sqrt(y))) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if ((t_1 - math.sqrt(x)) + (t_2 - math.sqrt(y))) <= 0.01: tmp = 1.0 / (math.sqrt(x) + t_1) else: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_1 + ((1.0 / (t_2 + math.sqrt(y))) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(Float64(t_1 - sqrt(x)) + Float64(t_2 - sqrt(y))) <= 0.01) tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_1 + Float64(Float64(1.0 / Float64(t_2 + 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)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 0.01)
tmp = 1.0 / (sqrt(x) + t_1);
else
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + ((1.0 / (t_2 + 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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.01], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;\left(t_1 - \sqrt{x}\right) + \left(t_2 - \sqrt{y}\right) \leq 0.01:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t_1 + \left(\frac{1}{t_2 + \sqrt{y}} - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 0.0100000000000000002Initial program 74.2%
associate-+l+74.2%
+-commutative74.2%
associate-+r-70.9%
associate-+l-11.2%
+-commutative11.2%
associate--l+11.2%
+-commutative11.2%
Simplified8.6%
Taylor expanded in t around inf 6.2%
+-commutative6.2%
+-commutative6.2%
associate--l+6.9%
Simplified6.9%
Taylor expanded in z around inf 5.6%
+-commutative5.6%
Simplified5.6%
Taylor expanded in y around inf 5.1%
flip--5.4%
add-sqr-sqrt6.2%
add-sqr-sqrt5.4%
associate-+r-14.8%
+-inverses14.8%
metadata-eval14.8%
+-commutative14.8%
Applied egg-rr14.8%
if 0.0100000000000000002 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.9%
associate-+l+97.9%
associate-+l-68.8%
+-commutative68.8%
sub-neg68.8%
sub-neg68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
flip--68.9%
add-sqr-sqrt52.7%
add-sqr-sqrt69.5%
Applied egg-rr69.5%
associate--l+69.8%
+-inverses69.8%
metadata-eval69.8%
Simplified69.8%
Final simplification58.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(t_2 (+ (sqrt x) (sqrt (+ 1.0 x)))))
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(/ (+ t_1 t_2) (* t_1 t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y)) + sqrt(y);
double t_2 = sqrt(x) + sqrt((1.0 + x));
return ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 + t_2) / (t_1 * t_2));
}
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
t_1 = sqrt((1.0d0 + y)) + sqrt(y)
t_2 = sqrt(x) + sqrt((1.0d0 + x))
code = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((t_1 + t_2) / (t_1 * t_2))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y)) + Math.sqrt(y);
double t_2 = Math.sqrt(x) + Math.sqrt((1.0 + x));
return ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((t_1 + t_2) / (t_1 * t_2));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) + math.sqrt(y) t_2 = math.sqrt(x) + math.sqrt((1.0 + x)) return ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((t_1 + t_2) / (t_1 * t_2))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + y)) + sqrt(y)) t_2 = Float64(sqrt(x) + sqrt(Float64(1.0 + x))) return Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(t_1 + t_2) / Float64(t_1 * t_2))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
t_1 = sqrt((1.0 + y)) + sqrt(y);
t_2 = sqrt(x) + sqrt((1.0 + x));
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((t_1 + t_2) / (t_1 * t_2));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + t$95$2), $MachinePrecision] / N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y} + \sqrt{y}\\
t_2 := \sqrt{x} + \sqrt{1 + x}\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \frac{t_1 + t_2}{t_1 \cdot t_2}
\end{array}
\end{array}
Initial program 92.9%
associate-+l+92.9%
associate-+l-69.3%
+-commutative69.3%
sub-neg69.3%
sub-neg69.3%
+-commutative69.3%
+-commutative69.3%
Simplified69.3%
flip--69.3%
add-sqr-sqrt52.8%
add-sqr-sqrt69.8%
Applied egg-rr69.8%
associate--l+70.0%
+-inverses70.0%
metadata-eval70.0%
Simplified70.0%
add-exp-log70.0%
associate--r-94.8%
Applied egg-rr94.8%
flip--94.8%
add-sqr-sqrt71.6%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
+-commutative95.0%
associate--l+96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
add-exp-log96.7%
frac-add96.6%
+-inverses96.6%
metadata-eval96.6%
*-un-lft-identity96.6%
Applied egg-rr96.6%
*-rgt-identity96.6%
*-commutative96.6%
Simplified96.6%
Final simplification96.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= (+ (- t_1 (sqrt x)) (- t_2 (sqrt y))) 1.0)
(/ 1.0 (+ (sqrt x) t_1))
(+
(- (+ 1.0 t_2) (sqrt y))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(/ (- (+ 1.0 t) t) (+ (sqrt (+ 1.0 t)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 1.0) {
tmp = 1.0 / (sqrt(x) + t_1);
} else {
tmp = ((1.0 + t_2) - sqrt(y)) + ((sqrt((1.0 + z)) - sqrt(z)) + (((1.0 + t) - t) / (sqrt((1.0 + t)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 1.0d0) then
tmp = 1.0d0 / (sqrt(x) + t_1)
else
tmp = ((1.0d0 + t_2) - sqrt(y)) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (((1.0d0 + t) - t) / (sqrt((1.0d0 + t)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (((t_1 - Math.sqrt(x)) + (t_2 - Math.sqrt(y))) <= 1.0) {
tmp = 1.0 / (Math.sqrt(x) + t_1);
} else {
tmp = ((1.0 + t_2) - Math.sqrt(y)) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (((1.0 + t) - t) / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if ((t_1 - math.sqrt(x)) + (t_2 - math.sqrt(y))) <= 1.0: tmp = 1.0 / (math.sqrt(x) + t_1) else: tmp = ((1.0 + t_2) - math.sqrt(y)) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (((1.0 + t) - t) / (math.sqrt((1.0 + t)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(Float64(t_1 - sqrt(x)) + Float64(t_2 - sqrt(y))) <= 1.0) tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); else tmp = Float64(Float64(Float64(1.0 + t_2) - sqrt(y)) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(Float64(1.0 + t) - t) / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 1.0)
tmp = 1.0 / (sqrt(x) + t_1);
else
tmp = ((1.0 + t_2) - sqrt(y)) + ((sqrt((1.0 + z)) - sqrt(z)) + (((1.0 + t) - t) / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t), $MachinePrecision] - t), $MachinePrecision] / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;\left(t_1 - \sqrt{x}\right) + \left(t_2 - \sqrt{y}\right) \leq 1:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + t_2\right) - \sqrt{y}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{\left(1 + t\right) - t}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1Initial program 91.5%
associate-+l+91.5%
+-commutative91.5%
associate-+r-60.7%
associate-+l-39.8%
+-commutative39.8%
associate--l+39.8%
+-commutative39.8%
Simplified28.7%
Taylor expanded in t around inf 23.2%
+-commutative23.2%
+-commutative23.2%
associate--l+23.6%
Simplified23.6%
Taylor expanded in z around inf 15.3%
+-commutative15.3%
Simplified15.3%
Taylor expanded in y around inf 14.6%
flip--14.7%
add-sqr-sqrt15.0%
add-sqr-sqrt14.7%
associate-+r-18.5%
+-inverses18.5%
metadata-eval18.5%
+-commutative18.5%
Applied egg-rr18.5%
if 1 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.8%
associate-+l+97.8%
associate-+l-97.8%
+-commutative97.8%
sub-neg97.8%
sub-neg97.8%
+-commutative97.8%
+-commutative97.8%
Simplified97.8%
flip--97.8%
add-sqr-sqrt76.3%
+-commutative76.3%
add-sqr-sqrt97.8%
+-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in x around 0 86.9%
Final simplification34.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(exp
(log
(+
(/ (+ 1.0 (- x x)) (+ (sqrt x) (sqrt (+ 1.0 x))))
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + exp(log((((1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (sqrt((1.0 + y)) + 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((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + exp(log((((1.0d0 + (x - x)) / (sqrt(x) + sqrt((1.0d0 + x)))) + (1.0d0 / (sqrt((1.0d0 + y)) + 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((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + Math.exp(Math.log((((1.0 + (x - x)) / (Math.sqrt(x) + Math.sqrt((1.0 + x)))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))))));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + math.exp(math.log((((1.0 + (x - x)) / (math.sqrt(x) + math.sqrt((1.0 + x)))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + exp(log(Float64(Float64(Float64(1.0 + Float64(x - x)) / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + exp(log((((1.0 + (x - x)) / (sqrt(x) + sqrt((1.0 + x)))) + (1.0 / (sqrt((1.0 + y)) + 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[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Exp[N[Log[N[(N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + e^{\log \left(\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{1 + x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right)}
\end{array}
Initial program 92.9%
associate-+l+92.9%
associate-+l-69.3%
+-commutative69.3%
sub-neg69.3%
sub-neg69.3%
+-commutative69.3%
+-commutative69.3%
Simplified69.3%
flip--69.3%
add-sqr-sqrt52.8%
add-sqr-sqrt69.8%
Applied egg-rr69.8%
associate--l+70.0%
+-inverses70.0%
metadata-eval70.0%
Simplified70.0%
add-exp-log70.0%
associate--r-94.8%
Applied egg-rr94.8%
flip--94.8%
add-sqr-sqrt71.6%
add-sqr-sqrt95.0%
Applied egg-rr95.0%
+-commutative95.0%
associate--l+96.5%
+-commutative96.5%
+-commutative96.5%
Simplified96.5%
Final simplification96.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= t 540000000000.0)
(+ (+ t_1 (sqrt (+ 1.0 t))) (- 2.0 (+ (sqrt z) (sqrt t))))
(+
(sqrt (+ 1.0 x))
(+
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))
(- (- t_1 (sqrt z)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 540000000000.0) {
tmp = (t_1 + sqrt((1.0 + t))) + (2.0 - (sqrt(z) + sqrt(t)));
} else {
tmp = sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((t_1 - sqrt(z)) - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 540000000000.0d0) then
tmp = (t_1 + sqrt((1.0d0 + t))) + (2.0d0 - (sqrt(z) + sqrt(t)))
else
tmp = sqrt((1.0d0 + x)) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + ((t_1 - sqrt(z)) - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 540000000000.0) {
tmp = (t_1 + Math.sqrt((1.0 + t))) + (2.0 - (Math.sqrt(z) + Math.sqrt(t)));
} else {
tmp = Math.sqrt((1.0 + x)) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + ((t_1 - Math.sqrt(z)) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 540000000000.0: tmp = (t_1 + math.sqrt((1.0 + t))) + (2.0 - (math.sqrt(z) + math.sqrt(t))) else: tmp = math.sqrt((1.0 + x)) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + ((t_1 - math.sqrt(z)) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 540000000000.0) tmp = Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) + Float64(2.0 - Float64(sqrt(z) + sqrt(t)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(Float64(t_1 - sqrt(z)) - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 540000000000.0)
tmp = (t_1 + sqrt((1.0 + t))) + (2.0 - (sqrt(z) + sqrt(t)));
else
tmp = sqrt((1.0 + x)) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + ((t_1 - sqrt(z)) - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 540000000000.0], N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 540000000000:\\
\;\;\;\;\left(t_1 + \sqrt{1 + t}\right) + \left(2 - \left(\sqrt{z} + \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if t < 5.4e11Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
associate-+l+73.1%
associate-+l+48.3%
+-commutative48.3%
neg-sub048.3%
associate-+l-48.3%
neg-sub048.3%
Simplified32.7%
expm1-log1p-u28.6%
associate--l+28.6%
+-commutative28.6%
+-commutative28.6%
Applied egg-rr28.6%
Taylor expanded in y around 0 16.0%
Taylor expanded in x around 0 18.5%
+-commutative18.5%
associate--l+18.5%
Simplified18.5%
if 5.4e11 < t Initial program 86.5%
associate-+l+86.5%
+-commutative86.5%
associate-+r-64.0%
associate-+l-59.8%
+-commutative59.8%
associate--l+59.8%
+-commutative59.8%
Simplified40.4%
Taylor expanded in t around inf 58.1%
+-commutative58.1%
+-commutative58.1%
associate--l+59.8%
Simplified59.8%
flip--64.0%
add-sqr-sqrt45.2%
add-sqr-sqrt64.7%
Applied egg-rr60.5%
associate--l+64.8%
+-inverses64.8%
metadata-eval64.8%
Simplified60.6%
Final simplification36.3%
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 7.8e+23)
(+
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))
(- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y)))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.8e+23) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + sqrt((1.0 + y))) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 7.8d+23) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 + sqrt((1.0d0 + y))) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.8e+23) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 7.8e+23: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 + math.sqrt((1.0 + y))) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 7.8e+23) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 7.8e+23)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 + sqrt((1.0 + y))) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 7.8e+23], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.8 \cdot 10^{+23}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 7.8000000000000001e23Initial program 97.4%
associate-+l+97.4%
associate-+l-54.5%
+-commutative54.5%
sub-neg54.5%
sub-neg54.5%
+-commutative54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in x around 0 48.8%
if 7.8000000000000001e23 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-60.7%
+-commutative60.7%
associate--l+60.7%
+-commutative60.7%
Simplified43.2%
Taylor expanded in t around inf 34.8%
+-commutative34.8%
+-commutative34.8%
associate--l+35.3%
Simplified35.3%
Taylor expanded in z around inf 22.2%
+-commutative22.2%
Simplified22.2%
Taylor expanded in y around inf 22.0%
flip--22.2%
add-sqr-sqrt22.5%
add-sqr-sqrt22.2%
associate-+r-26.5%
+-inverses26.5%
metadata-eval26.5%
+-commutative26.5%
Applied egg-rr26.5%
Final simplification38.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= t 465000000000.0)
(+ (+ t_1 (sqrt (+ 1.0 t))) (- 2.0 (+ (sqrt z) (sqrt t))))
(+
(sqrt (+ 1.0 x))
(+ (- (sqrt (+ 1.0 y)) (sqrt y)) (- (- t_1 (sqrt z)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 465000000000.0) {
tmp = (t_1 + sqrt((1.0 + t))) + (2.0 - (sqrt(z) + sqrt(t)));
} else {
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 465000000000.0d0) then
tmp = (t_1 + sqrt((1.0d0 + t))) + (2.0d0 - (sqrt(z) + sqrt(t)))
else
tmp = sqrt((1.0d0 + x)) + ((sqrt((1.0d0 + y)) - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 465000000000.0) {
tmp = (t_1 + Math.sqrt((1.0 + t))) + (2.0 - (Math.sqrt(z) + Math.sqrt(t)));
} else {
tmp = Math.sqrt((1.0 + x)) + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) + ((t_1 - Math.sqrt(z)) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 465000000000.0: tmp = (t_1 + math.sqrt((1.0 + t))) + (2.0 - (math.sqrt(z) + math.sqrt(t))) else: tmp = math.sqrt((1.0 + x)) + ((math.sqrt((1.0 + y)) - math.sqrt(y)) + ((t_1 - math.sqrt(z)) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 465000000000.0) tmp = Float64(Float64(t_1 + sqrt(Float64(1.0 + t))) + Float64(2.0 - Float64(sqrt(z) + sqrt(t)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) + Float64(Float64(t_1 - sqrt(z)) - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 465000000000.0)
tmp = (t_1 + sqrt((1.0 + t))) + (2.0 - (sqrt(z) + sqrt(t)));
else
tmp = sqrt((1.0 + x)) + ((sqrt((1.0 + y)) - sqrt(y)) + ((t_1 - sqrt(z)) - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 465000000000.0], N[(N[(t$95$1 + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 465000000000:\\
\;\;\;\;\left(t_1 + \sqrt{1 + t}\right) + \left(2 - \left(\sqrt{z} + \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) + \left(\left(t_1 - \sqrt{z}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if t < 4.65e11Initial program 97.6%
associate-+l+97.6%
sub-neg97.6%
associate-+l+73.1%
associate-+l+48.3%
+-commutative48.3%
neg-sub048.3%
associate-+l-48.3%
neg-sub048.3%
Simplified32.7%
expm1-log1p-u28.6%
associate--l+28.6%
+-commutative28.6%
+-commutative28.6%
Applied egg-rr28.6%
Taylor expanded in y around 0 16.0%
Taylor expanded in x around 0 18.5%
+-commutative18.5%
associate--l+18.5%
Simplified18.5%
if 4.65e11 < t Initial program 86.5%
associate-+l+86.5%
+-commutative86.5%
associate-+r-64.0%
associate-+l-59.8%
+-commutative59.8%
associate--l+59.8%
+-commutative59.8%
Simplified40.4%
Taylor expanded in t around inf 58.1%
+-commutative58.1%
+-commutative58.1%
associate--l+59.8%
Simplified59.8%
Final simplification35.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 1.4e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 7.2e+30)
(- (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) t_1) (sqrt x))
(/ 1.0 (+ (sqrt x) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.4e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 7.2e+30) {
tmp = ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + t_1) - sqrt(x);
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.4d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 7.2d+30) then
tmp = ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + t_1) - sqrt(x)
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.4e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 7.2e+30) {
tmp = ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + t_1) - Math.sqrt(x);
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.4e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 7.2e+30: tmp = ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + t_1) - math.sqrt(x) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.4e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 7.2e+30) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + t_1) - sqrt(x)); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.4e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 7.2e+30)
tmp = ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + t_1) - sqrt(x);
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.4e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 7.2e+30], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.4 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+30}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + t_1\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\end{array}
\end{array}
if y < 1.39999999999999994e-30Initial program 99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+r-50.9%
associate-+l-43.4%
+-commutative43.4%
associate--l+43.4%
+-commutative43.4%
Simplified29.4%
Taylor expanded in t around inf 27.0%
+-commutative27.0%
+-commutative27.0%
associate--l+27.4%
Simplified27.4%
Taylor expanded in y around 0 20.3%
associate--r+19.8%
associate--l+27.4%
rem-square-sqrt27.4%
hypot-1-def27.4%
Simplified27.4%
Taylor expanded in x around 0 35.8%
associate--l+62.1%
Simplified62.1%
if 1.39999999999999994e-30 < y < 7.2000000000000004e30Initial program 90.9%
associate-+l+90.9%
+-commutative90.9%
associate-+r-73.7%
associate-+l-61.5%
+-commutative61.5%
associate--l+61.5%
+-commutative61.5%
Simplified41.9%
Taylor expanded in t around inf 33.5%
+-commutative33.5%
+-commutative33.5%
associate--l+34.9%
Simplified34.9%
flip--74.2%
add-sqr-sqrt69.7%
add-sqr-sqrt77.7%
Applied egg-rr37.3%
associate--l+79.5%
+-inverses79.5%
metadata-eval79.5%
Simplified37.7%
Taylor expanded in z around inf 28.2%
if 7.2000000000000004e30 < y Initial program 87.1%
associate-+l+87.1%
+-commutative87.1%
associate-+r-87.1%
associate-+l-60.8%
+-commutative60.8%
associate--l+60.8%
+-commutative60.8%
Simplified43.2%
Taylor expanded in t around inf 34.5%
+-commutative34.5%
+-commutative34.5%
associate--l+35.0%
Simplified35.0%
Taylor expanded in z around inf 21.9%
+-commutative21.9%
Simplified21.9%
Taylor expanded in y around inf 21.8%
flip--21.9%
add-sqr-sqrt22.3%
add-sqr-sqrt21.9%
associate-+r-26.3%
+-inverses26.3%
metadata-eval26.3%
+-commutative26.3%
Applied egg-rr26.3%
Final simplification42.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 1.4e-30)
(+ t_1 (- (+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))) (sqrt x)))
(if (<= y 2.1e+31)
(- (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) t_1) (sqrt x))
(/ 1.0 (+ (sqrt x) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.4e-30) {
tmp = t_1 + ((1.0 + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) - sqrt(x));
} else if (y <= 2.1e+31) {
tmp = ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + t_1) - sqrt(x);
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.4d-30) then
tmp = t_1 + ((1.0d0 + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z)))) - sqrt(x))
else if (y <= 2.1d+31) then
tmp = ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + t_1) - sqrt(x)
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.4e-30) {
tmp = t_1 + ((1.0 + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z)))) - Math.sqrt(x));
} else if (y <= 2.1e+31) {
tmp = ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + t_1) - Math.sqrt(x);
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.4e-30: tmp = t_1 + ((1.0 + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z)))) - math.sqrt(x)) elif y <= 2.1e+31: tmp = ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + t_1) - math.sqrt(x) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.4e-30) tmp = Float64(t_1 + Float64(Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z)))) - sqrt(x))); elseif (y <= 2.1e+31) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + t_1) - sqrt(x)); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.4e-30)
tmp = t_1 + ((1.0 + (1.0 / (sqrt((1.0 + z)) + sqrt(z)))) - sqrt(x));
elseif (y <= 2.1e+31)
tmp = ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + t_1) - sqrt(x);
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.4e-30], N[(t$95$1 + N[(N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+31], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.4 \cdot 10^{-30}:\\
\;\;\;\;t_1 + \left(\left(1 + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right) - \sqrt{x}\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+31}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + t_1\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\end{array}
\end{array}
if y < 1.39999999999999994e-30Initial program 99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+r-50.9%
associate-+l-43.4%
+-commutative43.4%
associate--l+43.4%
+-commutative43.4%
Simplified29.4%
Taylor expanded in t around inf 27.0%
+-commutative27.0%
+-commutative27.0%
associate--l+27.4%
Simplified27.4%
Taylor expanded in y around 0 20.3%
associate--r+19.8%
associate--l+27.4%
rem-square-sqrt27.4%
hypot-1-def27.4%
Simplified27.4%
flip--27.4%
hypot-udef27.4%
metadata-eval27.4%
add-sqr-sqrt27.4%
hypot-udef27.4%
metadata-eval27.4%
add-sqr-sqrt27.4%
add-sqr-sqrt22.4%
add-sqr-sqrt27.4%
hypot-udef27.4%
metadata-eval27.4%
add-sqr-sqrt27.4%
Applied egg-rr27.4%
associate--l+27.4%
+-inverses27.4%
metadata-eval27.4%
Simplified27.4%
if 1.39999999999999994e-30 < y < 2.09999999999999979e31Initial program 90.9%
associate-+l+90.9%
+-commutative90.9%
associate-+r-73.7%
associate-+l-61.5%
+-commutative61.5%
associate--l+61.5%
+-commutative61.5%
Simplified41.9%
Taylor expanded in t around inf 33.5%
+-commutative33.5%
+-commutative33.5%
associate--l+34.9%
Simplified34.9%
flip--74.2%
add-sqr-sqrt69.7%
add-sqr-sqrt77.7%
Applied egg-rr37.3%
associate--l+79.5%
+-inverses79.5%
metadata-eval79.5%
Simplified37.7%
Taylor expanded in z around inf 28.2%
if 2.09999999999999979e31 < y Initial program 87.1%
associate-+l+87.1%
+-commutative87.1%
associate-+r-87.1%
associate-+l-60.8%
+-commutative60.8%
associate--l+60.8%
+-commutative60.8%
Simplified43.2%
Taylor expanded in t around inf 34.5%
+-commutative34.5%
+-commutative34.5%
associate--l+35.0%
Simplified35.0%
Taylor expanded in z around inf 21.9%
+-commutative21.9%
Simplified21.9%
Taylor expanded in y around inf 21.8%
flip--21.9%
add-sqr-sqrt22.3%
add-sqr-sqrt21.9%
associate-+r-26.3%
+-inverses26.3%
metadata-eval26.3%
+-commutative26.3%
Applied egg-rr26.3%
Final simplification27.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 1.4e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 2e+23)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt y) (sqrt x))))
(/ 1.0 (+ (sqrt x) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 1.4e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 2e+23) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(y) + sqrt(x)));
} else {
tmp = 1.0 / (sqrt(x) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 1.4d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 2d+23) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(y) + sqrt(x)))
else
tmp = 1.0d0 / (sqrt(x) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 1.4e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2e+23) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = 1.0 / (Math.sqrt(x) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 1.4e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 2e+23: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = 1.0 / (math.sqrt(x) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 1.4e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 2e+23) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 1.4e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 2e+23)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(y) + sqrt(x)));
else
tmp = 1.0 / (sqrt(x) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.4e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2e+23], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 1.4 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+23}:\\
\;\;\;\;t_1 + \left(\sqrt{1 + y} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\end{array}
\end{array}
if y < 1.39999999999999994e-30Initial program 99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+r-50.9%
associate-+l-43.4%
+-commutative43.4%
associate--l+43.4%
+-commutative43.4%
Simplified29.4%
Taylor expanded in t around inf 27.0%
+-commutative27.0%
+-commutative27.0%
associate--l+27.4%
Simplified27.4%
Taylor expanded in y around 0 20.3%
associate--r+19.8%
associate--l+27.4%
rem-square-sqrt27.4%
hypot-1-def27.4%
Simplified27.4%
Taylor expanded in x around 0 35.8%
associate--l+62.1%
Simplified62.1%
if 1.39999999999999994e-30 < y < 1.9999999999999998e23Initial program 90.4%
associate-+l+90.4%
+-commutative90.4%
associate-+r-69.3%
associate-+l-61.4%
+-commutative61.4%
associate--l+61.4%
+-commutative61.4%
Simplified40.1%
Taylor expanded in t around inf 32.2%
+-commutative32.2%
+-commutative32.2%
associate--l+34.1%
Simplified34.1%
Taylor expanded in z around inf 25.5%
+-commutative25.5%
Simplified25.5%
if 1.9999999999999998e23 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-60.9%
+-commutative60.9%
associate--l+60.9%
+-commutative60.9%
Simplified43.5%
Taylor expanded in t around inf 34.7%
+-commutative34.7%
+-commutative34.7%
associate--l+35.2%
Simplified35.2%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
Simplified22.1%
Taylor expanded in y around inf 22.0%
flip--22.1%
add-sqr-sqrt22.4%
add-sqr-sqrt22.1%
associate-+r-26.4%
+-inverses26.4%
metadata-eval26.4%
+-commutative26.4%
Applied egg-rr26.4%
Final simplification42.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= y 3.7e-13)
(+ (+ 1.0 t_1) (- (sqrt (+ 1.0 z)) (+ (sqrt y) (sqrt z))))
(if (<= y 5e+23)
(+ 1.0 (- t_1 (sqrt y)))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (y <= 3.7e-13) {
tmp = (1.0 + t_1) + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z)));
} else if (y <= 5e+23) {
tmp = 1.0 + (t_1 - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (y <= 3.7d-13) then
tmp = (1.0d0 + t_1) + (sqrt((1.0d0 + z)) - (sqrt(y) + sqrt(z)))
else if (y <= 5d+23) then
tmp = 1.0d0 + (t_1 - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 3.7e-13) {
tmp = (1.0 + t_1) + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + Math.sqrt(z)));
} else if (y <= 5e+23) {
tmp = 1.0 + (t_1 - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if y <= 3.7e-13: tmp = (1.0 + t_1) + (math.sqrt((1.0 + z)) - (math.sqrt(y) + math.sqrt(z))) elif y <= 5e+23: tmp = 1.0 + (t_1 - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 3.7e-13) tmp = Float64(Float64(1.0 + t_1) + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + sqrt(z)))); elseif (y <= 5e+23) tmp = Float64(1.0 + Float64(t_1 - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 3.7e-13)
tmp = (1.0 + t_1) + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z)));
elseif (y <= 5e+23)
tmp = 1.0 + (t_1 - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.7e-13], N[(N[(1.0 + t$95$1), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+23], N[(1.0 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 3.7 \cdot 10^{-13}:\\
\;\;\;\;\left(1 + t_1\right) + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+23}:\\
\;\;\;\;1 + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 3.69999999999999989e-13Initial program 98.9%
associate-+l+98.9%
+-commutative98.9%
associate-+r-53.1%
associate-+l-46.1%
+-commutative46.1%
associate--l+46.1%
+-commutative46.1%
Simplified31.4%
Taylor expanded in t around inf 28.1%
+-commutative28.1%
+-commutative28.1%
associate--l+28.8%
Simplified28.8%
Taylor expanded in x around 0 35.6%
associate--l+51.8%
+-commutative51.8%
associate--l+60.4%
associate-+r+60.4%
+-commutative60.4%
Simplified60.4%
if 3.69999999999999989e-13 < y < 4.9999999999999999e23Initial program 87.6%
associate-+l+87.6%
+-commutative87.6%
associate-+r-64.3%
associate-+l-52.9%
+-commutative52.9%
associate--l+52.9%
+-commutative52.9%
Simplified34.1%
Taylor expanded in t around inf 27.1%
+-commutative27.1%
+-commutative27.1%
associate--l+26.8%
Simplified26.8%
Taylor expanded in z around inf 26.4%
+-commutative26.4%
Simplified26.4%
Taylor expanded in x around 0 48.8%
associate--l+48.8%
Simplified48.8%
if 4.9999999999999999e23 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-60.7%
+-commutative60.7%
associate--l+60.7%
+-commutative60.7%
Simplified43.2%
Taylor expanded in t around inf 34.8%
+-commutative34.8%
+-commutative34.8%
associate--l+35.3%
Simplified35.3%
Taylor expanded in z around inf 22.2%
+-commutative22.2%
Simplified22.2%
Taylor expanded in y around inf 22.0%
flip--22.2%
add-sqr-sqrt22.5%
add-sqr-sqrt22.2%
associate-+r-26.5%
+-inverses26.5%
metadata-eval26.5%
+-commutative26.5%
Applied egg-rr26.5%
Final simplification44.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.4e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 2e+23)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 2e+23) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.4d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 2d+23) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((1.0d0 + x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 2e+23) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((1.0 + x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.4e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 2e+23: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((1.0 + x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.4e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 2e+23) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(1.0 + x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.4e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 2e+23)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (sqrt(x) + sqrt((1.0 + x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.4e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2e+23], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+23}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{1 + x}}\\
\end{array}
\end{array}
if y < 1.39999999999999994e-30Initial program 99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+r-50.9%
associate-+l-43.4%
+-commutative43.4%
associate--l+43.4%
+-commutative43.4%
Simplified29.4%
Taylor expanded in t around inf 27.0%
+-commutative27.0%
+-commutative27.0%
associate--l+27.4%
Simplified27.4%
Taylor expanded in y around 0 20.3%
associate--r+19.8%
associate--l+27.4%
rem-square-sqrt27.4%
hypot-1-def27.4%
Simplified27.4%
Taylor expanded in x around 0 35.8%
associate--l+62.1%
Simplified62.1%
if 1.39999999999999994e-30 < y < 1.9999999999999998e23Initial program 90.4%
associate-+l+90.4%
+-commutative90.4%
associate-+r-69.3%
associate-+l-61.4%
+-commutative61.4%
associate--l+61.4%
+-commutative61.4%
Simplified40.1%
Taylor expanded in t around inf 32.2%
+-commutative32.2%
+-commutative32.2%
associate--l+34.1%
Simplified34.1%
Taylor expanded in z around inf 25.5%
+-commutative25.5%
Simplified25.5%
Taylor expanded in x around 0 43.2%
associate--l+43.2%
Simplified43.2%
if 1.9999999999999998e23 < y Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-87.4%
associate-+l-60.9%
+-commutative60.9%
associate--l+60.9%
+-commutative60.9%
Simplified43.5%
Taylor expanded in t around inf 34.7%
+-commutative34.7%
+-commutative34.7%
associate--l+35.2%
Simplified35.2%
Taylor expanded in z around inf 22.1%
+-commutative22.1%
Simplified22.1%
Taylor expanded in y around inf 22.0%
flip--22.1%
add-sqr-sqrt22.4%
add-sqr-sqrt22.1%
associate-+r-26.4%
+-inverses26.4%
metadata-eval26.4%
+-commutative26.4%
Applied egg-rr26.4%
Final simplification44.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 195000000.0) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 195000000.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 195000000.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 195000000.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 195000000.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 195000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 195000000.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 195000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 195000000:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.95e8Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-75.5%
associate-+l-57.9%
+-commutative57.9%
associate--l+57.9%
+-commutative57.9%
Simplified55.1%
Taylor expanded in t around inf 33.2%
+-commutative33.2%
+-commutative33.2%
associate--l+33.2%
Simplified33.2%
Taylor expanded in y around 0 37.3%
associate--r+37.3%
associate--l+37.3%
rem-square-sqrt37.3%
hypot-1-def37.3%
Simplified37.3%
Taylor expanded in x around 0 53.5%
associate--l+53.5%
Simplified53.5%
if 1.95e8 < z Initial program 87.5%
associate-+l+87.5%
+-commutative87.5%
associate-+r-62.4%
associate-+l-48.0%
+-commutative48.0%
associate--l+48.0%
+-commutative48.0%
Simplified16.9%
Taylor expanded in t around inf 28.6%
+-commutative28.6%
+-commutative28.6%
associate--l+29.8%
Simplified29.8%
Taylor expanded in z around inf 29.4%
+-commutative29.4%
Simplified29.4%
Taylor expanded in x around 0 37.6%
associate--l+59.0%
Simplified59.0%
Final simplification56.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 195000000.0) (- (+ (sqrt (+ 1.0 z)) 2.0) (sqrt z)) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 195000000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - sqrt(z);
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 195000000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - sqrt(z)
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 195000000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - Math.sqrt(z);
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 195000000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - math.sqrt(z) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 195000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - sqrt(z)); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 195000000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - sqrt(z);
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 195000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 195000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.95e8Initial program 97.9%
associate-+l+97.9%
+-commutative97.9%
associate-+r-75.5%
associate-+l-57.9%
+-commutative57.9%
associate--l+57.9%
+-commutative57.9%
Simplified55.1%
Taylor expanded in t around inf 33.2%
+-commutative33.2%
+-commutative33.2%
associate--l+33.2%
Simplified33.2%
Taylor expanded in y around 0 37.3%
associate--r+37.3%
associate--l+37.3%
rem-square-sqrt37.3%
hypot-1-def37.3%
Simplified37.3%
Taylor expanded in x around 0 53.5%
if 1.95e8 < z Initial program 87.5%
associate-+l+87.5%
+-commutative87.5%
associate-+r-62.4%
associate-+l-48.0%
+-commutative48.0%
associate--l+48.0%
+-commutative48.0%
Simplified16.9%
Taylor expanded in t around inf 28.6%
+-commutative28.6%
+-commutative28.6%
associate--l+29.8%
Simplified29.8%
Taylor expanded in z around inf 29.4%
+-commutative29.4%
Simplified29.4%
Taylor expanded in x around 0 37.6%
associate--l+59.0%
Simplified59.0%
Final simplification56.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - 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 = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - 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[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 92.9%
associate-+l+92.9%
+-commutative92.9%
associate-+r-69.3%
associate-+l-53.1%
+-commutative53.1%
associate--l+53.1%
+-commutative53.1%
Simplified36.9%
Taylor expanded in t around inf 31.0%
+-commutative31.0%
+-commutative31.0%
associate--l+31.6%
Simplified31.6%
Taylor expanded in z around inf 20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in x around 0 28.4%
associate--l+43.1%
Simplified43.1%
Final simplification43.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 (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - 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((1.0d0 + x)) - 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((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - 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[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 92.9%
associate-+l+92.9%
+-commutative92.9%
associate-+r-69.3%
associate-+l-53.1%
+-commutative53.1%
associate--l+53.1%
+-commutative53.1%
Simplified36.9%
Taylor expanded in t around inf 31.0%
+-commutative31.0%
+-commutative31.0%
associate--l+31.6%
Simplified31.6%
Taylor expanded in z around inf 20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in y around inf 15.5%
Final simplification15.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
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 92.9%
associate-+l+92.9%
+-commutative92.9%
associate-+r-69.3%
associate-+l-53.1%
+-commutative53.1%
associate--l+53.1%
+-commutative53.1%
Simplified36.9%
Taylor expanded in t around inf 31.0%
+-commutative31.0%
+-commutative31.0%
associate--l+31.6%
Simplified31.6%
Taylor expanded in z around inf 20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in y around inf 15.5%
Taylor expanded in x around 0 32.6%
Final simplification32.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 2023242
(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))))