
(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 (sqrt (+ z 1.0))) (t_2 (sqrt (+ 1.0 y))))
(if (<= (- t_1 (sqrt z)) 0.97)
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(+ (/ 1.0 (+ t_2 (sqrt y))) (/ 1.0 (+ (sqrt z) t_1))))
(+
(- (+ 1.0 (+ t_2 t_1)) (sqrt z))
(- (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if ((t_1 - sqrt(z)) <= 0.97) {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (t_2 + sqrt(y))) + (1.0 / (sqrt(z) + t_1)));
} else {
tmp = ((1.0 + (t_2 + t_1)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if ((t_1 - sqrt(z)) <= 0.97d0) then
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + ((1.0d0 / (t_2 + sqrt(y))) + (1.0d0 / (sqrt(z) + t_1)))
else
tmp = ((1.0d0 + (t_2 + t_1)) - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if ((t_1 - Math.sqrt(z)) <= 0.97) {
tmp = (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + ((1.0 / (t_2 + Math.sqrt(y))) + (1.0 / (Math.sqrt(z) + t_1)));
} else {
tmp = ((1.0 + (t_2 + t_1)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if (t_1 - math.sqrt(z)) <= 0.97: tmp = (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + ((1.0 / (t_2 + math.sqrt(y))) + (1.0 / (math.sqrt(z) + t_1))) else: tmp = ((1.0 + (t_2 + t_1)) - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(t_1 - sqrt(z)) <= 0.97) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + Float64(1.0 / Float64(sqrt(z) + t_1)))); else tmp = Float64(Float64(Float64(1.0 + Float64(t_2 + t_1)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if ((t_1 - sqrt(z)) <= 0.97)
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (t_2 + sqrt(y))) + (1.0 / (sqrt(z) + t_1)));
else
tmp = ((1.0 + (t_2 + t_1)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], 0.97], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;t_1 - \sqrt{z} \leq 0.97:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\frac{1}{t_2 + \sqrt{y}} + \frac{1}{\sqrt{z} + t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 + \left(t_2 + t_1\right)\right) - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} - \sqrt{y}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.96999999999999997Initial program 89.2%
associate-+l+89.2%
associate-+l+89.2%
+-commutative89.2%
+-commutative89.2%
associate-+l-87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 41.5%
flip--42.1%
add-sqr-sqrt33.9%
+-commutative33.9%
add-sqr-sqrt42.1%
+-commutative42.1%
Applied egg-rr42.1%
associate--l+43.6%
+-inverses43.6%
metadata-eval43.6%
Simplified43.6%
flip--43.7%
add-sqr-sqrt38.7%
add-sqr-sqrt43.7%
Applied egg-rr43.7%
associate--l+46.3%
+-inverses46.3%
metadata-eval46.3%
Simplified46.3%
flip--46.6%
add-sqr-sqrt26.8%
add-sqr-sqrt46.8%
Applied egg-rr46.8%
associate--l+50.0%
+-inverses50.0%
metadata-eval50.0%
Simplified50.0%
if 0.96999999999999997 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 97.9%
+-commutative97.9%
associate-+r+97.9%
associate-+r-75.6%
associate-+l-65.2%
associate-+r-48.3%
Simplified48.2%
Taylor expanded in x around 0 33.7%
flip--34.0%
add-sqr-sqrt25.5%
add-sqr-sqrt34.0%
Applied egg-rr34.0%
associate--l+34.0%
+-inverses34.0%
metadata-eval34.0%
Simplified34.0%
Final simplification41.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z 1.0))))
(if (<= t 2.1e+20)
(+
(- (+ 1.0 (+ 1.0 t_1)) (sqrt z))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (sqrt y)))
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (- 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((z + 1.0));
double tmp;
if (t <= 2.1e+20) {
tmp = ((1.0 + (1.0 + t_1)) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
} else {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (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) :: tmp
t_1 = sqrt((z + 1.0d0))
if (t <= 2.1d+20) then
tmp = ((1.0d0 + (1.0d0 + t_1)) - sqrt(z)) + ((sqrt((1.0d0 + t)) - sqrt(t)) - sqrt(y))
else
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (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((z + 1.0));
double tmp;
if (t <= 2.1e+20) {
tmp = ((1.0 + (1.0 + t_1)) - 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))) + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (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((z + 1.0)) tmp = 0 if t <= 2.1e+20: tmp = ((1.0 + (1.0 + t_1)) - 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))) + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (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(z + 1.0)) tmp = 0.0 if (t <= 2.1e+20) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 + t_1)) - sqrt(z)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + 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((z + 1.0));
tmp = 0.0;
if (t <= 2.1e+20)
tmp = ((1.0 + (1.0 + t_1)) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
else
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 2.1e+20], N[(N[(N[(1.0 + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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{z + 1}\\
\mathbf{if}\;t \leq 2.1 \cdot 10^{+20}:\\
\;\;\;\;\left(\left(1 + \left(1 + t_1\right)\right) - \sqrt{z}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(t_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 2.1e20Initial program 96.7%
+-commutative96.7%
associate-+r+96.7%
associate-+r-74.0%
associate-+l-54.2%
associate-+r-49.9%
Simplified32.2%
Taylor expanded in x around 0 24.1%
Taylor expanded in y around 0 21.2%
if 2.1e20 < t Initial program 89.7%
associate-+l+89.7%
associate-+l+89.7%
+-commutative89.7%
+-commutative89.7%
associate-+l-43.1%
+-commutative43.1%
+-commutative43.1%
Simplified43.1%
Taylor expanded in t around inf 89.7%
flip--90.4%
add-sqr-sqrt70.4%
+-commutative70.4%
add-sqr-sqrt90.4%
+-commutative90.4%
Applied egg-rr90.4%
associate--l+91.8%
+-inverses91.8%
metadata-eval91.8%
Simplified91.8%
flip--91.8%
add-sqr-sqrt74.0%
add-sqr-sqrt91.8%
Applied egg-rr91.8%
associate--l+95.1%
+-inverses95.1%
metadata-eval95.1%
Simplified95.1%
Final simplification51.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 (+ z 1.0))) (t_2 (sqrt (+ 1.0 y))))
(if (<= t 1.3e+39)
(+
(- (+ 1.0 (+ t_2 t_1)) (sqrt z))
(- (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))) (sqrt y)))
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(+ (/ 1.0 (+ t_2 (sqrt y))) (- 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((z + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if (t <= 1.3e+39) {
tmp = ((1.0 + (t_2 + t_1)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) - sqrt(y));
} else {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (t_2 + sqrt(y))) + (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((z + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if (t <= 1.3d+39) then
tmp = ((1.0d0 + (t_2 + t_1)) - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) - sqrt(y))
else
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + ((1.0d0 / (t_2 + sqrt(y))) + (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((z + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (t <= 1.3e+39) {
tmp = ((1.0 + (t_2 + t_1)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) - Math.sqrt(y));
} else {
tmp = (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + ((1.0 / (t_2 + Math.sqrt(y))) + (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((z + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if t <= 1.3e+39: tmp = ((1.0 + (t_2 + t_1)) - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) - math.sqrt(y)) else: tmp = (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + ((1.0 / (t_2 + math.sqrt(y))) + (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(z + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (t <= 1.3e+39) tmp = Float64(Float64(Float64(1.0 + Float64(t_2 + t_1)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(Float64(1.0 / Float64(t_2 + sqrt(y))) + 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((z + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (t <= 1.3e+39)
tmp = ((1.0 + (t_2 + t_1)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) - sqrt(y));
else
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + ((1.0 / (t_2 + sqrt(y))) + (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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.3e+39], N[(N[(N[(1.0 + N[(t$95$2 + t$95$1), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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{z + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;t \leq 1.3 \cdot 10^{+39}:\\
\;\;\;\;\left(\left(1 + \left(t_2 + t_1\right)\right) - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\frac{1}{t_2 + \sqrt{y}} + \left(t_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 1.3e39Initial program 96.8%
+-commutative96.8%
associate-+r+96.8%
associate-+r-73.7%
associate-+l-55.2%
associate-+r-50.3%
Simplified32.0%
Taylor expanded in x around 0 24.4%
flip--24.7%
add-sqr-sqrt23.4%
add-sqr-sqrt24.7%
Applied egg-rr24.7%
associate--l+24.9%
+-inverses24.9%
metadata-eval24.9%
Simplified24.9%
if 1.3e39 < t Initial program 88.8%
associate-+l+88.8%
associate-+l+88.8%
+-commutative88.8%
+-commutative88.8%
associate-+l-41.2%
+-commutative41.2%
+-commutative41.2%
Simplified41.2%
Taylor expanded in t around inf 88.8%
flip--89.5%
add-sqr-sqrt69.4%
+-commutative69.4%
add-sqr-sqrt89.6%
+-commutative89.6%
Applied egg-rr89.6%
associate--l+91.2%
+-inverses91.2%
metadata-eval91.2%
Simplified91.2%
flip--91.2%
add-sqr-sqrt73.3%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate--l+94.8%
+-inverses94.8%
metadata-eval94.8%
Simplified94.8%
Final simplification50.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 3.4e+19)
(+
(- (+ 1.0 (+ t_1 (sqrt (+ z 1.0)))) (sqrt z))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (sqrt y)))
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 3.4e+19) {
tmp = ((1.0 + (t_1 + sqrt((z + 1.0)))) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
} else {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (t_1 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 3.4d+19) then
tmp = ((1.0d0 + (t_1 + sqrt((z + 1.0d0)))) - sqrt(z)) + ((sqrt((1.0d0 + t)) - sqrt(t)) - sqrt(y))
else
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (t_1 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 3.4e+19) {
tmp = ((1.0 + (t_1 + Math.sqrt((z + 1.0)))) - 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))) + (1.0 / (t_1 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 3.4e+19: tmp = ((1.0 + (t_1 + math.sqrt((z + 1.0)))) - 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))) + (1.0 / (t_1 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 3.4e+19) tmp = Float64(Float64(Float64(1.0 + Float64(t_1 + sqrt(Float64(z + 1.0)))) - sqrt(z)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(t_1 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 3.4e+19)
tmp = ((1.0 + (t_1 + sqrt((z + 1.0)))) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
else
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (t_1 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3.4e+19], N[(N[(N[(1.0 + N[(t$95$1 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 3.4 \cdot 10^{+19}:\\
\;\;\;\;\left(\left(1 + \left(t_1 + \sqrt{z + 1}\right)\right) - \sqrt{z}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{t_1 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 3.4e19Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-74.8%
associate-+l-64.5%
associate-+r-48.4%
Simplified48.4%
Taylor expanded in x around 0 33.9%
if 3.4e19 < z Initial program 89.4%
associate-+l+89.4%
associate-+l+89.4%
+-commutative89.4%
+-commutative89.4%
associate-+l-89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 41.0%
flip--41.6%
add-sqr-sqrt33.8%
+-commutative33.8%
add-sqr-sqrt41.7%
+-commutative41.7%
Applied egg-rr41.7%
associate--l+43.3%
+-inverses43.3%
metadata-eval43.3%
Simplified43.3%
flip--43.3%
add-sqr-sqrt38.9%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
associate--l+46.2%
+-inverses46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in z around inf 46.2%
Final simplification39.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 (<= z 3.4e+19)
(+
(- (+ 1.0 (+ 1.0 (sqrt (+ z 1.0)))) (sqrt z))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (sqrt y)))
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.4e+19) {
tmp = ((1.0 + (1.0 + sqrt((z + 1.0)))) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
} else {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3.4d+19) then
tmp = ((1.0d0 + (1.0d0 + sqrt((z + 1.0d0)))) - sqrt(z)) + ((sqrt((1.0d0 + t)) - sqrt(t)) - sqrt(y))
else
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.4e+19) {
tmp = ((1.0 + (1.0 + Math.sqrt((z + 1.0)))) - 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))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3.4e+19: tmp = ((1.0 + (1.0 + math.sqrt((z + 1.0)))) - 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))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3.4e+19) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 + sqrt(Float64(z + 1.0)))) - sqrt(z)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - sqrt(y))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3.4e+19)
tmp = ((1.0 + (1.0 + sqrt((z + 1.0)))) - sqrt(z)) + ((sqrt((1.0 + t)) - sqrt(t)) - sqrt(y));
else
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3.4e+19], N[(N[(N[(1.0 + N[(1.0 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.4 \cdot 10^{+19}:\\
\;\;\;\;\left(\left(1 + \left(1 + \sqrt{z + 1}\right)\right) - \sqrt{z}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\end{array}
\end{array}
if z < 3.4e19Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-74.8%
associate-+l-64.5%
associate-+r-48.4%
Simplified48.4%
Taylor expanded in x around 0 33.9%
Taylor expanded in y around 0 28.8%
if 3.4e19 < z Initial program 89.4%
associate-+l+89.4%
associate-+l+89.4%
+-commutative89.4%
+-commutative89.4%
associate-+l-89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 41.0%
flip--41.6%
add-sqr-sqrt33.8%
+-commutative33.8%
add-sqr-sqrt41.7%
+-commutative41.7%
Applied egg-rr41.7%
associate--l+43.3%
+-inverses43.3%
metadata-eval43.3%
Simplified43.3%
flip--43.3%
add-sqr-sqrt38.9%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
associate--l+46.2%
+-inverses46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in z around inf 46.2%
Final simplification36.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 1.6e+19)
(+ (+ 1.0 t_1) (- (sqrt (+ z 1.0)) (+ (sqrt z) (sqrt y))))
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (/ 1.0 (+ t_1 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 1.6e+19) {
tmp = (1.0 + t_1) + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)));
} else {
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (t_1 + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 1.6d+19) then
tmp = (1.0d0 + t_1) + (sqrt((z + 1.0d0)) - (sqrt(z) + sqrt(y)))
else
tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (t_1 + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 1.6e+19) {
tmp = (1.0 + t_1) + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (t_1 + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 1.6e+19: tmp = (1.0 + t_1) + (math.sqrt((z + 1.0)) - (math.sqrt(z) + math.sqrt(y))) else: tmp = (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (t_1 + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 1.6e+19) tmp = Float64(Float64(1.0 + t_1) + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(t_1 + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 1.6e+19)
tmp = (1.0 + t_1) + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y)));
else
tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (t_1 + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.6e+19], N[(N[(1.0 + t$95$1), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 1.6 \cdot 10^{+19}:\\
\;\;\;\;\left(1 + t_1\right) + \left(\sqrt{z + 1} - \left(\sqrt{z} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{t_1 + \sqrt{y}}\\
\end{array}
\end{array}
if z < 1.6e19Initial program 97.1%
associate-+l+97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in t around inf 54.7%
Taylor expanded in x around 0 27.2%
expm1-log1p-u26.5%
expm1-udef26.5%
log1p-udef26.5%
add-exp-log27.2%
Applied egg-rr27.2%
add-exp-log26.5%
log1p-udef26.5%
expm1-udef26.5%
expm1-log1p-u27.2%
associate-+r-43.9%
associate--l+43.9%
Applied egg-rr43.9%
associate-+r+27.2%
Simplified27.2%
if 1.6e19 < z Initial program 89.4%
associate-+l+89.4%
associate-+l+89.4%
+-commutative89.4%
+-commutative89.4%
associate-+l-89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 41.0%
flip--41.6%
add-sqr-sqrt33.8%
+-commutative33.8%
add-sqr-sqrt41.7%
+-commutative41.7%
Applied egg-rr41.7%
associate--l+43.3%
+-inverses43.3%
metadata-eval43.3%
Simplified43.3%
flip--43.3%
add-sqr-sqrt38.9%
add-sqr-sqrt43.3%
Applied egg-rr43.3%
associate--l+46.2%
+-inverses46.2%
metadata-eval46.2%
Simplified46.2%
Taylor expanded in z around inf 46.2%
Final simplification35.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))) (t_2 (sqrt (+ 1.0 y))))
(if (<= y 5.5e-31)
(+ 1.0 (+ t_2 (- (sqrt (+ z 1.0)) (+ (sqrt z) (sqrt y)))))
(if (<= y 2e+15)
(+ t_1 (- t_2 (+ (sqrt x) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + y));
double tmp;
if (y <= 5.5e-31) {
tmp = 1.0 + (t_2 + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y))));
} else if (y <= 2e+15) {
tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (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 <= 5.5d-31) then
tmp = 1.0d0 + (t_2 + (sqrt((z + 1.0d0)) - (sqrt(z) + sqrt(y))))
else if (y <= 2d+15) then
tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (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 <= 5.5e-31) {
tmp = 1.0 + (t_2 + (Math.sqrt((z + 1.0)) - (Math.sqrt(z) + Math.sqrt(y))));
} else if (y <= 2e+15) {
tmp = t_1 + (t_2 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (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 <= 5.5e-31: tmp = 1.0 + (t_2 + (math.sqrt((z + 1.0)) - (math.sqrt(z) + math.sqrt(y)))) elif y <= 2e+15: tmp = t_1 + (t_2 - (math.sqrt(x) + math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (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 <= 5.5e-31) tmp = Float64(1.0 + Float64(t_2 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(z) + sqrt(y))))); elseif (y <= 2e+15) tmp = Float64(t_1 + Float64(t_2 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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 <= 5.5e-31)
tmp = 1.0 + (t_2 + (sqrt((z + 1.0)) - (sqrt(z) + sqrt(y))));
elseif (y <= 2e+15)
tmp = t_1 + (t_2 - (sqrt(x) + sqrt(y)));
else
tmp = (1.0 + (x - x)) / (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, 5.5e-31], N[(1.0 + N[(t$95$2 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+15], N[(t$95$1 + N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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 5.5 \cdot 10^{-31}:\\
\;\;\;\;1 + \left(t_2 + \left(\sqrt{z + 1} - \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+15}:\\
\;\;\;\;t_1 + \left(t_2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 5.49999999999999958e-31Initial program 97.7%
associate-+l+97.6%
associate-+l+97.6%
+-commutative97.6%
+-commutative97.6%
associate-+l-82.9%
+-commutative82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 52.6%
Taylor expanded in x around 0 30.2%
associate--l+46.0%
associate--l+54.2%
Simplified54.2%
if 5.49999999999999958e-31 < y < 2e15Initial program 97.8%
+-commutative97.8%
associate-+r+97.8%
+-commutative97.8%
associate-+r+97.8%
associate-+r+97.8%
+-commutative97.8%
associate-+l-81.8%
Simplified61.1%
Taylor expanded in t around inf 25.9%
associate--l+29.4%
+-commutative29.4%
+-commutative29.4%
Simplified29.4%
Taylor expanded in z around inf 20.8%
+-commutative20.8%
Simplified20.8%
if 2e15 < y Initial program 90.4%
+-commutative90.4%
associate-+r+90.4%
+-commutative90.4%
associate-+r+90.4%
associate-+r+90.4%
+-commutative90.4%
associate-+l-71.4%
Simplified11.9%
Taylor expanded in t around inf 5.0%
associate--l+19.9%
+-commutative19.9%
+-commutative19.9%
Simplified19.9%
Taylor expanded in z around inf 18.5%
+-commutative18.5%
Simplified18.5%
Taylor expanded in y around inf 18.1%
+-commutative18.1%
flip--18.6%
add-sqr-sqrt18.8%
add-sqr-sqrt18.6%
Applied egg-rr18.6%
+-commutative18.6%
associate--l+20.9%
+-commutative20.9%
+-commutative20.9%
Simplified20.9%
Final simplification35.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 3e+15)
(+
(+ 1.0 (+ (sqrt (+ z 1.0)) (+ 1.0 (* y 0.5))))
(/ (- z y) (- (sqrt y) (sqrt z))))
(+ (sqrt (+ 1.0 x)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (sqrt(y) - sqrt(z)));
} else {
tmp = sqrt((1.0 + x)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3d+15) then
tmp = (1.0d0 + (sqrt((z + 1.0d0)) + (1.0d0 + (y * 0.5d0)))) + ((z - y) / (sqrt(y) - sqrt(z)))
else
tmp = sqrt((1.0d0 + x)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (Math.sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (Math.sqrt(y) - Math.sqrt(z)));
} else {
tmp = Math.sqrt((1.0 + x)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3e+15: tmp = (1.0 + (math.sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (math.sqrt(y) - math.sqrt(z))) else: tmp = math.sqrt((1.0 + x)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(z + 1.0)) + Float64(1.0 + Float64(y * 0.5)))) + Float64(Float64(z - y) / Float64(sqrt(y) - sqrt(z)))); else tmp = Float64(sqrt(Float64(1.0 + x)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3e+15)
tmp = (1.0 + (sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (sqrt(y) - sqrt(z)));
else
tmp = sqrt((1.0 + x)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3e+15], N[(N[(1.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z - y), $MachinePrecision] / N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{z + 1} + \left(1 + y \cdot 0.5\right)\right)\right) + \frac{z - y}{\sqrt{y} - \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 3e15Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in t around inf 55.0%
Taylor expanded in x around 0 27.3%
Taylor expanded in y around 0 25.9%
*-commutative25.9%
Simplified25.9%
flip-+25.9%
add-sqr-sqrt25.9%
add-sqr-sqrt25.9%
Applied egg-rr25.9%
if 3e15 < z Initial program 89.3%
+-commutative89.3%
associate-+r+89.3%
+-commutative89.3%
associate-+r+89.3%
associate-+r+89.3%
+-commutative89.3%
associate-+l-48.3%
Simplified4.9%
Taylor expanded in t around inf 4.3%
associate--l+20.0%
+-commutative20.0%
+-commutative20.0%
Simplified20.0%
Taylor expanded in z around inf 28.8%
+-commutative28.8%
Simplified28.8%
Final simplification27.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 (<= z 3e+15)
(+
(+ 1.0 (+ (sqrt (+ z 1.0)) (+ 1.0 (* y 0.5))))
(/ (- z y) (- (sqrt y) (sqrt z))))
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (sqrt(y) - sqrt(z)));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3d+15) then
tmp = (1.0d0 + (sqrt((z + 1.0d0)) + (1.0d0 + (y * 0.5d0)))) + ((z - y) / (sqrt(y) - sqrt(z)))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (Math.sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (Math.sqrt(y) - Math.sqrt(z)));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3e+15: tmp = (1.0 + (math.sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (math.sqrt(y) - math.sqrt(z))) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(z + 1.0)) + Float64(1.0 + Float64(y * 0.5)))) + Float64(Float64(z - y) / Float64(sqrt(y) - sqrt(z)))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3e+15)
tmp = (1.0 + (sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) + ((z - y) / (sqrt(y) - sqrt(z)));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3e+15], N[(N[(1.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z - y), $MachinePrecision] / N[(N[Sqrt[y], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{z + 1} + \left(1 + y \cdot 0.5\right)\right)\right) + \frac{z - y}{\sqrt{y} - \sqrt{z}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 3e15Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in t around inf 55.0%
Taylor expanded in x around 0 27.3%
Taylor expanded in y around 0 25.9%
*-commutative25.9%
Simplified25.9%
flip-+25.9%
add-sqr-sqrt25.9%
add-sqr-sqrt25.9%
Applied egg-rr25.9%
if 3e15 < z Initial program 89.3%
associate-+l+89.3%
associate-+l+89.3%
+-commutative89.3%
+-commutative89.3%
associate-+l-89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
Taylor expanded in t around inf 40.7%
Taylor expanded in x around 0 4.3%
expm1-log1p-u4.4%
expm1-udef4.4%
log1p-udef4.4%
add-exp-log4.3%
Applied egg-rr4.3%
Taylor expanded in z around inf 30.7%
associate--l+53.5%
Simplified53.5%
Final simplification37.9%
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 3e+15) (- (+ 1.0 (+ (sqrt (+ z 1.0)) (+ 1.0 (* y 0.5)))) (+ (sqrt z) (sqrt y))) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) - (sqrt(z) + sqrt(y));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3d+15) then
tmp = (1.0d0 + (sqrt((z + 1.0d0)) + (1.0d0 + (y * 0.5d0)))) - (sqrt(z) + sqrt(y))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = (1.0 + (Math.sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) - (Math.sqrt(z) + Math.sqrt(y));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3e+15: tmp = (1.0 + (math.sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) - (math.sqrt(z) + math.sqrt(y)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(z + 1.0)) + Float64(1.0 + Float64(y * 0.5)))) - Float64(sqrt(z) + sqrt(y))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3e+15)
tmp = (1.0 + (sqrt((z + 1.0)) + (1.0 + (y * 0.5)))) - (sqrt(z) + sqrt(y));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3e+15], N[(N[(1.0 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{z + 1} + \left(1 + y \cdot 0.5\right)\right)\right) - \left(\sqrt{z} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 3e15Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in t around inf 55.0%
Taylor expanded in x around 0 27.3%
Taylor expanded in y around 0 25.9%
*-commutative25.9%
Simplified25.9%
if 3e15 < z Initial program 89.3%
associate-+l+89.3%
associate-+l+89.3%
+-commutative89.3%
+-commutative89.3%
associate-+l-89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
Taylor expanded in t around inf 40.7%
Taylor expanded in x around 0 4.3%
expm1-log1p-u4.4%
expm1-udef4.4%
log1p-udef4.4%
add-exp-log4.3%
Applied egg-rr4.3%
Taylor expanded in z around inf 30.7%
associate--l+53.5%
Simplified53.5%
Final simplification37.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 1.6e+19) (- (+ 1.0 (+ 1.0 (sqrt (+ z 1.0)))) (+ (sqrt z) (sqrt y))) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.6e+19) {
tmp = (1.0 + (1.0 + sqrt((z + 1.0)))) - (sqrt(z) + sqrt(y));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.6d+19) then
tmp = (1.0d0 + (1.0d0 + sqrt((z + 1.0d0)))) - (sqrt(z) + sqrt(y))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.6e+19) {
tmp = (1.0 + (1.0 + Math.sqrt((z + 1.0)))) - (Math.sqrt(z) + Math.sqrt(y));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.6e+19: tmp = (1.0 + (1.0 + math.sqrt((z + 1.0)))) - (math.sqrt(z) + math.sqrt(y)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.6e+19) tmp = Float64(Float64(1.0 + Float64(1.0 + sqrt(Float64(z + 1.0)))) - Float64(sqrt(z) + sqrt(y))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.6e+19)
tmp = (1.0 + (1.0 + sqrt((z + 1.0)))) - (sqrt(z) + sqrt(y));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.6e+19], N[(N[(1.0 + N[(1.0 + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.6 \cdot 10^{+19}:\\
\;\;\;\;\left(1 + \left(1 + \sqrt{z + 1}\right)\right) - \left(\sqrt{z} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.6e19Initial program 97.1%
associate-+l+97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in t around inf 54.7%
Taylor expanded in x around 0 27.2%
Taylor expanded in y around 0 23.2%
if 1.6e19 < z Initial program 89.4%
associate-+l+89.4%
associate-+l+89.4%
+-commutative89.4%
+-commutative89.4%
associate-+l-89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in t around inf 41.0%
Taylor expanded in x around 0 4.3%
expm1-log1p-u4.4%
expm1-udef4.4%
log1p-udef4.4%
add-exp-log4.3%
Applied egg-rr4.3%
Taylor expanded in z around inf 30.9%
associate--l+53.3%
Simplified53.3%
Final simplification36.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 (+ 2.0 (- (* y 0.5) (sqrt y))))
(t_2 (- (+ (* y 0.5) 3.0) (sqrt y))))
(if (<= y 3.4e-190)
t_2
(if (<= y 5.8e-145)
t_1
(if (<= y 5e-127)
t_2
(if (<= y 5.0) t_1 (- (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 = 2.0 + ((y * 0.5) - sqrt(y));
double t_2 = ((y * 0.5) + 3.0) - sqrt(y);
double tmp;
if (y <= 3.4e-190) {
tmp = t_2;
} else if (y <= 5.8e-145) {
tmp = t_1;
} else if (y <= 5e-127) {
tmp = t_2;
} else if (y <= 5.0) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 2.0d0 + ((y * 0.5d0) - sqrt(y))
t_2 = ((y * 0.5d0) + 3.0d0) - sqrt(y)
if (y <= 3.4d-190) then
tmp = t_2
else if (y <= 5.8d-145) then
tmp = t_1
else if (y <= 5d-127) then
tmp = t_2
else if (y <= 5.0d0) then
tmp = t_1
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 t_1 = 2.0 + ((y * 0.5) - Math.sqrt(y));
double t_2 = ((y * 0.5) + 3.0) - Math.sqrt(y);
double tmp;
if (y <= 3.4e-190) {
tmp = t_2;
} else if (y <= 5.8e-145) {
tmp = t_1;
} else if (y <= 5e-127) {
tmp = t_2;
} else if (y <= 5.0) {
tmp = t_1;
} 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): t_1 = 2.0 + ((y * 0.5) - math.sqrt(y)) t_2 = ((y * 0.5) + 3.0) - math.sqrt(y) tmp = 0 if y <= 3.4e-190: tmp = t_2 elif y <= 5.8e-145: tmp = t_1 elif y <= 5e-127: tmp = t_2 elif y <= 5.0: tmp = t_1 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) t_1 = Float64(2.0 + Float64(Float64(y * 0.5) - sqrt(y))) t_2 = Float64(Float64(Float64(y * 0.5) + 3.0) - sqrt(y)) tmp = 0.0 if (y <= 3.4e-190) tmp = t_2; elseif (y <= 5.8e-145) tmp = t_1; elseif (y <= 5e-127) tmp = t_2; elseif (y <= 5.0) tmp = t_1; 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)
t_1 = 2.0 + ((y * 0.5) - sqrt(y));
t_2 = ((y * 0.5) + 3.0) - sqrt(y);
tmp = 0.0;
if (y <= 3.4e-190)
tmp = t_2;
elseif (y <= 5.8e-145)
tmp = t_1;
elseif (y <= 5e-127)
tmp = t_2;
elseif (y <= 5.0)
tmp = t_1;
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_] := Block[{t$95$1 = N[(2.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * 0.5), $MachinePrecision] + 3.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.4e-190], t$95$2, If[LessEqual[y, 5.8e-145], t$95$1, If[LessEqual[y, 5e-127], t$95$2, If[LessEqual[y, 5.0], t$95$1, 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}
t_1 := 2 + \left(y \cdot 0.5 - \sqrt{y}\right)\\
t_2 := \left(y \cdot 0.5 + 3\right) - \sqrt{y}\\
\mathbf{if}\;y \leq 3.4 \cdot 10^{-190}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-145}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-127}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 5:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3.39999999999999981e-190 or 5.79999999999999968e-145 < y < 4.9999999999999997e-127Initial program 97.5%
associate-+l+97.4%
associate-+l+97.4%
+-commutative97.4%
+-commutative97.4%
associate-+l-86.2%
+-commutative86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in t around inf 45.4%
Taylor expanded in x around 0 28.7%
Taylor expanded in y around 0 28.7%
*-commutative28.7%
Simplified28.7%
Taylor expanded in z around 0 44.0%
if 3.39999999999999981e-190 < y < 5.79999999999999968e-145 or 4.9999999999999997e-127 < y < 5Initial program 98.1%
associate-+l+98.1%
associate-+l+98.1%
+-commutative98.1%
+-commutative98.1%
associate-+l-79.1%
+-commutative79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in t around inf 59.6%
Taylor expanded in x around 0 32.3%
Taylor expanded in y around 0 32.3%
*-commutative32.3%
Simplified32.3%
Taylor expanded in z around inf 42.4%
associate--l+42.4%
*-commutative42.4%
Simplified42.4%
if 5 < y Initial program 90.4%
+-commutative90.4%
associate-+r+90.4%
+-commutative90.4%
associate-+r+90.4%
associate-+r+90.4%
+-commutative90.4%
associate-+l-71.8%
Simplified13.1%
Taylor expanded in t around inf 4.9%
associate--l+19.5%
+-commutative19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in z around inf 18.2%
+-commutative18.2%
Simplified18.2%
Taylor expanded in y around inf 17.8%
Final simplification29.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 0.45) (- (+ (* y 0.5) 3.0) (sqrt y)) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.45) {
tmp = ((y * 0.5) + 3.0) - sqrt(y);
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.45d0) then
tmp = ((y * 0.5d0) + 3.0d0) - sqrt(y)
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.45) {
tmp = ((y * 0.5) + 3.0) - Math.sqrt(y);
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.45: tmp = ((y * 0.5) + 3.0) - math.sqrt(y) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.45) tmp = Float64(Float64(Float64(y * 0.5) + 3.0) - sqrt(y)); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.45)
tmp = ((y * 0.5) + 3.0) - sqrt(y);
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.45], N[(N[(N[(y * 0.5), $MachinePrecision] + 3.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.45:\\
\;\;\;\;\left(y \cdot 0.5 + 3\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.450000000000000011Initial program 97.9%
associate-+l+97.9%
associate-+l+97.9%
+-commutative97.9%
+-commutative97.9%
associate-+l-63.1%
+-commutative63.1%
+-commutative63.1%
Simplified63.1%
Taylor expanded in t around inf 55.2%
Taylor expanded in x around 0 27.6%
Taylor expanded in y around 0 26.1%
*-commutative26.1%
Simplified26.1%
Taylor expanded in z around 0 25.2%
if 0.450000000000000011 < z Initial program 89.2%
associate-+l+89.2%
associate-+l+89.2%
+-commutative89.2%
+-commutative89.2%
associate-+l-87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 41.5%
Taylor expanded in x around 0 5.5%
expm1-log1p-u5.6%
expm1-udef5.6%
log1p-udef5.6%
add-exp-log5.5%
Applied egg-rr5.5%
Taylor expanded in z around inf 29.6%
associate--l+51.4%
Simplified51.4%
Final simplification37.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 (<= z 3e+15) (+ (sqrt (+ z 1.0)) (- 2.0 (sqrt z))) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = sqrt((z + 1.0)) + (2.0 - sqrt(z));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3d+15) then
tmp = sqrt((z + 1.0d0)) + (2.0d0 - sqrt(z))
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3e+15) {
tmp = Math.sqrt((z + 1.0)) + (2.0 - Math.sqrt(z));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3e+15: tmp = math.sqrt((z + 1.0)) + (2.0 - math.sqrt(z)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3e+15) tmp = Float64(sqrt(Float64(z + 1.0)) + Float64(2.0 - sqrt(z))); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3e+15)
tmp = sqrt((z + 1.0)) + (2.0 - sqrt(z));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3e+15], N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[(2.0 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3 \cdot 10^{+15}:\\
\;\;\;\;\sqrt{z + 1} + \left(2 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 3e15Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in t around inf 55.0%
Taylor expanded in x around 0 27.3%
Taylor expanded in y around 0 45.0%
+-commutative45.0%
associate--l+45.0%
Simplified45.0%
if 3e15 < z Initial program 89.3%
associate-+l+89.3%
associate-+l+89.3%
+-commutative89.3%
+-commutative89.3%
associate-+l-89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
Taylor expanded in t around inf 40.7%
Taylor expanded in x around 0 4.3%
expm1-log1p-u4.4%
expm1-udef4.4%
log1p-udef4.4%
add-exp-log4.3%
Applied egg-rr4.3%
Taylor expanded in z around inf 30.7%
associate--l+53.5%
Simplified53.5%
Final simplification48.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 0.72) (- (+ (* y 0.5) 3.0) (sqrt y)) (+ 2.0 (- (* y 0.5) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.72) {
tmp = ((y * 0.5) + 3.0) - sqrt(y);
} else {
tmp = 2.0 + ((y * 0.5) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 0.72d0) then
tmp = ((y * 0.5d0) + 3.0d0) - sqrt(y)
else
tmp = 2.0d0 + ((y * 0.5d0) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.72) {
tmp = ((y * 0.5) + 3.0) - Math.sqrt(y);
} else {
tmp = 2.0 + ((y * 0.5) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 0.72: tmp = ((y * 0.5) + 3.0) - math.sqrt(y) else: tmp = 2.0 + ((y * 0.5) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 0.72) tmp = Float64(Float64(Float64(y * 0.5) + 3.0) - sqrt(y)); else tmp = Float64(2.0 + Float64(Float64(y * 0.5) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 0.72)
tmp = ((y * 0.5) + 3.0) - sqrt(y);
else
tmp = 2.0 + ((y * 0.5) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 0.72], N[(N[(N[(y * 0.5), $MachinePrecision] + 3.0), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.72:\\
\;\;\;\;\left(y \cdot 0.5 + 3\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;2 + \left(y \cdot 0.5 - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.71999999999999997Initial program 97.9%
associate-+l+97.9%
associate-+l+97.9%
+-commutative97.9%
+-commutative97.9%
associate-+l-63.1%
+-commutative63.1%
+-commutative63.1%
Simplified63.1%
Taylor expanded in t around inf 55.2%
Taylor expanded in x around 0 27.6%
Taylor expanded in y around 0 26.1%
*-commutative26.1%
Simplified26.1%
Taylor expanded in z around 0 25.2%
if 0.71999999999999997 < z Initial program 89.2%
associate-+l+89.2%
associate-+l+89.2%
+-commutative89.2%
+-commutative89.2%
associate-+l-87.6%
+-commutative87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 41.5%
Taylor expanded in x around 0 5.5%
Taylor expanded in y around 0 6.1%
*-commutative6.1%
Simplified6.1%
Taylor expanded in z around inf 29.9%
associate--l+29.9%
*-commutative29.9%
Simplified29.9%
Final simplification27.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 2.0 (- (* y 0.5) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 2.0 + ((y * 0.5) - 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 = 2.0d0 + ((y * 0.5d0) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 2.0 + ((y * 0.5) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 2.0 + ((y * 0.5) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(2.0 + Float64(Float64(y * 0.5) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 2.0 + ((y * 0.5) - 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[(2.0 + N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
2 + \left(y \cdot 0.5 - \sqrt{y}\right)
\end{array}
Initial program 93.8%
associate-+l+93.8%
associate-+l+93.8%
+-commutative93.8%
+-commutative93.8%
associate-+l-74.5%
+-commutative74.5%
+-commutative74.5%
Simplified74.5%
Taylor expanded in t around inf 48.8%
Taylor expanded in x around 0 17.4%
Taylor expanded in y around 0 16.8%
*-commutative16.8%
Simplified16.8%
Taylor expanded in z around inf 21.5%
associate--l+21.5%
*-commutative21.5%
Simplified21.5%
Final simplification21.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* y 0.5))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return y * 0.5;
}
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 = y * 0.5d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return y * 0.5;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return y * 0.5
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(y * 0.5) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = y * 0.5;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
y \cdot 0.5
\end{array}
Initial program 93.8%
associate-+l+93.8%
associate-+l+93.8%
+-commutative93.8%
+-commutative93.8%
associate-+l-74.5%
+-commutative74.5%
+-commutative74.5%
Simplified74.5%
Taylor expanded in t around inf 48.8%
Taylor expanded in x around 0 17.4%
Taylor expanded in y around 0 16.8%
*-commutative16.8%
Simplified16.8%
Taylor expanded in y around inf 5.3%
*-commutative5.3%
Simplified5.3%
Final simplification5.3%
(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 2023332
(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))))