
(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 17 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 (pow (+ (sqrt (+ 1.0 x)) (sqrt x)) -0.5)))
(+
(fma
t_1
t_1
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(- (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 = pow((sqrt((1.0 + x)) + sqrt(x)), -0.5);
return fma(t_1, t_1, ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y))))) + (sqrt((1.0 + t)) - sqrt(t));
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + x)) + sqrt(x)) ^ -0.5 return Float64(fma(t_1, t_1, Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))))) + Float64(sqrt(Float64(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[Power[N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, N[(N[(t$95$1 * t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := {\left(\sqrt{1 + x} + \sqrt{x}\right)}^{-0.5}\\
\mathsf{fma}\left(t_1, t_1, \frac{1}{\sqrt{1 + z} + \sqrt{z}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)
\end{array}
\end{array}
Initial program 91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.2%
add-sqr-sqrt73.2%
+-commutative73.2%
add-sqr-sqrt91.4%
+-commutative91.4%
Applied egg-rr91.4%
associate--l+92.8%
+-inverses92.8%
metadata-eval92.8%
Simplified92.8%
flip--92.8%
add-sqr-sqrt72.2%
add-sqr-sqrt93.1%
Applied egg-rr93.1%
associate--l+94.6%
+-inverses94.6%
metadata-eval94.6%
Simplified94.6%
flip--94.8%
add-sqr-sqrt68.7%
add-sqr-sqrt94.9%
Applied egg-rr94.9%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
inv-pow96.8%
+-commutative96.8%
metadata-eval96.8%
sqrt-pow296.8%
sqr-pow96.8%
fma-def96.8%
Applied egg-rr96.8%
Final simplification96.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 y)))
(t_2 (- t_1 (sqrt y)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_2 0.1)
(+ t_4 (+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ t_3 (sqrt x)))))
(+
t_4
(+ (- t_3 (sqrt x)) (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) 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));
double t_2 = t_1 - sqrt(y);
double t_3 = sqrt((1.0 + x));
double t_4 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_2 <= 0.1) {
tmp = t_4 + ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_3 + sqrt(x))));
} else {
tmp = t_4 + ((t_3 - sqrt(x)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_2));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = t_1 - sqrt(y)
t_3 = sqrt((1.0d0 + x))
t_4 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_2 <= 0.1d0) then
tmp = t_4 + ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (t_3 + sqrt(x))))
else
tmp = t_4 + ((t_3 - sqrt(x)) + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + 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 + y));
double t_2 = t_1 - Math.sqrt(y);
double t_3 = Math.sqrt((1.0 + x));
double t_4 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_2 <= 0.1) {
tmp = t_4 + ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (t_3 + Math.sqrt(x))));
} else {
tmp = t_4 + ((t_3 - Math.sqrt(x)) + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + 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 + y)) t_2 = t_1 - math.sqrt(y) t_3 = math.sqrt((1.0 + x)) t_4 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_2 <= 0.1: tmp = t_4 + ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (t_3 + math.sqrt(x)))) else: tmp = t_4 + ((t_3 - math.sqrt(x)) + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + 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 + y)) t_2 = Float64(t_1 - sqrt(y)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_2 <= 0.1) tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(t_3 + sqrt(x))))); else tmp = Float64(t_4 + Float64(Float64(t_3 - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + 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 + y));
t_2 = t_1 - sqrt(y);
t_3 = sqrt((1.0 + x));
t_4 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_2 <= 0.1)
tmp = t_4 + ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_3 + sqrt(x))));
else
tmp = t_4 + ((t_3 - sqrt(x)) + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 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 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.1], N[(t$95$4 + 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]), $MachinePrecision], N[(t$95$4 + N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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}\\
t_2 := t_1 - \sqrt{y}\\
t_3 := \sqrt{1 + x}\\
t_4 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t_2 \leq 0.1:\\
\;\;\;\;t_4 + \left(\frac{1}{t_1 + \sqrt{y}} + \frac{1}{t_3 + \sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_4 + \left(\left(t_3 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + t_2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) < 0.10000000000000001Initial program 85.7%
associate-+l+85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
flip--85.7%
add-sqr-sqrt67.5%
+-commutative67.5%
add-sqr-sqrt85.7%
+-commutative85.7%
Applied egg-rr85.7%
associate--l+87.8%
+-inverses87.8%
metadata-eval87.8%
Simplified87.8%
flip--87.9%
add-sqr-sqrt48.4%
add-sqr-sqrt88.5%
Applied egg-rr88.5%
associate--l+91.3%
+-inverses91.3%
metadata-eval91.3%
Simplified91.3%
Taylor expanded in z around inf 51.0%
+-commutative51.0%
Simplified51.0%
if 0.10000000000000001 < (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y)) Initial program 97.2%
associate-+l+97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--98.4%
add-sqr-sqrt70.7%
add-sqr-sqrt98.6%
Applied egg-rr97.5%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified97.7%
Final simplification73.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 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= (- t_2 (sqrt x)) 0.9999999999999994)
(+ t_3 (+ t_1 (/ 1.0 (+ t_2 (sqrt x)))))
(+ t_3 (+ 1.0 (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double t_2 = sqrt((1.0 + x));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if ((t_2 - sqrt(x)) <= 0.9999999999999994) {
tmp = t_3 + (t_1 + (1.0 / (t_2 + sqrt(x))));
} else {
tmp = t_3 + (1.0 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 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) :: t_3
real(8) :: tmp
t_1 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
t_2 = sqrt((1.0d0 + x))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if ((t_2 - sqrt(x)) <= 0.9999999999999994d0) then
tmp = t_3 + (t_1 + (1.0d0 / (t_2 + sqrt(x))))
else
tmp = t_3 + (1.0d0 + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + 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 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if ((t_2 - Math.sqrt(x)) <= 0.9999999999999994) {
tmp = t_3 + (t_1 + (1.0 / (t_2 + Math.sqrt(x))));
} else {
tmp = t_3 + (1.0 + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + t_1));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) t_2 = math.sqrt((1.0 + x)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if (t_2 - math.sqrt(x)) <= 0.9999999999999994: tmp = t_3 + (t_1 + (1.0 / (t_2 + math.sqrt(x)))) else: tmp = t_3 + (1.0 + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + t_1)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (Float64(t_2 - sqrt(x)) <= 0.9999999999999994) tmp = Float64(t_3 + Float64(t_1 + Float64(1.0 / Float64(t_2 + sqrt(x))))); else tmp = Float64(t_3 + Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + 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 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
t_2 = sqrt((1.0 + x));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if ((t_2 - sqrt(x)) <= 0.9999999999999994)
tmp = t_3 + (t_1 + (1.0 / (t_2 + sqrt(x))));
else
tmp = t_3 + (1.0 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + 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[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.9999999999999994], N[(t$95$3 + N[(t$95$1 + N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
t_2 := \sqrt{1 + x}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t_2 - \sqrt{x} \leq 0.9999999999999994:\\
\;\;\;\;t_3 + \left(t_1 + \frac{1}{t_2 + \sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 + \left(1 + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + t_1\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.999999999999999445Initial program 86.5%
associate-+l+86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
+-commutative86.5%
Simplified86.5%
flip--86.5%
add-sqr-sqrt54.7%
+-commutative54.7%
add-sqr-sqrt86.9%
+-commutative86.9%
Applied egg-rr86.9%
associate--l+89.4%
+-inverses89.4%
metadata-eval89.4%
Simplified89.4%
flip--89.4%
add-sqr-sqrt68.9%
add-sqr-sqrt89.6%
Applied egg-rr89.6%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in z around inf 54.1%
+-commutative54.1%
Simplified54.1%
if 0.999999999999999445 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
flip--97.3%
add-sqr-sqrt97.3%
+-commutative97.3%
add-sqr-sqrt97.3%
+-commutative97.3%
Applied egg-rr97.3%
associate--l+97.3%
+-inverses97.3%
metadata-eval97.3%
Simplified97.3%
flip--97.3%
add-sqr-sqrt76.4%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
associate--l+97.9%
+-inverses97.9%
metadata-eval97.9%
Simplified97.9%
flip--98.4%
add-sqr-sqrt71.2%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in x around 0 98.8%
+-commutative98.8%
Simplified98.8%
Final simplification73.5%
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 t)) (sqrt t))
(+
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(/ 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) {
return (sqrt((1.0 + t)) - sqrt(t)) + (((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (1.0 / (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 + t)) - sqrt(t)) + (((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + (1.0d0 / (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 + t)) - Math.sqrt(t)) + (((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (1.0 / (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 + t)) - math.sqrt(t)) + (((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (1.0 / (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(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(1.0 / 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 + t)) - sqrt(t)) + (((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (1.0 / (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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $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]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)
\end{array}
Initial program 91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.2%
add-sqr-sqrt73.2%
+-commutative73.2%
add-sqr-sqrt91.4%
+-commutative91.4%
Applied egg-rr91.4%
associate--l+92.8%
+-inverses92.8%
metadata-eval92.8%
Simplified92.8%
flip--92.8%
add-sqr-sqrt72.2%
add-sqr-sqrt93.1%
Applied egg-rr93.1%
associate--l+94.6%
+-inverses94.6%
metadata-eval94.6%
Simplified94.6%
flip--94.8%
add-sqr-sqrt68.7%
add-sqr-sqrt94.9%
Applied egg-rr94.9%
associate--l+96.8%
+-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Final simplification96.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (+ (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (/ 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) {
return (sqrt((1.0 + t)) - sqrt(t)) + (((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (1.0 / (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 + t)) - sqrt(t)) + (((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + (1.0d0 / (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 + t)) - Math.sqrt(t)) + (((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (1.0 / (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 + t)) - math.sqrt(t)) + (((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (1.0 / (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(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(1.0 / 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 + t)) - sqrt(t)) + (((sqrt((1.0 + z)) - sqrt(z)) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (1.0 / (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[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $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]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)
\end{array}
Initial program 91.2%
associate-+l+91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
+-commutative91.2%
Simplified91.2%
flip--91.2%
add-sqr-sqrt73.2%
+-commutative73.2%
add-sqr-sqrt91.4%
+-commutative91.4%
Applied egg-rr91.4%
associate--l+92.8%
+-inverses92.8%
metadata-eval92.8%
Simplified92.8%
flip--92.8%
add-sqr-sqrt72.2%
add-sqr-sqrt93.1%
Applied egg-rr93.1%
associate--l+94.6%
+-inverses94.6%
metadata-eval94.6%
Simplified94.6%
Final simplification94.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 t)) (sqrt t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 5.5e+22)
(+ (+ 1.0 (+ t_2 (- (sqrt (+ 1.0 z)) (sqrt z)))) (- t_1 (sqrt y)))
(+
t_1
(+ (/ 1.0 (+ t_2 (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 t_1 = sqrt((1.0 + t)) - sqrt(t);
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 5.5e+22) {
tmp = (1.0 + (t_2 + (sqrt((1.0 + z)) - sqrt(z)))) + (t_1 - sqrt(y));
} else {
tmp = t_1 + ((1.0 / (t_2 + sqrt(y))) + (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 + t)) - sqrt(t)
t_2 = sqrt((1.0d0 + y))
if (z <= 5.5d+22) then
tmp = (1.0d0 + (t_2 + (sqrt((1.0d0 + z)) - sqrt(z)))) + (t_1 - sqrt(y))
else
tmp = t_1 + ((1.0d0 / (t_2 + sqrt(y))) + (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 + t)) - Math.sqrt(t);
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 5.5e+22) {
tmp = (1.0 + (t_2 + (Math.sqrt((1.0 + z)) - Math.sqrt(z)))) + (t_1 - Math.sqrt(y));
} else {
tmp = t_1 + ((1.0 / (t_2 + Math.sqrt(y))) + (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 + t)) - math.sqrt(t) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 5.5e+22: tmp = (1.0 + (t_2 + (math.sqrt((1.0 + z)) - math.sqrt(z)))) + (t_1 - math.sqrt(y)) else: tmp = t_1 + ((1.0 / (t_2 + math.sqrt(y))) + (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 + t)) - sqrt(t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 5.5e+22) tmp = Float64(Float64(1.0 + Float64(t_2 + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))) + Float64(t_1 - sqrt(y))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + 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 + t)) - sqrt(t);
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 5.5e+22)
tmp = (1.0 + (t_2 + (sqrt((1.0 + z)) - sqrt(z)))) + (t_1 - sqrt(y));
else
tmp = t_1 + ((1.0 / (t_2 + sqrt(y))) + (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 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5.5e+22], N[(N[(1.0 + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + 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]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} - \sqrt{t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 5.5 \cdot 10^{+22}:\\
\;\;\;\;\left(1 + \left(t_2 + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(\frac{1}{t_2 + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\\
\end{array}
\end{array}
if z < 5.50000000000000021e22Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-77.4%
associate-+l-64.7%
associate-+r-49.6%
Simplified49.6%
Taylor expanded in x around 0 28.9%
associate--l+28.9%
associate--l+28.9%
Simplified28.9%
if 5.50000000000000021e22 < z Initial program 86.4%
associate-+l+86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.4%
add-sqr-sqrt69.2%
+-commutative69.2%
add-sqr-sqrt86.5%
+-commutative86.5%
Applied egg-rr86.5%
associate--l+89.2%
+-inverses89.2%
metadata-eval89.2%
Simplified89.2%
flip--89.2%
add-sqr-sqrt71.9%
add-sqr-sqrt89.4%
Applied egg-rr89.4%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in z around inf 92.1%
+-commutative92.1%
Simplified92.1%
Final simplification61.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 t))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 5.5e+22)
(-
(+ 1.0 (+ t_2 (+ (sqrt (+ 1.0 z)) (/ 1.0 (+ t_1 (sqrt t))))))
(+ (sqrt y) (sqrt z)))
(+
(- t_1 (sqrt t))
(+ (/ 1.0 (+ t_2 (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 t_1 = sqrt((1.0 + t));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 5.5e+22) {
tmp = (1.0 + (t_2 + (sqrt((1.0 + z)) + (1.0 / (t_1 + sqrt(t)))))) - (sqrt(y) + sqrt(z));
} else {
tmp = (t_1 - sqrt(t)) + ((1.0 / (t_2 + sqrt(y))) + (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 + t))
t_2 = sqrt((1.0d0 + y))
if (z <= 5.5d+22) then
tmp = (1.0d0 + (t_2 + (sqrt((1.0d0 + z)) + (1.0d0 / (t_1 + sqrt(t)))))) - (sqrt(y) + sqrt(z))
else
tmp = (t_1 - sqrt(t)) + ((1.0d0 / (t_2 + sqrt(y))) + (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 + t));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 5.5e+22) {
tmp = (1.0 + (t_2 + (Math.sqrt((1.0 + z)) + (1.0 / (t_1 + Math.sqrt(t)))))) - (Math.sqrt(y) + Math.sqrt(z));
} else {
tmp = (t_1 - Math.sqrt(t)) + ((1.0 / (t_2 + Math.sqrt(y))) + (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 + t)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 5.5e+22: tmp = (1.0 + (t_2 + (math.sqrt((1.0 + z)) + (1.0 / (t_1 + math.sqrt(t)))))) - (math.sqrt(y) + math.sqrt(z)) else: tmp = (t_1 - math.sqrt(t)) + ((1.0 / (t_2 + math.sqrt(y))) + (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 = sqrt(Float64(1.0 + t)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 5.5e+22) tmp = Float64(Float64(1.0 + Float64(t_2 + Float64(sqrt(Float64(1.0 + z)) + Float64(1.0 / Float64(t_1 + sqrt(t)))))) - Float64(sqrt(y) + sqrt(z))); else tmp = Float64(Float64(t_1 - sqrt(t)) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + 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 + t));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 5.5e+22)
tmp = (1.0 + (t_2 + (sqrt((1.0 + z)) + (1.0 / (t_1 + sqrt(t)))))) - (sqrt(y) + sqrt(z));
else
tmp = (t_1 - sqrt(t)) + ((1.0 / (t_2 + sqrt(y))) + (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[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5.5e+22], N[(N[(1.0 + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 5.5 \cdot 10^{+22}:\\
\;\;\;\;\left(1 + \left(t_2 + \left(\sqrt{1 + z} + \frac{1}{t_1 + \sqrt{t}}\right)\right)\right) - \left(\sqrt{y} + \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \sqrt{t}\right) + \left(\frac{1}{t_2 + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\\
\end{array}
\end{array}
if z < 5.50000000000000021e22Initial program 96.3%
+-commutative96.3%
associate-+r+96.3%
associate-+r-77.4%
associate-+l-64.7%
associate-+r-49.6%
Simplified49.6%
flip--49.9%
add-sqr-sqrt39.1%
add-sqr-sqrt50.0%
Applied egg-rr50.0%
associate--l+50.3%
+-inverses50.3%
metadata-eval50.3%
Simplified50.3%
Taylor expanded in x around 0 29.0%
+-commutative29.0%
Simplified29.0%
if 5.50000000000000021e22 < z Initial program 86.4%
associate-+l+86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
flip--86.4%
add-sqr-sqrt69.2%
+-commutative69.2%
add-sqr-sqrt86.5%
+-commutative86.5%
Applied egg-rr86.5%
associate--l+89.2%
+-inverses89.2%
metadata-eval89.2%
Simplified89.2%
flip--89.2%
add-sqr-sqrt71.9%
add-sqr-sqrt89.4%
Applied egg-rr89.4%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in z around inf 92.1%
+-commutative92.1%
Simplified92.1%
Final simplification61.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 y))) (t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= z 1.5e+30)
(+ (+ 1.0 (+ (/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z))) t_1)) (- t_2 (sqrt y)))
(+
t_2
(+ (/ 1.0 (+ t_1 (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 t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (z <= 1.5e+30) {
tmp = (1.0 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_1)) + (t_2 - sqrt(y));
} else {
tmp = t_2 + ((1.0 / (t_1 + sqrt(y))) + (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 + y))
t_2 = sqrt((1.0d0 + t)) - sqrt(t)
if (z <= 1.5d+30) then
tmp = (1.0d0 + ((1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + t_1)) + (t_2 - sqrt(y))
else
tmp = t_2 + ((1.0d0 / (t_1 + sqrt(y))) + (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 + y));
double t_2 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (z <= 1.5e+30) {
tmp = (1.0 + ((1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + t_1)) + (t_2 - Math.sqrt(y));
} else {
tmp = t_2 + ((1.0 / (t_1 + Math.sqrt(y))) + (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 + y)) t_2 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if z <= 1.5e+30: tmp = (1.0 + ((1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + t_1)) + (t_2 - math.sqrt(y)) else: tmp = t_2 + ((1.0 / (t_1 + math.sqrt(y))) + (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 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (z <= 1.5e+30) tmp = Float64(Float64(1.0 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + t_1)) + Float64(t_2 - sqrt(y))); else tmp = Float64(t_2 + Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + 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 + y));
t_2 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (z <= 1.5e+30)
tmp = (1.0 + ((1.0 / (sqrt((1.0 + z)) + sqrt(z))) + t_1)) + (t_2 - sqrt(y));
else
tmp = t_2 + ((1.0 / (t_1 + sqrt(y))) + (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[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.5e+30], N[(N[(1.0 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(N[(1.0 / N[(t$95$1 + 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]), $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 + t} - \sqrt{t}\\
\mathbf{if}\;z \leq 1.5 \cdot 10^{+30}:\\
\;\;\;\;\left(1 + \left(\frac{1}{\sqrt{1 + z} + \sqrt{z}} + t_1\right)\right) + \left(t_2 - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(\frac{1}{t_1 + \sqrt{y}} + \frac{1}{\sqrt{1 + x} + \sqrt{x}}\right)\\
\end{array}
\end{array}
if z < 1.49999999999999989e30Initial program 94.6%
+-commutative94.6%
associate-+r+94.6%
associate-+r-75.3%
associate-+l-63.1%
associate-+r-48.8%
Simplified48.8%
Taylor expanded in x around 0 28.3%
associate--l+28.3%
associate--l+28.3%
Simplified28.3%
flip--96.1%
add-sqr-sqrt93.9%
add-sqr-sqrt96.2%
Applied egg-rr28.5%
associate--l+98.0%
+-inverses98.0%
metadata-eval98.0%
Simplified28.5%
if 1.49999999999999989e30 < z Initial program 87.6%
associate-+l+87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
flip--87.5%
add-sqr-sqrt69.2%
+-commutative69.2%
add-sqr-sqrt87.7%
+-commutative87.7%
Applied egg-rr87.7%
associate--l+90.5%
+-inverses90.5%
metadata-eval90.5%
Simplified90.5%
flip--90.5%
add-sqr-sqrt72.8%
add-sqr-sqrt90.7%
Applied egg-rr90.7%
associate--l+93.5%
+-inverses93.5%
metadata-eval93.5%
Simplified93.5%
Taylor expanded in z around inf 93.5%
+-commutative93.5%
Simplified93.5%
Final simplification60.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 (<= y 6.8e+22)
(+
(+ 1.0 (+ (sqrt (+ 1.0 y)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (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 <= 6.8e+22) {
tmp = (1.0 + (sqrt((1.0 + y)) + (sqrt((1.0 + z)) - sqrt(z)))) + ((sqrt((1.0 + t)) - sqrt(t)) - 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 <= 6.8d+22) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) + (sqrt((1.0d0 + z)) - sqrt(z)))) + ((sqrt((1.0d0 + t)) - sqrt(t)) - 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 <= 6.8e+22) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - 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 <= 6.8e+22: tmp = (1.0 + (math.sqrt((1.0 + y)) + (math.sqrt((1.0 + z)) - math.sqrt(z)))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) - 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 <= 6.8e+22) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - 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 <= 6.8e+22)
tmp = (1.0 + (sqrt((1.0 + y)) + (sqrt((1.0 + z)) - sqrt(z)))) + ((sqrt((1.0 + t)) - sqrt(t)) - 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, 6.8e+22], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.8 \cdot 10^{+22}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 6.8e22Initial program 96.6%
+-commutative96.6%
associate-+r+96.6%
associate-+r-96.6%
associate-+l-96.6%
associate-+r-96.6%
Simplified54.0%
Taylor expanded in x around 0 32.5%
associate--l+52.9%
associate--l+57.7%
Simplified57.7%
if 6.8e22 < y Initial program 85.7%
+-commutative85.7%
associate-+r+85.7%
associate-+r-50.1%
associate-+l-18.1%
associate-+r-3.2%
Simplified2.8%
Taylor expanded in z around inf 2.7%
+-commutative2.7%
associate-+r-3.2%
Simplified3.2%
Taylor expanded in y around inf 18.3%
+-commutative18.3%
associate--l+26.8%
+-commutative26.8%
Simplified26.8%
Taylor expanded in t around inf 16.0%
flip--16.0%
add-sqr-sqrt16.3%
add-sqr-sqrt16.0%
Applied egg-rr16.0%
associate--l+19.5%
+-inverses19.5%
metadata-eval19.5%
+-commutative19.5%
Simplified19.5%
Final simplification38.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.45e-25)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 5e+19)
(+ 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 <= 1.45e-25) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 5e+19) {
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 <= 1.45d-25) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 5d+19) 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 <= 1.45e-25) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 5e+19) {
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 <= 1.45e-25: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 5e+19: 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 <= 1.45e-25) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 5e+19) 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 <= 1.45e-25)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 5e+19)
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, 1.45e-25], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 5e+19], 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 1.45 \cdot 10^{-25}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+19}:\\
\;\;\;\;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 < 1.45e-25Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-97.1%
associate-+l-97.1%
associate-+r-97.1%
Simplified54.7%
Taylor expanded in x around 0 33.2%
associate--l+55.0%
associate--l+57.5%
Simplified57.5%
Taylor expanded in y around 0 17.9%
associate--l+55.5%
+-commutative55.5%
+-commutative55.5%
Simplified55.5%
Taylor expanded in t around inf 55.7%
if 1.45e-25 < y < 5e19Initial program 94.0%
+-commutative94.0%
associate-+r+94.0%
associate-+r-94.0%
associate-+l-94.0%
associate-+r-94.0%
Simplified47.8%
Taylor expanded in t around inf 6.2%
associate--l+13.8%
associate--l+14.7%
+-commutative14.7%
Simplified14.7%
Taylor expanded in z around inf 28.8%
+-commutative28.8%
Simplified28.8%
if 5e19 < y Initial program 85.6%
+-commutative85.6%
associate-+r+85.6%
associate-+r-50.4%
associate-+l-18.6%
associate-+r-3.8%
Simplified3.5%
Taylor expanded in z around inf 2.8%
+-commutative2.8%
associate-+r-3.3%
Simplified3.3%
Taylor expanded in y around inf 18.2%
+-commutative18.2%
associate--l+26.7%
+-commutative26.7%
Simplified26.7%
Taylor expanded in t around inf 16.0%
flip--16.0%
add-sqr-sqrt16.3%
add-sqr-sqrt16.0%
Applied egg-rr16.0%
associate--l+19.5%
+-inverses19.5%
metadata-eval19.5%
+-commutative19.5%
Simplified19.5%
Final simplification36.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 (<= y 6.8e-26)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 4e+20)
(exp (log1p (- (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 <= 6.8e-26) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 4e+20) {
tmp = exp(log1p((sqrt((1.0 + y)) - sqrt(y))));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.8e-26) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 4e+20) {
tmp = Math.exp(Math.log1p((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 <= 6.8e-26: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 4e+20: tmp = math.exp(math.log1p((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 <= 6.8e-26) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 4e+20) tmp = exp(log1p(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 6.8e-26], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 4e+20], N[Exp[N[Log[1 + N[(N[Sqrt[N[(1.0 + y), $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 6.8 \cdot 10^{-26}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+20}:\\
\;\;\;\;e^{\mathsf{log1p}\left(\sqrt{1 + y} - \sqrt{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 6.80000000000000026e-26Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-97.1%
associate-+l-97.1%
associate-+r-97.1%
Simplified54.7%
Taylor expanded in x around 0 33.2%
associate--l+55.0%
associate--l+57.5%
Simplified57.5%
Taylor expanded in y around 0 17.9%
associate--l+55.5%
+-commutative55.5%
+-commutative55.5%
Simplified55.5%
Taylor expanded in t around inf 55.7%
if 6.80000000000000026e-26 < y < 4e20Initial program 94.0%
+-commutative94.0%
associate-+r+94.0%
associate-+r-94.0%
associate-+l-94.0%
associate-+r-94.0%
Simplified47.8%
Taylor expanded in x around 0 25.2%
associate--l+37.3%
associate--l+57.4%
Simplified57.4%
add-exp-log57.3%
associate--l+57.3%
log1p-def57.3%
associate--r-42.6%
Applied egg-rr42.6%
associate--l+42.6%
associate-+l-57.3%
associate--r-57.3%
Simplified57.3%
Taylor expanded in t around inf 33.5%
Taylor expanded in z around inf 51.5%
if 4e20 < y Initial program 85.6%
+-commutative85.6%
associate-+r+85.6%
associate-+r-50.4%
associate-+l-18.6%
associate-+r-3.8%
Simplified3.5%
Taylor expanded in z around inf 2.8%
+-commutative2.8%
associate-+r-3.3%
Simplified3.3%
Taylor expanded in y around inf 18.2%
+-commutative18.2%
associate--l+26.7%
+-commutative26.7%
Simplified26.7%
Taylor expanded in t around inf 16.0%
flip--16.0%
add-sqr-sqrt16.3%
add-sqr-sqrt16.0%
Applied egg-rr16.0%
associate--l+19.5%
+-inverses19.5%
metadata-eval19.5%
+-commutative19.5%
Simplified19.5%
Final simplification37.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 2.9) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.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.9) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else {
tmp = 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.9d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else
tmp = 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.9) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else {
tmp = 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.9: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 else: tmp = 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.9) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); else tmp = 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.9)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
else
tmp = 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.9], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.9:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.89999999999999991Initial program 97.2%
+-commutative97.2%
associate-+r+97.2%
associate-+r-97.2%
associate-+l-97.2%
associate-+r-97.2%
Simplified53.2%
Taylor expanded in x around 0 32.2%
associate--l+54.0%
associate--l+57.7%
Simplified57.7%
Taylor expanded in y around 0 17.2%
associate--l+53.9%
+-commutative53.9%
+-commutative53.9%
Simplified53.9%
Taylor expanded in t around inf 54.2%
if 2.89999999999999991 < y Initial program 85.7%
+-commutative85.7%
associate-+r+85.7%
associate-+r-52.3%
associate-+l-22.2%
associate-+r-8.1%
Simplified6.6%
Taylor expanded in z around inf 4.3%
+-commutative4.3%
associate-+r-5.1%
Simplified5.1%
Taylor expanded in y around inf 17.7%
+-commutative17.7%
associate--l+26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in t around inf 16.1%
Final simplification34.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 1.9) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0) (/ 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 <= 1.9) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} 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 <= 1.9d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
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 <= 1.9) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} 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 <= 1.9: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 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 <= 1.9) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); 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 <= 1.9)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
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, 1.9], 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 + 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 1.9:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.8999999999999999Initial program 97.2%
+-commutative97.2%
associate-+r+97.2%
associate-+r-97.2%
associate-+l-97.2%
associate-+r-97.2%
Simplified53.2%
Taylor expanded in x around 0 32.2%
associate--l+54.0%
associate--l+57.7%
Simplified57.7%
Taylor expanded in y around 0 17.2%
associate--l+53.9%
+-commutative53.9%
+-commutative53.9%
Simplified53.9%
Taylor expanded in t around inf 54.2%
if 1.8999999999999999 < y Initial program 85.7%
+-commutative85.7%
associate-+r+85.7%
associate-+r-52.3%
associate-+l-22.2%
associate-+r-8.1%
Simplified6.6%
Taylor expanded in z around inf 4.3%
+-commutative4.3%
associate-+r-5.1%
Simplified5.1%
Taylor expanded in y around inf 17.7%
+-commutative17.7%
associate--l+26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in t around inf 16.1%
flip--16.1%
add-sqr-sqrt16.3%
add-sqr-sqrt16.1%
Applied egg-rr16.1%
associate--l+19.5%
+-inverses19.5%
metadata-eval19.5%
+-commutative19.5%
Simplified19.5%
Final simplification36.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 4.8) (+ 2.0 (- 1.0 (sqrt z))) (- (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 (z <= 4.8) {
tmp = 2.0 + (1.0 - sqrt(z));
} else {
tmp = 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 (z <= 4.8d0) then
tmp = 2.0d0 + (1.0d0 - sqrt(z))
else
tmp = 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 (z <= 4.8) {
tmp = 2.0 + (1.0 - Math.sqrt(z));
} else {
tmp = 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 z <= 4.8: tmp = 2.0 + (1.0 - math.sqrt(z)) else: tmp = 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 (z <= 4.8) tmp = Float64(2.0 + Float64(1.0 - sqrt(z))); else tmp = 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 (z <= 4.8)
tmp = 2.0 + (1.0 - sqrt(z));
else
tmp = 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[z, 4.8], N[(2.0 + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.8:\\
\;\;\;\;2 + \left(1 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if z < 4.79999999999999982Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
associate-+r-78.5%
associate-+l-65.4%
associate-+r-49.8%
Simplified49.8%
Taylor expanded in x around 0 29.0%
associate--l+29.0%
associate--l+29.0%
Simplified29.0%
Taylor expanded in y around 0 21.3%
associate--l+45.0%
+-commutative45.0%
+-commutative45.0%
Simplified45.0%
Taylor expanded in z around 0 45.0%
Taylor expanded in t around inf 41.3%
if 4.79999999999999982 < z Initial program 85.6%
+-commutative85.6%
associate-+r+85.6%
associate-+r-69.5%
associate-+l-51.3%
associate-+r-51.3%
Simplified10.3%
Taylor expanded in z around inf 31.7%
+-commutative31.7%
associate-+r-50.8%
Simplified50.8%
Taylor expanded in y around inf 18.3%
+-commutative18.3%
associate--l+26.8%
+-commutative26.8%
Simplified26.8%
Taylor expanded in t around inf 16.3%
Final simplification28.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 4.0) (+ 2.0 (- 1.0 (sqrt z))) 1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.0) {
tmp = 2.0 + (1.0 - sqrt(z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 4.0d0) then
tmp = 2.0d0 + (1.0d0 - sqrt(z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.0) {
tmp = 2.0 + (1.0 - Math.sqrt(z));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 4.0: tmp = 2.0 + (1.0 - math.sqrt(z)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 4.0) tmp = Float64(2.0 + Float64(1.0 - sqrt(z))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 4.0)
tmp = 2.0 + (1.0 - sqrt(z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 4.0], N[(2.0 + N[(1.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4:\\
\;\;\;\;2 + \left(1 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < 4Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
associate-+r-78.5%
associate-+l-65.4%
associate-+r-49.8%
Simplified49.8%
Taylor expanded in x around 0 29.0%
associate--l+29.0%
associate--l+29.0%
Simplified29.0%
Taylor expanded in y around 0 21.3%
associate--l+45.0%
+-commutative45.0%
+-commutative45.0%
Simplified45.0%
Taylor expanded in z around 0 45.0%
Taylor expanded in t around inf 41.3%
if 4 < z Initial program 85.6%
+-commutative85.6%
associate-+r+85.6%
associate-+r-69.5%
associate-+l-51.3%
associate-+r-51.3%
Simplified10.3%
Taylor expanded in z around inf 31.7%
+-commutative31.7%
associate-+r-50.8%
Simplified50.8%
Taylor expanded in y around inf 18.3%
+-commutative18.3%
associate--l+26.8%
+-commutative26.8%
Simplified26.8%
Taylor expanded in t around inf 16.3%
Taylor expanded in x around 0 42.6%
Final simplification42.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 4.0) (- 3.0 (sqrt z)) 1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.0) {
tmp = 3.0 - sqrt(z);
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 4.0d0) then
tmp = 3.0d0 - sqrt(z)
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.0) {
tmp = 3.0 - Math.sqrt(z);
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 4.0: tmp = 3.0 - math.sqrt(z) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 4.0) tmp = Float64(3.0 - sqrt(z)); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 4.0)
tmp = 3.0 - sqrt(z);
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 4.0], N[(3.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4:\\
\;\;\;\;3 - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < 4Initial program 97.6%
+-commutative97.6%
associate-+r+97.6%
associate-+r-78.5%
associate-+l-65.4%
associate-+r-49.8%
Simplified49.8%
Taylor expanded in x around 0 29.0%
associate--l+29.0%
associate--l+29.0%
Simplified29.0%
Taylor expanded in y around 0 21.3%
associate--l+45.0%
+-commutative45.0%
+-commutative45.0%
Simplified45.0%
Taylor expanded in z around 0 45.0%
Taylor expanded in t around inf 41.3%
if 4 < z Initial program 85.6%
+-commutative85.6%
associate-+r+85.6%
associate-+r-69.5%
associate-+l-51.3%
associate-+r-51.3%
Simplified10.3%
Taylor expanded in z around inf 31.7%
+-commutative31.7%
associate-+r-50.8%
Simplified50.8%
Taylor expanded in y around inf 18.3%
+-commutative18.3%
associate--l+26.8%
+-commutative26.8%
Simplified26.8%
Taylor expanded in t around inf 16.3%
Taylor expanded in x around 0 42.6%
Final simplification42.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 91.2%
+-commutative91.2%
associate-+r+91.2%
associate-+r-73.7%
associate-+l-57.9%
associate-+r-50.6%
Simplified28.8%
Taylor expanded in z around inf 21.2%
+-commutative21.2%
associate-+r-32.4%
Simplified32.4%
Taylor expanded in y around inf 13.1%
+-commutative13.1%
associate--l+19.6%
+-commutative19.6%
Simplified19.6%
Taylor expanded in t around inf 13.7%
Taylor expanded in x around 0 35.0%
Final simplification35.0%
(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 2023322
(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))))