
(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 z))) (t_3 (sqrt (+ 1.0 x))))
(if (<= (- t_2 (sqrt z)) 0.99998)
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ t_3 (sqrt x))))
(/ 1.0 (+ t_2 (sqrt z))))
(+
t_1
(-
(+ t_2 (- (- t_3 (sqrt x)) (sqrt z)))
(+ (sqrt y) (/ -1.0 (+ (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 + z));
double t_3 = sqrt((1.0 + x));
double tmp;
if ((t_2 - sqrt(z)) <= 0.99998) {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_3 + sqrt(x)))) + (1.0 / (t_2 + sqrt(z)));
} else {
tmp = t_1 + ((t_2 + ((t_3 - sqrt(x)) - sqrt(z))) - (sqrt(y) + (-1.0 / (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) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + x))
if ((t_2 - sqrt(z)) <= 0.99998d0) then
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (t_3 + sqrt(x)))) + (1.0d0 / (t_2 + sqrt(z)))
else
tmp = t_1 + ((t_2 + ((t_3 - sqrt(x)) - sqrt(z))) - (sqrt(y) + ((-1.0d0) / (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 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + x));
double tmp;
if ((t_2 - Math.sqrt(z)) <= 0.99998) {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (t_3 + Math.sqrt(x)))) + (1.0 / (t_2 + Math.sqrt(z)));
} else {
tmp = t_1 + ((t_2 + ((t_3 - Math.sqrt(x)) - Math.sqrt(z))) - (Math.sqrt(y) + (-1.0 / (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 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + x)) tmp = 0 if (t_2 - math.sqrt(z)) <= 0.99998: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (t_3 + math.sqrt(x)))) + (1.0 / (t_2 + math.sqrt(z))) else: tmp = t_1 + ((t_2 + ((t_3 - math.sqrt(x)) - math.sqrt(z))) - (math.sqrt(y) + (-1.0 / (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 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_2 - sqrt(z)) <= 0.99998) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(t_3 + sqrt(x)))) + Float64(1.0 / Float64(t_2 + sqrt(z)))); else tmp = Float64(t_1 + Float64(Float64(t_2 + Float64(Float64(t_3 - sqrt(x)) - sqrt(z))) - Float64(sqrt(y) + Float64(-1.0 / 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 + y));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + x));
tmp = 0.0;
if ((t_2 - sqrt(z)) <= 0.99998)
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_3 + sqrt(x)))) + (1.0 / (t_2 + sqrt(z)));
else
tmp = t_1 + ((t_2 + ((t_3 - sqrt(x)) - sqrt(z))) - (sqrt(y) + (-1.0 / (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 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.99998], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(t$95$2 + N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + x}\\
\mathbf{if}\;t\_2 - \sqrt{z} \leq 0.99998:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{t\_3 + \sqrt{x}}\right) + \frac{1}{t\_2 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(t\_2 + \left(\left(t\_3 - \sqrt{x}\right) - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{1 + t} + \sqrt{t}}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.99997999999999998Initial program 89.3%
associate-+l+89.3%
sub-neg89.3%
sub-neg89.3%
+-commutative89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
flip--89.3%
add-sqr-sqrt69.4%
+-commutative69.4%
add-sqr-sqrt89.8%
+-commutative89.8%
Applied egg-rr89.8%
associate--l+91.5%
+-inverses91.5%
metadata-eval91.5%
Simplified91.5%
flip--91.5%
add-sqr-sqrt77.1%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate--l+92.9%
+-inverses92.9%
metadata-eval92.9%
Simplified92.9%
flip--93.2%
add-sqr-sqrt52.2%
add-sqr-sqrt93.8%
Applied egg-rr93.8%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t around inf 51.5%
if 0.99997999999999998 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 98.3%
+-commutative98.3%
associate-+r+98.3%
associate-+r-84.3%
associate-+l-73.7%
associate-+r-61.2%
Simplified61.1%
flip--61.1%
add-sqr-sqrt45.5%
add-sqr-sqrt61.2%
+-commutative61.2%
+-commutative61.2%
Applied egg-rr61.2%
associate--r+61.3%
+-inverses61.3%
metadata-eval61.3%
+-commutative61.3%
Simplified61.3%
Final simplification55.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))) (t_2 (sqrt (+ 1.0 z))) (t_3 (sqrt (+ 1.0 x))))
(if (<= (- t_2 (sqrt z)) 0.95)
(+
(+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ t_3 (sqrt x))))
(/ 1.0 (+ t_2 (sqrt z))))
(+
t_1
(+
(+ t_3 t_2)
(-
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (sqrt y))
(+ (sqrt x) (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + x));
double tmp;
if ((t_2 - sqrt(z)) <= 0.95) {
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_3 + sqrt(x)))) + (1.0 / (t_2 + sqrt(z)));
} else {
tmp = t_1 + ((t_3 + t_2) + (((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y)) - (sqrt(x) + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + x))
if ((t_2 - sqrt(z)) <= 0.95d0) then
tmp = ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (t_3 + sqrt(x)))) + (1.0d0 / (t_2 + sqrt(z)))
else
tmp = t_1 + ((t_3 + t_2) + (((sqrt((1.0d0 + t)) - sqrt(t)) - sqrt(y)) - (sqrt(x) + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + x));
double tmp;
if ((t_2 - Math.sqrt(z)) <= 0.95) {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (t_3 + Math.sqrt(x)))) + (1.0 / (t_2 + Math.sqrt(z)));
} else {
tmp = t_1 + ((t_3 + t_2) + (((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - Math.sqrt(y)) - (Math.sqrt(x) + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + x)) tmp = 0 if (t_2 - math.sqrt(z)) <= 0.95: tmp = ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (t_3 + math.sqrt(x)))) + (1.0 / (t_2 + math.sqrt(z))) else: tmp = t_1 + ((t_3 + t_2) + (((math.sqrt((1.0 + t)) - math.sqrt(t)) - math.sqrt(y)) - (math.sqrt(x) + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_2 - sqrt(z)) <= 0.95) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(t_3 + sqrt(x)))) + Float64(1.0 / Float64(t_2 + sqrt(z)))); else tmp = Float64(t_1 + Float64(Float64(t_3 + t_2) + Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - sqrt(y)) - Float64(sqrt(x) + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + x));
tmp = 0.0;
if ((t_2 - sqrt(z)) <= 0.95)
tmp = ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_3 + sqrt(x)))) + (1.0 / (t_2 + sqrt(z)));
else
tmp = t_1 + ((t_3 + t_2) + (((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y)) - (sqrt(x) + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.95], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(t$95$3 + t$95$2), $MachinePrecision] + N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + x}\\
\mathbf{if}\;t\_2 - \sqrt{z} \leq 0.95:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{t\_3 + \sqrt{x}}\right) + \frac{1}{t\_2 + \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(t\_3 + t\_2\right) + \left(\left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right) - \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.94999999999999996Initial program 89.3%
associate-+l+89.3%
sub-neg89.3%
sub-neg89.3%
+-commutative89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
flip--89.3%
add-sqr-sqrt69.4%
+-commutative69.4%
add-sqr-sqrt89.8%
+-commutative89.8%
Applied egg-rr89.8%
associate--l+91.5%
+-inverses91.5%
metadata-eval91.5%
Simplified91.5%
flip--91.5%
add-sqr-sqrt77.1%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate--l+92.9%
+-inverses92.9%
metadata-eval92.9%
Simplified92.9%
flip--93.2%
add-sqr-sqrt52.2%
add-sqr-sqrt93.8%
Applied egg-rr93.8%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t around inf 51.5%
if 0.94999999999999996 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 98.3%
+-commutative98.3%
associate-+r+98.3%
associate-+r-84.3%
associate-+l-73.7%
associate-+r-61.2%
Simplified61.1%
associate-+r-61.2%
associate--l-60.8%
+-commutative60.8%
+-commutative60.8%
+-commutative60.8%
Applied egg-rr60.8%
associate--l+60.8%
associate-+r-40.3%
+-commutative40.3%
+-commutative40.3%
+-commutative40.3%
Applied egg-rr40.3%
associate--l-40.3%
Simplified40.3%
Final simplification46.4%
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))) (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (1.0 / (sqrt((1.0 + x)) + sqrt(x)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
}
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))) + (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))))
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))) + (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))));
}
[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))) + (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x)))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))))) 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))) + (1.0 / (sqrt((1.0 + x)) + sqrt(x)))) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (sqrt((1.0 + z)) + sqrt(z))));
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[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{\sqrt{1 + z} + \sqrt{z}}\right)
\end{array}
Initial program 93.4%
associate-+l+93.4%
sub-neg93.4%
sub-neg93.4%
+-commutative93.4%
+-commutative93.4%
+-commutative93.4%
Simplified93.4%
flip--93.5%
add-sqr-sqrt73.9%
+-commutative73.9%
add-sqr-sqrt94.0%
+-commutative94.0%
Applied egg-rr94.0%
associate--l+95.0%
+-inverses95.0%
metadata-eval95.0%
Simplified95.0%
flip--95.1%
add-sqr-sqrt78.3%
add-sqr-sqrt95.3%
Applied egg-rr95.3%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
Simplified96.0%
flip--96.2%
add-sqr-sqrt73.8%
add-sqr-sqrt96.5%
Applied egg-rr96.5%
associate--l+98.1%
+-inverses98.1%
metadata-eval98.1%
Simplified98.1%
Final simplification98.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 z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 2.8e-15)
(+
(+ 1.0 (- t_2 (sqrt y)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- t_1 (sqrt z))))
(+
(+ (/ 1.0 (+ t_2 (sqrt y))) (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))
(/ 1.0 (+ t_1 (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 2.8e-15) {
tmp = (1.0 + (t_2 - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z)));
} else {
tmp = ((1.0 / (t_2 + sqrt(y))) + (1.0 / (sqrt((1.0 + x)) + sqrt(x)))) + (1.0 / (t_1 + sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((1.0d0 + y))
if (z <= 2.8d-15) then
tmp = (1.0d0 + (t_2 - sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (t_1 - sqrt(z)))
else
tmp = ((1.0d0 / (t_2 + sqrt(y))) + (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x)))) + (1.0d0 / (t_1 + sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 2.8e-15) {
tmp = (1.0 + (t_2 - Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (t_1 - Math.sqrt(z)));
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(y))) + (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x)))) + (1.0 / (t_1 + Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 2.8e-15: tmp = (1.0 + (t_2 - math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (t_1 - math.sqrt(z))) else: tmp = ((1.0 / (t_2 + math.sqrt(y))) + (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)))) + (1.0 / (t_1 + math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 2.8e-15) tmp = Float64(Float64(1.0 + Float64(t_2 - sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(t_1 - sqrt(z)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x)))) + Float64(1.0 / Float64(t_1 + sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 2.8e-15)
tmp = (1.0 + (t_2 - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z)));
else
tmp = ((1.0 / (t_2 + sqrt(y))) + (1.0 / (sqrt((1.0 + x)) + sqrt(x)))) + (1.0 / (t_1 + sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.8e-15], N[(N[(1.0 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 2.8 \cdot 10^{-15}:\\
\;\;\;\;\left(1 + \left(t\_2 - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t\_1 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_2 + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right) + \frac{1}{t\_1 + \sqrt{z}}\\
\end{array}
\end{array}
if z < 2.80000000000000014e-15Initial program 98.3%
associate-+l+98.3%
sub-neg98.3%
sub-neg98.3%
+-commutative98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in x around 0 57.6%
if 2.80000000000000014e-15 < z Initial program 89.3%
associate-+l+89.3%
sub-neg89.3%
sub-neg89.3%
+-commutative89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
flip--89.3%
add-sqr-sqrt69.4%
+-commutative69.4%
add-sqr-sqrt89.8%
+-commutative89.8%
Applied egg-rr89.8%
associate--l+91.5%
+-inverses91.5%
metadata-eval91.5%
Simplified91.5%
flip--91.5%
add-sqr-sqrt77.1%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate--l+92.9%
+-inverses92.9%
metadata-eval92.9%
Simplified92.9%
flip--93.2%
add-sqr-sqrt52.2%
add-sqr-sqrt93.8%
Applied egg-rr93.8%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t around inf 51.5%
Final simplification54.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 65000000000000.0)
(+ (+ 1.0 (- t_2 (sqrt y))) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1))
(+
(+ (/ 1.0 (+ t_2 (sqrt y))) (/ 1.0 (+ (sqrt (+ 1.0 x)) (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 + z)) - sqrt(z);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 65000000000000.0) {
tmp = (1.0 + (t_2 - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + t_1);
} else {
tmp = ((1.0 / (t_2 + sqrt(y))) + (1.0 / (sqrt((1.0 + x)) + 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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + y))
if (z <= 65000000000000.0d0) then
tmp = (1.0d0 + (t_2 - sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1)
else
tmp = ((1.0d0 / (t_2 + sqrt(y))) + (1.0d0 / (sqrt((1.0d0 + x)) + 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 + z)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 65000000000000.0) {
tmp = (1.0 + (t_2 - Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1);
} else {
tmp = ((1.0 / (t_2 + Math.sqrt(y))) + (1.0 / (Math.sqrt((1.0 + x)) + 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 + z)) - math.sqrt(z) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 65000000000000.0: tmp = (1.0 + (t_2 - math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) else: tmp = ((1.0 / (t_2 + math.sqrt(y))) + (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)))) + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 65000000000000.0) tmp = Float64(Float64(1.0 + Float64(t_2 - sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1)); else tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 + z)) - sqrt(z);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 65000000000000.0)
tmp = (1.0 + (t_2 - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + t_1);
else
tmp = ((1.0 / (t_2 + sqrt(y))) + (1.0 / (sqrt((1.0 + x)) + 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[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 65000000000000.0], N[(N[(1.0 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 65000000000000:\\
\;\;\;\;\left(1 + \left(t\_2 - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_2 + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right) + t\_1\\
\end{array}
\end{array}
if z < 6.5e13Initial program 97.3%
associate-+l+97.3%
sub-neg97.3%
sub-neg97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 56.4%
if 6.5e13 < z Initial program 89.9%
associate-+l+89.9%
sub-neg89.9%
sub-neg89.9%
+-commutative89.9%
+-commutative89.9%
+-commutative89.9%
Simplified89.9%
flip--89.9%
add-sqr-sqrt70.2%
+-commutative70.2%
add-sqr-sqrt90.3%
+-commutative90.3%
Applied egg-rr90.3%
associate--l+92.0%
+-inverses92.0%
metadata-eval92.0%
Simplified92.0%
flip--92.0%
add-sqr-sqrt77.7%
add-sqr-sqrt92.1%
Applied egg-rr92.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
Simplified93.3%
Taylor expanded in t around inf 49.5%
Final simplification52.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 2.7e+20)
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.7e+20) {
tmp = (1.0 + (sqrt((1.0 + y)) - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.7d+20) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.7e+20) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.7e+20: tmp = (1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.7e+20) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.7e+20)
tmp = (1.0 + (sqrt((1.0 + y)) - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.7e+20], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{+20}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.7e20Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 59.5%
if 2.7e20 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.4%
associate-+r-47.4%
associate-+l-17.6%
associate-+r-3.2%
Simplified3.2%
Taylor expanded in t around inf 3.2%
associate--l+21.9%
associate--l+18.7%
+-commutative18.7%
associate-+r+18.7%
Simplified18.7%
Taylor expanded in z around inf 21.8%
Taylor expanded in y around inf 22.1%
flip--22.1%
add-sqr-sqrt22.5%
add-sqr-sqrt22.3%
Applied egg-rr22.3%
associate--l+25.6%
+-inverses25.6%
metadata-eval25.6%
+-commutative25.6%
Simplified25.6%
Final simplification45.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 z)) (sqrt z)))
(t_2 (- (sqrt (+ 1.0 y)) (sqrt y))))
(if (<= z 1.5e+19)
(+ (+ 1.0 t_2) (+ (- (sqrt (+ 1.0 t)) (sqrt t)) t_1))
(+ t_1 (+ t_2 (/ 1.0 (+ (sqrt (+ 1.0 x)) (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)) - sqrt(z);
double t_2 = sqrt((1.0 + y)) - sqrt(y);
double tmp;
if (z <= 1.5e+19) {
tmp = (1.0 + t_2) + ((sqrt((1.0 + t)) - sqrt(t)) + t_1);
} else {
tmp = t_1 + (t_2 + (1.0 / (sqrt((1.0 + x)) + 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 + z)) - sqrt(z)
t_2 = sqrt((1.0d0 + y)) - sqrt(y)
if (z <= 1.5d+19) then
tmp = (1.0d0 + t_2) + ((sqrt((1.0d0 + t)) - sqrt(t)) + t_1)
else
tmp = t_1 + (t_2 + (1.0d0 / (sqrt((1.0d0 + x)) + 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)) - Math.sqrt(z);
double t_2 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double tmp;
if (z <= 1.5e+19) {
tmp = (1.0 + t_2) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + t_1);
} else {
tmp = t_1 + (t_2 + (1.0 / (Math.sqrt((1.0 + x)) + 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)) - math.sqrt(z) t_2 = math.sqrt((1.0 + y)) - math.sqrt(y) tmp = 0 if z <= 1.5e+19: tmp = (1.0 + t_2) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + t_1) else: tmp = t_1 + (t_2 + (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_2 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) tmp = 0.0 if (z <= 1.5e+19) tmp = Float64(Float64(1.0 + t_2) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + t_1)); else tmp = Float64(t_1 + Float64(t_2 + Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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)) - sqrt(z);
t_2 = sqrt((1.0 + y)) - sqrt(y);
tmp = 0.0;
if (z <= 1.5e+19)
tmp = (1.0 + t_2) + ((sqrt((1.0 + t)) - sqrt(t)) + t_1);
else
tmp = t_1 + (t_2 + (1.0 / (sqrt((1.0 + x)) + sqrt(x))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.5e+19], N[(N[(1.0 + t$95$2), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 + N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;z \leq 1.5 \cdot 10^{+19}:\\
\;\;\;\;\left(1 + t\_2\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\\
\end{array}
\end{array}
if z < 1.5e19Initial program 96.8%
associate-+l+96.8%
sub-neg96.8%
sub-neg96.8%
+-commutative96.8%
+-commutative96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in x around 0 56.2%
if 1.5e19 < z Initial program 90.2%
associate-+l+90.2%
sub-neg90.2%
sub-neg90.2%
+-commutative90.2%
+-commutative90.2%
+-commutative90.2%
Simplified90.2%
flip--90.2%
add-sqr-sqrt70.8%
+-commutative70.8%
add-sqr-sqrt90.6%
+-commutative90.6%
Applied egg-rr90.6%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
Simplified92.4%
Taylor expanded in t around inf 48.6%
Final simplification52.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 7e-31)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 5e+14)
(+ t_1 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 7e-31) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 5e+14) {
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 7d-31) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 5d+14) then
tmp = t_1 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 7e-31) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 5e+14) {
tmp = t_1 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 7e-31: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 5e+14: tmp = t_1 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 7e-31) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 5e+14) tmp = Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / 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((1.0 + x));
tmp = 0.0;
if (y <= 7e-31)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 5e+14)
tmp = t_1 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7e-31], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 5e+14], N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 7 \cdot 10^{-31}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t\_1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 6.99999999999999971e-31Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 6.99999999999999971e-31 < y < 5e14Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-96.8%
associate-+l-96.8%
associate-+r-97.0%
Simplified67.2%
Taylor expanded in t around inf 18.5%
associate--l+26.0%
associate--l+29.0%
+-commutative29.0%
associate-+r+29.0%
Simplified29.0%
Taylor expanded in z around inf 37.8%
if 5e14 < y Initial program 87.1%
+-commutative87.1%
associate-+r+87.1%
associate-+r-47.4%
associate-+l-18.3%
associate-+r-4.2%
Simplified4.2%
Taylor expanded in t around inf 3.3%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.4%
Taylor expanded in y around inf 21.7%
flip--21.7%
add-sqr-sqrt22.0%
add-sqr-sqrt21.8%
Applied egg-rr21.8%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.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
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 4.8e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 4.5e+15)
(- (+ t_1 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 4.8e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 4.5e+15) {
tmp = (t_1 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 4.8d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 4.5d+15) then
tmp = (t_1 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 4.8e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 4.5e+15) {
tmp = (t_1 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 4.8e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 4.5e+15: tmp = (t_1 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 4.8e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 4.5e+15) tmp = Float64(Float64(t_1 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 / 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((1.0 + x));
tmp = 0.0;
if (y <= 4.8e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 4.5e+15)
tmp = (t_1 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.8e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(N[(t$95$1 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;\left(t\_1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.7999999999999997e-30Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 4.7999999999999997e-30 < y < 4.5e15Initial program 95.5%
+-commutative95.5%
associate-+r+95.5%
associate-+r-95.1%
associate-+l-95.1%
associate-+r-95.4%
Simplified67.0%
Taylor expanded in t around inf 18.6%
associate--l+25.7%
associate--l+28.5%
+-commutative28.5%
associate-+r+28.5%
Simplified28.5%
Taylor expanded in z around inf 36.8%
if 4.5e15 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-47.2%
associate-+l-17.9%
associate-+r-3.6%
Simplified3.6%
Taylor expanded in t around inf 3.2%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.5%
Taylor expanded in y around inf 21.8%
flip--21.7%
add-sqr-sqrt22.1%
add-sqr-sqrt21.9%
Applied egg-rr21.9%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.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
(let* ((t_1 (sqrt (+ 1.0 x))))
(if (<= y 4.8e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 5e+15)
(- (- (+ t_1 (sqrt (+ 1.0 y))) (sqrt y)) (sqrt x))
(/ 1.0 (+ 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((1.0 + x));
double tmp;
if (y <= 4.8e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 5e+15) {
tmp = ((t_1 + sqrt((1.0 + y))) - sqrt(y)) - sqrt(x);
} else {
tmp = 1.0 / (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((1.0d0 + x))
if (y <= 4.8d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 5d+15) then
tmp = ((t_1 + sqrt((1.0d0 + y))) - sqrt(y)) - sqrt(x)
else
tmp = 1.0d0 / (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((1.0 + x));
double tmp;
if (y <= 4.8e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 5e+15) {
tmp = ((t_1 + Math.sqrt((1.0 + y))) - Math.sqrt(y)) - Math.sqrt(x);
} else {
tmp = 1.0 / (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((1.0 + x)) tmp = 0 if y <= 4.8e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 5e+15: tmp = ((t_1 + math.sqrt((1.0 + y))) - math.sqrt(y)) - math.sqrt(x) else: tmp = 1.0 / (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(1.0 + x)) tmp = 0.0 if (y <= 4.8e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 5e+15) tmp = Float64(Float64(Float64(t_1 + sqrt(Float64(1.0 + y))) - sqrt(y)) - sqrt(x)); else tmp = Float64(1.0 / 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((1.0 + x));
tmp = 0.0;
if (y <= 4.8e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 5e+15)
tmp = ((t_1 + sqrt((1.0 + y))) - sqrt(y)) - sqrt(x);
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.8e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 5e+15], N[(N[(N[(t$95$1 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(t\_1 + \sqrt{1 + y}\right) - \sqrt{y}\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.7999999999999997e-30Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 4.7999999999999997e-30 < y < 5e15Initial program 95.5%
+-commutative95.5%
associate-+r+95.5%
associate-+r-95.1%
associate-+l-95.1%
associate-+r-95.4%
Simplified67.0%
Taylor expanded in t around inf 18.6%
associate--l+25.7%
associate--l+28.5%
+-commutative28.5%
associate-+r+28.5%
Simplified28.5%
Taylor expanded in z around inf 36.8%
expm1-log1p-u31.3%
associate--r+31.3%
Applied egg-rr31.3%
expm1-log1p-u36.8%
associate--l-36.8%
+-commutative36.8%
associate--l+36.8%
associate--r+36.8%
Applied egg-rr36.8%
if 5e15 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-47.2%
associate-+l-17.9%
associate-+r-3.6%
Simplified3.6%
Taylor expanded in t around inf 3.2%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.5%
Taylor expanded in y around inf 21.8%
flip--21.7%
add-sqr-sqrt22.1%
add-sqr-sqrt21.9%
Applied egg-rr21.9%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.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
(let* ((t_1 (sqrt (+ 1.0 x))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 7e-31)
(+ 1.0 (+ t_2 (- (- (sqrt (+ 1.0 z)) (sqrt y)) (sqrt z))))
(if (<= y 5e+15)
(- (- (+ t_1 t_2) (sqrt y)) (sqrt x))
(/ 1.0 (+ 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((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 7e-31) {
tmp = 1.0 + (t_2 + ((sqrt((1.0 + z)) - sqrt(y)) - sqrt(z)));
} else if (y <= 5e+15) {
tmp = ((t_1 + t_2) - sqrt(y)) - sqrt(x);
} else {
tmp = 1.0 / (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) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + y))
if (y <= 7d-31) then
tmp = 1.0d0 + (t_2 + ((sqrt((1.0d0 + z)) - sqrt(y)) - sqrt(z)))
else if (y <= 5d+15) then
tmp = ((t_1 + t_2) - sqrt(y)) - sqrt(x)
else
tmp = 1.0d0 / (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((1.0 + x));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 7e-31) {
tmp = 1.0 + (t_2 + ((Math.sqrt((1.0 + z)) - Math.sqrt(y)) - Math.sqrt(z)));
} else if (y <= 5e+15) {
tmp = ((t_1 + t_2) - Math.sqrt(y)) - Math.sqrt(x);
} else {
tmp = 1.0 / (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((1.0 + x)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if y <= 7e-31: tmp = 1.0 + (t_2 + ((math.sqrt((1.0 + z)) - math.sqrt(y)) - math.sqrt(z))) elif y <= 5e+15: tmp = ((t_1 + t_2) - math.sqrt(y)) - math.sqrt(x) else: tmp = 1.0 / (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(1.0 + x)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 7e-31) tmp = Float64(1.0 + Float64(t_2 + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(y)) - sqrt(z)))); elseif (y <= 5e+15) tmp = Float64(Float64(Float64(t_1 + t_2) - sqrt(y)) - sqrt(x)); else tmp = Float64(1.0 / 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((1.0 + x));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 7e-31)
tmp = 1.0 + (t_2 + ((sqrt((1.0 + z)) - sqrt(y)) - sqrt(z)));
elseif (y <= 5e+15)
tmp = ((t_1 + t_2) - sqrt(y)) - sqrt(x);
else
tmp = 1.0 / (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[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7e-31], N[(1.0 + N[(t$95$2 + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+15], N[(N[(N[(t$95$1 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 7 \cdot 10^{-31}:\\
\;\;\;\;1 + \left(t\_2 + \left(\left(\sqrt{1 + z} - \sqrt{y}\right) - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+15}:\\
\;\;\;\;\left(\left(t\_1 + t\_2\right) - \sqrt{y}\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 6.99999999999999971e-31Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
associate--l+47.9%
associate--l+57.9%
associate--r+57.9%
Simplified57.9%
if 6.99999999999999971e-31 < y < 5e15Initial program 95.5%
+-commutative95.5%
associate-+r+95.5%
associate-+r-95.1%
associate-+l-95.1%
associate-+r-95.4%
Simplified67.0%
Taylor expanded in t around inf 18.6%
associate--l+25.7%
associate--l+28.5%
+-commutative28.5%
associate-+r+28.5%
Simplified28.5%
Taylor expanded in z around inf 36.8%
expm1-log1p-u31.3%
associate--r+31.3%
Applied egg-rr31.3%
expm1-log1p-u36.8%
associate--l-36.8%
+-commutative36.8%
associate--l+36.8%
associate--r+36.8%
Applied egg-rr36.8%
if 5e15 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-47.2%
associate-+l-17.9%
associate-+r-3.6%
Simplified3.6%
Taylor expanded in t around inf 3.2%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.5%
Taylor expanded in y around inf 21.8%
flip--21.7%
add-sqr-sqrt22.1%
add-sqr-sqrt21.9%
Applied egg-rr21.9%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.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 (if (<= y 2.7e+20) (+ 1.0 (+ (sqrt (+ 1.0 y)) (- (- (sqrt (+ 1.0 z)) (sqrt z)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.7e+20) {
tmp = 1.0 + (sqrt((1.0 + y)) + ((sqrt((1.0 + z)) - sqrt(z)) - sqrt(y)));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.7d+20) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((sqrt((1.0d0 + z)) - sqrt(z)) - sqrt(y)))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.7e+20) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) - Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.7e+20: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) - math.sqrt(y))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.7e+20) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) - sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.7e+20)
tmp = 1.0 + (sqrt((1.0 + y)) + ((sqrt((1.0 + z)) - sqrt(z)) - sqrt(y)));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.7e+20], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{+20}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.7e20Initial program 96.8%
+-commutative96.8%
associate-+r+96.8%
associate-+r-96.7%
associate-+l-96.7%
associate-+r-96.7%
Simplified75.6%
Taylor expanded in t around inf 19.6%
associate--l+24.2%
associate--l+32.1%
+-commutative32.1%
associate-+r+32.1%
Simplified32.1%
Taylor expanded in x around 0 31.5%
add-cbrt-cube31.2%
pow331.2%
associate--l+46.6%
add-sqr-sqrt46.6%
hypot-1-def46.6%
Applied egg-rr46.6%
rem-cbrt-cube46.9%
associate--l+55.4%
hypot-undefine55.4%
metadata-eval55.4%
add-sqr-sqrt55.4%
+-commutative55.4%
Applied egg-rr55.4%
associate--r+57.4%
Simplified57.4%
if 2.7e20 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.4%
associate-+r-47.4%
associate-+l-17.6%
associate-+r-3.2%
Simplified3.2%
Taylor expanded in t around inf 3.2%
associate--l+21.9%
associate--l+18.7%
+-commutative18.7%
associate-+r+18.7%
Simplified18.7%
Taylor expanded in z around inf 21.8%
Taylor expanded in y around inf 22.1%
flip--22.1%
add-sqr-sqrt22.5%
add-sqr-sqrt22.3%
Applied egg-rr22.3%
associate--l+25.6%
+-inverses25.6%
metadata-eval25.6%
+-commutative25.6%
Simplified25.6%
Final simplification44.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 4.8e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 4.5e+15)
(- (+ 1.0 (+ (sqrt (+ 1.0 y)) (* x 0.5))) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 4.5e+15) {
tmp = (1.0 + (sqrt((1.0 + y)) + (x * 0.5))) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + 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 <= 4.8d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 4.5d+15) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) + (x * 0.5d0))) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 <= 4.8e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 4.5e+15) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) + (x * 0.5))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 4.8e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 4.5e+15: tmp = (1.0 + (math.sqrt((1.0 + y)) + (x * 0.5))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + 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 <= 4.8e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 4.5e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(x * 0.5))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 <= 4.8e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 4.5e+15)
tmp = (1.0 + (sqrt((1.0 + y)) + (x * 0.5))) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 / (sqrt((1.0 + x)) + 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, 4.8e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} + x \cdot 0.5\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.7999999999999997e-30Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 4.7999999999999997e-30 < y < 4.5e15Initial program 95.5%
+-commutative95.5%
associate-+r+95.5%
associate-+r-95.1%
associate-+l-95.1%
associate-+r-95.4%
Simplified67.0%
Taylor expanded in t around inf 18.6%
associate--l+25.7%
associate--l+28.5%
+-commutative28.5%
associate-+r+28.5%
Simplified28.5%
Taylor expanded in z around inf 36.8%
associate-+r-36.8%
+-commutative36.8%
Applied egg-rr36.8%
Taylor expanded in x around 0 34.3%
*-commutative34.3%
Simplified34.3%
if 4.5e15 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-47.2%
associate-+l-17.9%
associate-+r-3.6%
Simplified3.6%
Taylor expanded in t around inf 3.2%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.5%
Taylor expanded in y around inf 21.8%
flip--21.7%
add-sqr-sqrt22.1%
add-sqr-sqrt21.9%
Applied egg-rr21.9%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.2%
Final simplification42.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 4.8e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 5e+14)
(- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 5e+14) {
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + 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 <= 4.8d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 5d+14) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 <= 4.8e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 5e+14) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 4.8e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 5e+14: tmp = (1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + 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 <= 4.8e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 5e+14) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 <= 4.8e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 5e+14)
tmp = (1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y));
else
tmp = 1.0 / (sqrt((1.0 + x)) + 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, 4.8e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 5e+14], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.7999999999999997e-30Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 4.7999999999999997e-30 < y < 5e14Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-96.8%
associate-+l-96.8%
associate-+r-97.0%
Simplified67.2%
Taylor expanded in t around inf 18.5%
associate--l+26.0%
associate--l+29.0%
+-commutative29.0%
associate-+r+29.0%
Simplified29.0%
Taylor expanded in z around inf 37.8%
associate-+r-37.8%
+-commutative37.8%
Applied egg-rr37.8%
Taylor expanded in x around 0 31.2%
if 5e14 < y Initial program 87.1%
+-commutative87.1%
associate-+r+87.1%
associate-+r-47.4%
associate-+l-18.3%
associate-+r-4.2%
Simplified4.2%
Taylor expanded in t around inf 3.3%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.4%
Taylor expanded in y around inf 21.7%
flip--21.7%
add-sqr-sqrt22.0%
add-sqr-sqrt21.8%
Applied egg-rr21.8%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.2%
Final simplification42.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 4.8e-30)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 4.5e+15)
(- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e-30) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 4.5e+15) {
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + 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 <= 4.8d-30) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 4.5d+15) then
tmp = (1.0d0 + sqrt((1.0d0 + y))) - sqrt(y)
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + 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 <= 4.8e-30) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 4.5e+15) {
tmp = (1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y);
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 4.8e-30: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 4.5e+15: tmp = (1.0 + math.sqrt((1.0 + y))) - math.sqrt(y) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + 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 <= 4.8e-30) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 4.5e+15) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y)); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + 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 <= 4.8e-30)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 4.5e+15)
tmp = (1.0 + sqrt((1.0 + y))) - sqrt(y);
else
tmp = 1.0 / (sqrt((1.0 + x)) + 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, 4.8e-30], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 4.5e+15], N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.7999999999999997e-30Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 4.7999999999999997e-30 < y < 4.5e15Initial program 95.5%
+-commutative95.5%
associate-+r+95.5%
associate-+r-95.1%
associate-+l-95.1%
associate-+r-95.4%
Simplified67.0%
Taylor expanded in t around inf 18.6%
associate--l+25.7%
associate--l+28.5%
+-commutative28.5%
associate-+r+28.5%
Simplified28.5%
Taylor expanded in z around inf 36.8%
Taylor expanded in x around 0 48.5%
if 4.5e15 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-47.2%
associate-+l-17.9%
associate-+r-3.6%
Simplified3.6%
Taylor expanded in t around inf 3.2%
associate--l+21.6%
associate--l+18.4%
+-commutative18.4%
associate-+r+18.4%
Simplified18.4%
Taylor expanded in z around inf 21.5%
Taylor expanded in y around inf 21.8%
flip--21.7%
add-sqr-sqrt22.1%
add-sqr-sqrt21.9%
Applied egg-rr21.9%
associate--l+25.2%
+-inverses25.2%
metadata-eval25.2%
+-commutative25.2%
Simplified25.2%
Final simplification43.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 4.8e-30) (+ (- (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 (y <= 4.8e-30) {
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 (y <= 4.8d-30) 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 (y <= 4.8e-30) {
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 y <= 4.8e-30: 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 (y <= 4.8e-30) 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 (y <= 4.8e-30)
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[y, 4.8e-30], 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}\;y \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 4.7999999999999997e-30Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-97.9%
associate-+l-97.9%
associate-+r-97.9%
Simplified77.6%
Taylor expanded in t around inf 20.0%
associate--l+24.3%
associate--l+33.1%
+-commutative33.1%
associate-+r+33.1%
Simplified33.1%
Taylor expanded in x around 0 32.1%
Taylor expanded in y around 0 32.1%
associate--l+57.9%
Simplified57.9%
if 4.7999999999999997e-30 < y Initial program 88.6%
+-commutative88.6%
associate-+r+88.6%
associate-+r-54.9%
associate-+l-30.3%
associate-+r-18.3%
Simplified13.8%
Taylor expanded in t around inf 5.6%
associate--l+22.2%
associate--l+20.0%
+-commutative20.0%
associate-+r+20.0%
Simplified20.0%
Taylor expanded in z around inf 23.9%
Taylor expanded in x around 0 10.8%
associate--l+47.1%
Simplified47.1%
Final simplification52.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 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 93.4%
+-commutative93.4%
associate-+r+93.4%
associate-+r-76.9%
associate-+l-64.9%
associate-+r-59.0%
Simplified46.4%
Taylor expanded in t around inf 13.0%
associate--l+23.3%
associate--l+26.7%
+-commutative26.7%
associate-+r+26.7%
Simplified26.7%
Taylor expanded in z around inf 23.1%
Taylor expanded in x around 0 29.6%
associate--l+47.3%
Simplified47.3%
Final simplification47.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 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 93.4%
+-commutative93.4%
associate-+r+93.4%
associate-+r-76.9%
associate-+l-64.9%
associate-+r-59.0%
Simplified46.4%
Taylor expanded in t around inf 13.0%
associate--l+23.3%
associate--l+26.7%
+-commutative26.7%
associate-+r+26.7%
Simplified26.7%
Taylor expanded in z around inf 23.1%
Taylor expanded in y around inf 15.6%
Final simplification15.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 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 93.4%
+-commutative93.4%
associate-+r+93.4%
associate-+r-76.9%
associate-+l-64.9%
associate-+r-59.0%
Simplified46.4%
Taylor expanded in t around inf 13.0%
associate--l+23.3%
associate--l+26.7%
+-commutative26.7%
associate-+r+26.7%
Simplified26.7%
Taylor expanded in z around inf 23.1%
Taylor expanded in y around inf 15.6%
Taylor expanded in x around 0 34.9%
Final simplification34.9%
(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 2024040
(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))))