
(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 16 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 (+ x 1.0))))
(if (<= (- t_1 (sqrt x)) 5e-6)
(/ 1.0 (+ (sqrt x) t_1))
(+
(+ t_1 (- (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (sqrt x)))
(+
(/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z))))
(- (sqrt (+ 1.0 t)) (sqrt t)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if ((t_1 - sqrt(x)) <= 5e-6) {
tmp = 1.0 / (sqrt(x) + t_1);
} else {
tmp = (t_1 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - sqrt(x))) + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if ((t_1 - sqrt(x)) <= 5d-6) then
tmp = 1.0d0 / (sqrt(x) + t_1)
else
tmp = (t_1 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) - sqrt(x))) + ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + t)) - sqrt(t)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 5e-6) {
tmp = 1.0 / (Math.sqrt(x) + t_1);
} else {
tmp = (t_1 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) - Math.sqrt(x))) + ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if (t_1 - math.sqrt(x)) <= 5e-6: tmp = 1.0 / (math.sqrt(x) + t_1) else: tmp = (t_1 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) - math.sqrt(x))) + ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 5e-6) tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); else tmp = Float64(Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) - sqrt(x))) + Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 5e-6)
tmp = 1.0 / (sqrt(x) + t_1);
else
tmp = (t_1 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - sqrt(x))) + ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 5e-6], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;t_1 - \sqrt{x} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\right) + \left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 5.00000000000000041e-6Initial program 87.4%
associate-+l+87.4%
+-commutative87.4%
associate-+r-45.0%
associate-+l-7.9%
+-commutative7.9%
associate--l+7.9%
+-commutative7.9%
Simplified6.8%
Taylor expanded in t around inf 6.3%
+-commutative6.3%
+-commutative6.3%
associate--l+6.8%
Simplified6.8%
Taylor expanded in z around inf 5.9%
+-commutative5.9%
Simplified5.9%
Taylor expanded in y around inf 3.2%
flip--3.2%
add-sqr-sqrt4.1%
add-sqr-sqrt3.2%
Applied egg-rr3.2%
associate--l+10.0%
+-inverses10.0%
metadata-eval10.0%
+-commutative10.0%
Simplified10.0%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 98.0%
associate-+l+98.0%
associate-+l-98.0%
+-commutative98.0%
sub-neg98.0%
sub-neg98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--98.0%
add-sqr-sqrt76.0%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
Simplified98.6%
flip--98.8%
add-sqr-sqrt81.7%
+-commutative81.7%
add-sqr-sqrt98.8%
+-commutative98.8%
Applied egg-rr98.8%
Taylor expanded in z around 0 99.1%
Final simplification60.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
(if (<= (+ (- t_1 (sqrt x)) (- t_2 (sqrt y))) 1.0)
(/ 1.0 (+ (sqrt x) t_1))
(+
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 (/ 1.0 (+ t_2 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 1.0) {
tmp = 1.0 / (sqrt(x) + t_1);
} else {
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (1.0 / (t_2 + 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((x + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 1.0d0) then
tmp = 1.0d0 / (sqrt(x) + t_1)
else
tmp = ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + (1.0d0 / (t_2 + 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((x + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (((t_1 - Math.sqrt(x)) + (t_2 - Math.sqrt(y))) <= 1.0) {
tmp = 1.0 / (Math.sqrt(x) + t_1);
} else {
tmp = ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + (1.0 / (t_2 + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if ((t_1 - math.sqrt(x)) + (t_2 - math.sqrt(y))) <= 1.0: tmp = 1.0 / (math.sqrt(x) + t_1) else: tmp = ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + (1.0 / (t_2 + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (Float64(Float64(t_1 - sqrt(x)) + Float64(t_2 - sqrt(y))) <= 1.0) tmp = Float64(1.0 / Float64(sqrt(x) + t_1)); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(1.0 + Float64(1.0 / Float64(t_2 + 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((x + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (((t_1 - sqrt(x)) + (t_2 - sqrt(y))) <= 1.0)
tmp = 1.0 / (sqrt(x) + t_1);
else
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + (1.0 / (t_2 + 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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(1.0 / N[(t$95$2 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;\left(t_1 - \sqrt{x}\right) + \left(t_2 - \sqrt{y}\right) \leq 1:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + \frac{1}{t_2 + \sqrt{y}}\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1Initial program 91.0%
associate-+l+91.0%
+-commutative91.0%
associate-+r-64.3%
associate-+l-41.0%
+-commutative41.0%
associate--l+41.0%
+-commutative41.0%
Simplified31.3%
Taylor expanded in t around inf 25.6%
+-commutative25.6%
+-commutative25.6%
associate--l+26.2%
Simplified26.2%
Taylor expanded in z around inf 14.9%
+-commutative14.9%
Simplified14.9%
Taylor expanded in y around inf 13.6%
flip--13.6%
add-sqr-sqrt14.2%
add-sqr-sqrt13.6%
Applied egg-rr13.6%
associate--l+17.9%
+-inverses17.9%
metadata-eval17.9%
+-commutative17.9%
Simplified17.9%
if 1 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 98.8%
associate-+l+98.8%
associate-+l-98.8%
+-commutative98.8%
sub-neg98.8%
sub-neg98.8%
+-commutative98.8%
+-commutative98.8%
Simplified98.8%
flip--98.8%
add-sqr-sqrt98.7%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate--l+98.7%
+-inverses98.7%
metadata-eval98.7%
Simplified98.7%
flip--98.8%
add-sqr-sqrt78.7%
+-commutative78.7%
add-sqr-sqrt98.8%
+-commutative98.8%
Applied egg-rr98.8%
Taylor expanded in z around 0 99.0%
Taylor expanded in x around 0 94.8%
Final simplification41.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 6.8e-40)
(+
2.0
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (- (+ 1.0 z) z) (+ (sqrt z) t_1))))
(if (<= y 3.3e+37)
(+
(+ t_2 (- (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (sqrt x)))
(- t_1 (sqrt z)))
(/ 1.0 (+ (sqrt x) 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 + z));
double t_2 = sqrt((x + 1.0));
double tmp;
if (y <= 6.8e-40) {
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt(z) + t_1)));
} else if (y <= 3.3e+37) {
tmp = (t_2 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - sqrt(x))) + (t_1 - sqrt(z));
} else {
tmp = 1.0 / (sqrt(x) + 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) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((x + 1.0d0))
if (y <= 6.8d-40) then
tmp = 2.0d0 + ((sqrt((1.0d0 + t)) - sqrt(t)) + (((1.0d0 + z) - z) / (sqrt(z) + t_1)))
else if (y <= 3.3d+37) then
tmp = (t_2 + ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) - sqrt(x))) + (t_1 - sqrt(z))
else
tmp = 1.0d0 / (sqrt(x) + 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 + z));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 6.8e-40) {
tmp = 2.0 + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / (Math.sqrt(z) + t_1)));
} else if (y <= 3.3e+37) {
tmp = (t_2 + ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) - Math.sqrt(x))) + (t_1 - Math.sqrt(z));
} else {
tmp = 1.0 / (Math.sqrt(x) + 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 + z)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if y <= 6.8e-40: tmp = 2.0 + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / (math.sqrt(z) + t_1))) elif y <= 3.3e+37: tmp = (t_2 + ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) - math.sqrt(x))) + (t_1 - math.sqrt(z)) else: tmp = 1.0 / (math.sqrt(x) + 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 + z)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 6.8e-40) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / Float64(sqrt(z) + t_1)))); elseif (y <= 3.3e+37) tmp = Float64(Float64(t_2 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) - sqrt(x))) + Float64(t_1 - sqrt(z))); else tmp = Float64(1.0 / Float64(sqrt(x) + 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 + z));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 6.8e-40)
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / (sqrt(z) + t_1)));
elseif (y <= 3.3e+37)
tmp = (t_2 + ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) - sqrt(x))) + (t_1 - sqrt(z));
else
tmp = 1.0 / (sqrt(x) + 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6.8e-40], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+37], N[(N[(t$95$2 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 6.8 \cdot 10^{-40}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{\sqrt{z} + t_1}\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+37}:\\
\;\;\;\;\left(t_2 + \left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} - \sqrt{x}\right)\right) + \left(t_1 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t_2}\\
\end{array}
\end{array}
if y < 6.79999999999999968e-40Initial program 97.7%
associate-+l+97.7%
associate-+l-66.4%
+-commutative66.4%
sub-neg66.4%
sub-neg66.4%
+-commutative66.4%
+-commutative66.4%
Simplified66.4%
Taylor expanded in x around 0 63.3%
Taylor expanded in y around 0 63.3%
flip--66.4%
add-sqr-sqrt53.8%
+-commutative53.8%
add-sqr-sqrt66.4%
+-commutative66.4%
Applied egg-rr63.4%
if 6.79999999999999968e-40 < y < 3.3000000000000001e37Initial program 83.2%
associate-+l+83.2%
associate-+l-55.4%
+-commutative55.4%
sub-neg55.4%
sub-neg55.4%
+-commutative55.4%
+-commutative55.4%
Simplified55.4%
flip--55.4%
add-sqr-sqrt45.3%
add-sqr-sqrt55.3%
Applied egg-rr55.3%
associate--l+58.0%
+-inverses58.0%
metadata-eval58.0%
Simplified58.0%
Taylor expanded in t around inf 39.5%
if 3.3000000000000001e37 < y Initial program 91.3%
associate-+l+91.3%
+-commutative91.3%
associate-+r-91.3%
associate-+l-58.3%
+-commutative58.3%
associate--l+58.3%
+-commutative58.3%
Simplified44.6%
Taylor expanded in t around inf 35.7%
+-commutative35.7%
+-commutative35.7%
associate--l+35.9%
Simplified35.9%
Taylor expanded in z around inf 20.5%
+-commutative20.5%
Simplified20.5%
Taylor expanded in y around inf 20.3%
flip--20.3%
add-sqr-sqrt20.7%
add-sqr-sqrt20.3%
Applied egg-rr20.3%
associate--l+25.4%
+-inverses25.4%
metadata-eval25.4%
+-commutative25.4%
Simplified25.4%
Final simplification45.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 990000000000.0)
(+
(- (+ 1.0 (sqrt (+ 1.0 y))) (sqrt y))
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 990000000000.0) {
tmp = ((1.0 + sqrt((1.0 + y))) - sqrt(y)) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 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 (y <= 990000000000.0d0) then
tmp = ((1.0d0 + sqrt((1.0d0 + y))) - sqrt(y)) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 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 (y <= 990000000000.0) {
tmp = ((1.0 + Math.sqrt((1.0 + y))) - Math.sqrt(y)) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 990000000000.0: tmp = ((1.0 + math.sqrt((1.0 + y))) - math.sqrt(y)) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 990000000000.0) tmp = Float64(Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - sqrt(y)) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 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 (y <= 990000000000.0)
tmp = ((1.0 + sqrt((1.0 + y))) - sqrt(y)) + ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 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[y, 990000000000.0], N[(N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 990000000000:\\
\;\;\;\;\left(\left(1 + \sqrt{1 + y}\right) - \sqrt{y}\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 9.9e11Initial program 96.6%
associate-+l+96.6%
associate-+l-63.2%
+-commutative63.2%
sub-neg63.2%
sub-neg63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in x around 0 60.7%
if 9.9e11 < y Initial program 89.4%
associate-+l+89.4%
+-commutative89.4%
associate-+r-89.4%
associate-+l-58.9%
+-commutative58.9%
associate--l+58.9%
+-commutative58.9%
Simplified45.3%
Taylor expanded in t around inf 36.8%
+-commutative36.8%
+-commutative36.8%
associate--l+36.9%
Simplified36.9%
Taylor expanded in z around inf 19.7%
+-commutative19.7%
Simplified19.7%
Taylor expanded in y around inf 19.5%
flip--19.5%
add-sqr-sqrt19.9%
add-sqr-sqrt19.5%
Applied egg-rr19.5%
associate--l+24.2%
+-inverses24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Final simplification44.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= y 8.4e-85)
(+
2.0
(+ (- t_1 (sqrt z)) (/ (- (+ 1.0 t) t) (+ (sqrt t) (sqrt (+ 1.0 t))))))
(if (<= y 990000000000.0)
(+ 1.0 (+ (sqrt (+ 1.0 y)) (- (/ 1.0 (+ (sqrt z) t_1)) (sqrt y))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (y <= 8.4e-85) {
tmp = 2.0 + ((t_1 - sqrt(z)) + (((1.0 + t) - t) / (sqrt(t) + sqrt((1.0 + t)))));
} else if (y <= 990000000000.0) {
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / (sqrt(z) + t_1)) - sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (y <= 8.4d-85) then
tmp = 2.0d0 + ((t_1 - sqrt(z)) + (((1.0d0 + t) - t) / (sqrt(t) + sqrt((1.0d0 + t)))))
else if (y <= 990000000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((1.0d0 / (sqrt(z) + t_1)) - sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 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 t_1 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 8.4e-85) {
tmp = 2.0 + ((t_1 - Math.sqrt(z)) + (((1.0 + t) - t) / (Math.sqrt(t) + Math.sqrt((1.0 + t)))));
} else if (y <= 990000000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((1.0 / (Math.sqrt(z) + t_1)) - Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if y <= 8.4e-85: tmp = 2.0 + ((t_1 - math.sqrt(z)) + (((1.0 + t) - t) / (math.sqrt(t) + math.sqrt((1.0 + t))))) elif y <= 990000000000.0: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((1.0 / (math.sqrt(z) + t_1)) - math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 8.4e-85) tmp = Float64(2.0 + Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(Float64(1.0 + t) - t) / Float64(sqrt(t) + sqrt(Float64(1.0 + t)))))); elseif (y <= 990000000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(1.0 / Float64(sqrt(z) + t_1)) - sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 8.4e-85)
tmp = 2.0 + ((t_1 - sqrt(z)) + (((1.0 + t) - t) / (sqrt(t) + sqrt((1.0 + t)))));
elseif (y <= 990000000000.0)
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / (sqrt(z) + t_1)) - sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 8.4e-85], N[(2.0 + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + t), $MachinePrecision] - t), $MachinePrecision] / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 990000000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 8.4 \cdot 10^{-85}:\\
\;\;\;\;2 + \left(\left(t_1 - \sqrt{z}\right) + \frac{\left(1 + t\right) - t}{\sqrt{t} + \sqrt{1 + t}}\right)\\
\mathbf{elif}\;y \leq 990000000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\frac{1}{\sqrt{z} + t_1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 8.3999999999999999e-85Initial program 97.8%
associate-+l+97.8%
associate-+l-66.5%
+-commutative66.5%
sub-neg66.5%
sub-neg66.5%
+-commutative66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in x around 0 63.2%
Taylor expanded in y around 0 63.2%
flip--63.2%
add-sqr-sqrt53.1%
+-commutative53.1%
add-sqr-sqrt63.2%
+-commutative63.2%
Applied egg-rr63.2%
if 8.3999999999999999e-85 < y < 9.9e11Initial program 92.8%
associate-+l+92.8%
+-commutative92.8%
associate-+r-53.1%
associate-+l-46.0%
+-commutative46.0%
associate--l+46.0%
+-commutative46.0%
Simplified33.4%
Taylor expanded in t around inf 26.6%
+-commutative26.6%
+-commutative26.6%
associate--l+26.0%
Simplified26.0%
flip--26.0%
add-sqr-sqrt23.0%
add-sqr-sqrt26.0%
+-commutative26.0%
+-commutative26.0%
Applied egg-rr26.0%
+-commutative26.0%
associate--r+26.0%
+-inverses26.0%
metadata-eval26.0%
+-commutative26.0%
rem-square-sqrt26.0%
hypot-1-def26.0%
Simplified26.0%
Taylor expanded in x around 0 46.8%
associate--l+46.7%
associate--l+46.8%
+-commutative46.8%
Simplified46.8%
if 9.9e11 < y Initial program 89.4%
associate-+l+89.4%
+-commutative89.4%
associate-+r-89.4%
associate-+l-58.9%
+-commutative58.9%
associate--l+58.9%
+-commutative58.9%
Simplified45.3%
Taylor expanded in t around inf 36.8%
+-commutative36.8%
+-commutative36.8%
associate--l+36.9%
Simplified36.9%
Taylor expanded in z around inf 19.7%
+-commutative19.7%
Simplified19.7%
Taylor expanded in y around inf 19.5%
flip--19.5%
add-sqr-sqrt19.9%
add-sqr-sqrt19.5%
Applied egg-rr19.5%
associate--l+24.2%
+-inverses24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Final simplification43.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 z) (sqrt (+ 1.0 z)))))
(if (<= y 5.5e-85)
(+ 2.0 (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ (- (+ 1.0 z) z) t_1)))
(if (<= y 990000000000.0)
(+ 1.0 (+ (sqrt (+ 1.0 y)) (- (/ 1.0 t_1) (sqrt y))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(z) + sqrt((1.0 + z));
double tmp;
if (y <= 5.5e-85) {
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / t_1));
} else if (y <= 990000000000.0) {
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / t_1) - sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 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) :: t_1
real(8) :: tmp
t_1 = sqrt(z) + sqrt((1.0d0 + z))
if (y <= 5.5d-85) then
tmp = 2.0d0 + ((sqrt((1.0d0 + t)) - sqrt(t)) + (((1.0d0 + z) - z) / t_1))
else if (y <= 990000000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((1.0d0 / t_1) - sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 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 t_1 = Math.sqrt(z) + Math.sqrt((1.0 + z));
double tmp;
if (y <= 5.5e-85) {
tmp = 2.0 + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (((1.0 + z) - z) / t_1));
} else if (y <= 990000000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((1.0 / t_1) - Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(z) + math.sqrt((1.0 + z)) tmp = 0 if y <= 5.5e-85: tmp = 2.0 + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (((1.0 + z) - z) / t_1)) elif y <= 990000000000.0: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((1.0 / t_1) - math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(z) + sqrt(Float64(1.0 + z))) tmp = 0.0 if (y <= 5.5e-85) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(Float64(Float64(1.0 + z) - z) / t_1))); elseif (y <= 990000000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(1.0 / t_1) - sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); 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) + sqrt((1.0 + z));
tmp = 0.0;
if (y <= 5.5e-85)
tmp = 2.0 + ((sqrt((1.0 + t)) - sqrt(t)) + (((1.0 + z) - z) / t_1));
elseif (y <= 990000000000.0)
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / t_1) - sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 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_] := Block[{t$95$1 = N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.5e-85], N[(2.0 + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 + z), $MachinePrecision] - z), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 990000000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / t$95$1), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z} + \sqrt{1 + z}\\
\mathbf{if}\;y \leq 5.5 \cdot 10^{-85}:\\
\;\;\;\;2 + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{\left(1 + z\right) - z}{t_1}\right)\\
\mathbf{elif}\;y \leq 990000000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\frac{1}{t_1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 5.4999999999999997e-85Initial program 97.8%
associate-+l+97.8%
associate-+l-66.5%
+-commutative66.5%
sub-neg66.5%
sub-neg66.5%
+-commutative66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in x around 0 63.2%
Taylor expanded in y around 0 63.2%
flip--66.5%
add-sqr-sqrt53.3%
+-commutative53.3%
add-sqr-sqrt66.5%
+-commutative66.5%
Applied egg-rr63.2%
if 5.4999999999999997e-85 < y < 9.9e11Initial program 92.8%
associate-+l+92.8%
+-commutative92.8%
associate-+r-53.1%
associate-+l-46.0%
+-commutative46.0%
associate--l+46.0%
+-commutative46.0%
Simplified33.4%
Taylor expanded in t around inf 26.6%
+-commutative26.6%
+-commutative26.6%
associate--l+26.0%
Simplified26.0%
flip--26.0%
add-sqr-sqrt23.0%
add-sqr-sqrt26.0%
+-commutative26.0%
+-commutative26.0%
Applied egg-rr26.0%
+-commutative26.0%
associate--r+26.0%
+-inverses26.0%
metadata-eval26.0%
+-commutative26.0%
rem-square-sqrt26.0%
hypot-1-def26.0%
Simplified26.0%
Taylor expanded in x around 0 46.8%
associate--l+46.7%
associate--l+46.8%
+-commutative46.8%
Simplified46.8%
if 9.9e11 < y Initial program 89.4%
associate-+l+89.4%
+-commutative89.4%
associate-+r-89.4%
associate-+l-58.9%
+-commutative58.9%
associate--l+58.9%
+-commutative58.9%
Simplified45.3%
Taylor expanded in t around inf 36.8%
+-commutative36.8%
+-commutative36.8%
associate--l+36.9%
Simplified36.9%
Taylor expanded in z around inf 19.7%
+-commutative19.7%
Simplified19.7%
Taylor expanded in y around inf 19.5%
flip--19.5%
add-sqr-sqrt19.9%
add-sqr-sqrt19.5%
Applied egg-rr19.5%
associate--l+24.2%
+-inverses24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Final simplification43.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 z))))
(if (<= y 8.4e-85)
(+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- t_1 (sqrt z))) 2.0)
(if (<= y 990000000000.0)
(+ 1.0 (+ (sqrt (+ 1.0 y)) (- (/ 1.0 (+ (sqrt z) t_1)) (sqrt y))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (y <= 8.4e-85) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z))) + 2.0;
} else if (y <= 990000000000.0) {
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / (sqrt(z) + t_1)) - sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 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) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (y <= 8.4d-85) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (t_1 - sqrt(z))) + 2.0d0
else if (y <= 990000000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) + ((1.0d0 / (sqrt(z) + t_1)) - sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 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 t_1 = Math.sqrt((1.0 + z));
double tmp;
if (y <= 8.4e-85) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (t_1 - Math.sqrt(z))) + 2.0;
} else if (y <= 990000000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) + ((1.0 / (Math.sqrt(z) + t_1)) - Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if y <= 8.4e-85: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (t_1 - math.sqrt(z))) + 2.0 elif y <= 990000000000.0: tmp = 1.0 + (math.sqrt((1.0 + y)) + ((1.0 / (math.sqrt(z) + t_1)) - math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (y <= 8.4e-85) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(t_1 - sqrt(z))) + 2.0); elseif (y <= 990000000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(1.0 / Float64(sqrt(z) + t_1)) - sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (y <= 8.4e-85)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (t_1 - sqrt(z))) + 2.0;
elseif (y <= 990000000000.0)
tmp = 1.0 + (sqrt((1.0 + y)) + ((1.0 / (sqrt(z) + t_1)) - sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 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_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 8.4e-85], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 990000000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 8.4 \cdot 10^{-85}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(t_1 - \sqrt{z}\right)\right) + 2\\
\mathbf{elif}\;y \leq 990000000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} + \left(\frac{1}{\sqrt{z} + t_1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 8.3999999999999999e-85Initial program 97.8%
associate-+l+97.8%
associate-+l-66.5%
+-commutative66.5%
sub-neg66.5%
sub-neg66.5%
+-commutative66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in x around 0 63.2%
Taylor expanded in y around 0 63.2%
if 8.3999999999999999e-85 < y < 9.9e11Initial program 92.8%
associate-+l+92.8%
+-commutative92.8%
associate-+r-53.1%
associate-+l-46.0%
+-commutative46.0%
associate--l+46.0%
+-commutative46.0%
Simplified33.4%
Taylor expanded in t around inf 26.6%
+-commutative26.6%
+-commutative26.6%
associate--l+26.0%
Simplified26.0%
flip--26.0%
add-sqr-sqrt23.0%
add-sqr-sqrt26.0%
+-commutative26.0%
+-commutative26.0%
Applied egg-rr26.0%
+-commutative26.0%
associate--r+26.0%
+-inverses26.0%
metadata-eval26.0%
+-commutative26.0%
rem-square-sqrt26.0%
hypot-1-def26.0%
Simplified26.0%
Taylor expanded in x around 0 46.8%
associate--l+46.7%
associate--l+46.8%
+-commutative46.8%
Simplified46.8%
if 9.9e11 < y Initial program 89.4%
associate-+l+89.4%
+-commutative89.4%
associate-+r-89.4%
associate-+l-58.9%
+-commutative58.9%
associate--l+58.9%
+-commutative58.9%
Simplified45.3%
Taylor expanded in t around inf 36.8%
+-commutative36.8%
+-commutative36.8%
associate--l+36.9%
Simplified36.9%
Taylor expanded in z around inf 19.7%
+-commutative19.7%
Simplified19.7%
Taylor expanded in y around inf 19.5%
flip--19.5%
add-sqr-sqrt19.9%
add-sqr-sqrt19.5%
Applied egg-rr19.5%
associate--l+24.2%
+-inverses24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Final simplification43.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.4e-20)
(+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt (+ 1.0 z)) (sqrt z))) 2.0)
(if (<= y 5e+18)
(+ (+ 1.0 (* x 0.5)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-20) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + 2.0;
} else if (y <= 5e+18) {
tmp = (1.0 + (x * 0.5)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt(x) + sqrt((x + 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 (y <= 1.4d-20) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (sqrt((1.0d0 + z)) - sqrt(z))) + 2.0d0
else if (y <= 5d+18) then
tmp = (1.0d0 + (x * 0.5d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt(x) + sqrt((x + 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 (y <= 1.4e-20) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (Math.sqrt((1.0 + z)) - Math.sqrt(z))) + 2.0;
} else if (y <= 5e+18) {
tmp = (1.0 + (x * 0.5)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.4e-20: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (math.sqrt((1.0 + z)) - math.sqrt(z))) + 2.0 elif y <= 5e+18: tmp = (1.0 + (x * 0.5)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt(x) + math.sqrt((x + 1.0))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.4e-20) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) + 2.0); elseif (y <= 5e+18) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 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 (y <= 1.4e-20)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (sqrt((1.0 + z)) - sqrt(z))) + 2.0;
elseif (y <= 5e+18)
tmp = (1.0 + (x * 0.5)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt(x) + sqrt((x + 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[y, 1.4e-20], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 5e+18], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + 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[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-20}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\right) + 2\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+18}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}}\\
\end{array}
\end{array}
if y < 1.4000000000000001e-20Initial program 97.5%
associate-+l+97.5%
associate-+l-64.6%
+-commutative64.6%
sub-neg64.6%
sub-neg64.6%
+-commutative64.6%
+-commutative64.6%
Simplified64.6%
Taylor expanded in x around 0 62.2%
Taylor expanded in y around 0 62.1%
if 1.4000000000000001e-20 < y < 5e18Initial program 82.7%
associate-+l+82.7%
+-commutative82.7%
associate-+r-46.4%
associate-+l-35.5%
+-commutative35.5%
associate--l+35.5%
+-commutative35.5%
Simplified33.6%
Taylor expanded in t around inf 36.1%
+-commutative36.1%
+-commutative36.1%
associate--l+35.5%
Simplified35.5%
Taylor expanded in z around inf 16.5%
+-commutative16.5%
Simplified16.5%
Taylor expanded in x around 0 17.3%
if 5e18 < y Initial program 89.5%
associate-+l+89.5%
+-commutative89.5%
associate-+r-89.5%
associate-+l-58.8%
+-commutative58.8%
associate--l+58.8%
+-commutative58.8%
Simplified45.0%
Taylor expanded in t around inf 36.5%
+-commutative36.5%
+-commutative36.5%
associate--l+36.6%
Simplified36.6%
Taylor expanded in z around inf 19.8%
+-commutative19.8%
Simplified19.8%
Taylor expanded in y around inf 19.5%
flip--19.5%
add-sqr-sqrt20.0%
add-sqr-sqrt19.5%
Applied egg-rr19.5%
associate--l+24.2%
+-inverses24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Final simplification43.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 1.45e-29)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 138000000000.0)
(+ (+ 1.0 (sqrt (+ 1.0 z))) (- 1.0 (+ (sqrt y) (sqrt z))))
(+ (+ 1.0 (* x 0.5)) (- (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 <= 1.45e-29) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 138000000000.0) {
tmp = (1.0 + sqrt((1.0 + z))) + (1.0 - (sqrt(y) + sqrt(z)));
} else {
tmp = (1.0 + (x * 0.5)) + (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 <= 1.45d-29) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 138000000000.0d0) then
tmp = (1.0d0 + sqrt((1.0d0 + z))) + (1.0d0 - (sqrt(y) + sqrt(z)))
else
tmp = (1.0d0 + (x * 0.5d0)) + (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 <= 1.45e-29) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 138000000000.0) {
tmp = (1.0 + Math.sqrt((1.0 + z))) + (1.0 - (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = (1.0 + (x * 0.5)) + (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 <= 1.45e-29: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 138000000000.0: tmp = (1.0 + math.sqrt((1.0 + z))) + (1.0 - (math.sqrt(y) + math.sqrt(z))) else: tmp = (1.0 + (x * 0.5)) + (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 <= 1.45e-29) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 138000000000.0) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + z))) + Float64(1.0 - Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(1.0 + Float64(x * 0.5)) + 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 <= 1.45e-29)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 138000000000.0)
tmp = (1.0 + sqrt((1.0 + z))) + (1.0 - (sqrt(y) + sqrt(z)));
else
tmp = (1.0 + (x * 0.5)) + (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, 1.45e-29], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 138000000000.0], N[(N[(1.0 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * 0.5), $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 1.45 \cdot 10^{-29}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 138000000000:\\
\;\;\;\;\left(1 + \sqrt{1 + z}\right) + \left(1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 1.45000000000000012e-29Initial program 97.3%
associate-+l+97.3%
associate-+l-80.3%
+-commutative80.3%
sub-neg80.3%
sub-neg80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around 0 56.1%
Taylor expanded in y around 0 39.8%
Taylor expanded in z around 0 23.2%
associate--l+39.8%
Simplified39.8%
if 1.45000000000000012e-29 < z < 1.38e11Initial program 93.9%
associate-+l+94.0%
+-commutative94.0%
associate-+r-84.8%
associate-+l-66.0%
+-commutative66.0%
associate--l+66.0%
+-commutative66.0%
Simplified55.6%
Taylor expanded in t around inf 34.2%
+-commutative34.2%
+-commutative34.2%
associate--l+34.2%
Simplified34.2%
Taylor expanded in x around 0 36.0%
+-commutative36.0%
+-commutative36.0%
associate--l+36.1%
rem-square-sqrt36.4%
hypot-1-def36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around 0 28.8%
if 1.38e11 < z Initial program 88.6%
associate-+l+88.6%
+-commutative88.6%
associate-+r-66.9%
associate-+l-56.1%
+-commutative56.1%
associate--l+56.1%
+-commutative56.1%
Simplified23.6%
Taylor expanded in t around inf 29.5%
+-commutative29.5%
+-commutative29.5%
associate--l+30.7%
Simplified30.7%
Taylor expanded in z around inf 30.3%
+-commutative30.3%
Simplified30.3%
Taylor expanded in x around 0 29.1%
Final simplification34.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 1.3e-29)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 82000000000.0)
(+ (+ 1.0 (sqrt (+ 1.0 z))) (- 1.0 (+ (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 <= 1.3e-29) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 82000000000.0) {
tmp = (1.0 + sqrt((1.0 + z))) + (1.0 - (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 <= 1.3d-29) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 82000000000.0d0) then
tmp = (1.0d0 + sqrt((1.0d0 + z))) + (1.0d0 - (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 <= 1.3e-29) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 82000000000.0) {
tmp = (1.0 + Math.sqrt((1.0 + z))) + (1.0 - (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 <= 1.3e-29: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 82000000000.0: tmp = (1.0 + math.sqrt((1.0 + z))) + (1.0 - (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 <= 1.3e-29) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 82000000000.0) tmp = Float64(Float64(1.0 + sqrt(Float64(1.0 + z))) + Float64(1.0 - 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 <= 1.3e-29)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 82000000000.0)
tmp = (1.0 + sqrt((1.0 + z))) + (1.0 - (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, 1.3e-29], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 82000000000.0], N[(N[(1.0 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - 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 1.3 \cdot 10^{-29}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 82000000000:\\
\;\;\;\;\left(1 + \sqrt{1 + z}\right) + \left(1 - \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.3000000000000001e-29Initial program 97.3%
associate-+l+97.3%
associate-+l-80.3%
+-commutative80.3%
sub-neg80.3%
sub-neg80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around 0 56.1%
Taylor expanded in y around 0 39.8%
Taylor expanded in z around 0 23.2%
associate--l+39.8%
Simplified39.8%
if 1.3000000000000001e-29 < z < 8.2e10Initial program 93.9%
associate-+l+94.0%
+-commutative94.0%
associate-+r-84.8%
associate-+l-66.0%
+-commutative66.0%
associate--l+66.0%
+-commutative66.0%
Simplified55.6%
Taylor expanded in t around inf 34.2%
+-commutative34.2%
+-commutative34.2%
associate--l+34.2%
Simplified34.2%
Taylor expanded in x around 0 36.0%
+-commutative36.0%
+-commutative36.0%
associate--l+36.1%
rem-square-sqrt36.4%
hypot-1-def36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around 0 28.8%
if 8.2e10 < z Initial program 88.6%
associate-+l+88.6%
+-commutative88.6%
associate-+r-66.9%
associate-+l-56.1%
+-commutative56.1%
associate--l+56.1%
+-commutative56.1%
Simplified23.6%
Taylor expanded in t around inf 29.5%
+-commutative29.5%
+-commutative29.5%
associate--l+30.7%
Simplified30.7%
Taylor expanded in z around inf 30.3%
+-commutative30.3%
Simplified30.3%
Taylor expanded in x around 0 29.6%
associate--l+49.2%
Simplified49.2%
Final simplification43.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 1.4e-29)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 4.8e+18)
(+ (hypot 1.0 (sqrt z)) (- 2.0 (sqrt z)))
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.4e-29) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 4.8e+18) {
tmp = hypot(1.0, sqrt(z)) + (2.0 - sqrt(z));
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.4e-29) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 4.8e+18) {
tmp = Math.hypot(1.0, Math.sqrt(z)) + (2.0 - Math.sqrt(z));
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.4e-29: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 4.8e+18: tmp = math.hypot(1.0, math.sqrt(z)) + (2.0 - math.sqrt(z)) else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.4e-29) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 4.8e+18) tmp = Float64(hypot(1.0, sqrt(z)) + 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 <= 1.4e-29)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 4.8e+18)
tmp = hypot(1.0, sqrt(z)) + (2.0 - sqrt(z));
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.4e-29], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 4.8e+18], N[(N[Sqrt[1.0 ^ 2 + N[Sqrt[z], $MachinePrecision] ^ 2], $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 1.4 \cdot 10^{-29}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{hypot}\left(1, \sqrt{z}\right) + \left(2 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.4000000000000001e-29Initial program 97.3%
associate-+l+97.3%
associate-+l-80.3%
+-commutative80.3%
sub-neg80.3%
sub-neg80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around 0 56.1%
Taylor expanded in y around 0 39.8%
Taylor expanded in z around 0 23.2%
associate--l+39.8%
Simplified39.8%
if 1.4000000000000001e-29 < z < 4.8e18Initial program 91.1%
associate-+l+91.2%
+-commutative91.2%
associate-+r-80.4%
associate-+l-62.8%
+-commutative62.8%
associate--l+62.8%
+-commutative62.8%
Simplified50.0%
Taylor expanded in t around inf 34.8%
+-commutative34.8%
+-commutative34.8%
associate--l+34.8%
Simplified34.8%
Taylor expanded in x around 0 35.8%
+-commutative35.8%
+-commutative35.8%
associate--l+35.9%
rem-square-sqrt36.1%
hypot-1-def36.2%
+-commutative36.2%
Simplified36.2%
Taylor expanded in y around 0 50.4%
+-commutative50.4%
+-commutative50.4%
associate--l+50.5%
+-commutative50.5%
rem-square-sqrt50.7%
hypot-1-def50.8%
Simplified50.8%
if 4.8e18 < z Initial program 88.9%
associate-+l+88.9%
+-commutative88.9%
associate-+r-67.3%
associate-+l-56.4%
+-commutative56.4%
associate--l+56.4%
+-commutative56.4%
Simplified23.9%
Taylor expanded in t around inf 29.4%
+-commutative29.4%
+-commutative29.4%
associate--l+30.5%
Simplified30.5%
Taylor expanded in z around inf 30.4%
+-commutative30.4%
Simplified30.4%
Taylor expanded in x around 0 29.5%
associate--l+49.1%
Simplified49.1%
Final simplification44.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z 1.1e-29)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) 3.0)
(if (<= z 4.8e+18)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.1e-29) {
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
} else if (z <= 4.8e+18) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.1d-29) then
tmp = (sqrt((1.0d0 + t)) - sqrt(t)) + 3.0d0
else if (z <= 4.8d+18) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.1e-29) {
tmp = (Math.sqrt((1.0 + t)) - Math.sqrt(t)) + 3.0;
} else if (z <= 4.8e+18) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 1.1e-29: tmp = (math.sqrt((1.0 + t)) - math.sqrt(t)) + 3.0 elif z <= 4.8e+18: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 1.1e-29) tmp = Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + 3.0); elseif (z <= 4.8e+18) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 1.1e-29)
tmp = (sqrt((1.0 + t)) - sqrt(t)) + 3.0;
elseif (z <= 4.8e+18)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 1.1e-29], N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision], If[LessEqual[z, 4.8e+18], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.1 \cdot 10^{-29}:\\
\;\;\;\;\left(\sqrt{1 + t} - \sqrt{t}\right) + 3\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+18}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.09999999999999995e-29Initial program 97.3%
associate-+l+97.3%
associate-+l-80.3%
+-commutative80.3%
sub-neg80.3%
sub-neg80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around 0 56.1%
Taylor expanded in y around 0 39.8%
Taylor expanded in z around 0 23.2%
associate--l+39.8%
Simplified39.8%
if 1.09999999999999995e-29 < z < 4.8e18Initial program 91.1%
associate-+l+91.2%
+-commutative91.2%
associate-+r-80.4%
associate-+l-62.8%
+-commutative62.8%
associate--l+62.8%
+-commutative62.8%
Simplified50.0%
Taylor expanded in t around inf 34.8%
+-commutative34.8%
+-commutative34.8%
associate--l+34.8%
Simplified34.8%
Taylor expanded in x around 0 35.8%
+-commutative35.8%
+-commutative35.8%
associate--l+35.9%
rem-square-sqrt36.1%
hypot-1-def36.2%
+-commutative36.2%
Simplified36.2%
Taylor expanded in y around 0 50.4%
associate--l+50.5%
Simplified50.5%
if 4.8e18 < z Initial program 88.9%
associate-+l+88.9%
+-commutative88.9%
associate-+r-67.3%
associate-+l-56.4%
+-commutative56.4%
associate--l+56.4%
+-commutative56.4%
Simplified23.9%
Taylor expanded in t around inf 29.4%
+-commutative29.4%
+-commutative29.4%
associate--l+30.5%
Simplified30.5%
Taylor expanded in z around inf 30.4%
+-commutative30.4%
Simplified30.4%
Taylor expanded in x around 0 29.5%
associate--l+49.1%
Simplified49.1%
Final simplification44.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 6e-21) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6e-21) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 6d-21) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6e-21) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 6e-21: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 else: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 6e-21) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); else tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 6e-21)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
else
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 6e-21], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\end{array}
\end{array}
if y < 5.99999999999999982e-21Initial program 97.5%
associate-+l+97.5%
+-commutative97.5%
associate-+r-64.6%
associate-+l-60.4%
+-commutative60.4%
associate--l+60.4%
+-commutative60.4%
Simplified44.0%
Taylor expanded in t around inf 31.7%
+-commutative31.7%
+-commutative31.7%
associate--l+32.6%
Simplified32.6%
Taylor expanded in x around 0 28.5%
+-commutative28.5%
+-commutative28.5%
associate--l+28.5%
rem-square-sqrt28.5%
hypot-1-def28.6%
+-commutative28.6%
Simplified28.6%
Taylor expanded in y around 0 28.5%
associate--l+47.6%
Simplified47.6%
if 5.99999999999999982e-21 < y Initial program 88.9%
associate-+l+88.9%
+-commutative88.9%
associate-+r-85.7%
associate-+l-56.7%
+-commutative56.7%
associate--l+56.7%
+-commutative56.7%
Simplified44.0%
Taylor expanded in t around inf 36.4%
+-commutative36.4%
+-commutative36.4%
associate--l+36.5%
Simplified36.5%
Taylor expanded in z around inf 19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in x around 0 8.1%
associate--l+42.0%
Simplified42.0%
Final simplification44.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 93.4%
associate-+l+93.4%
+-commutative93.4%
associate-+r-74.8%
associate-+l-58.6%
+-commutative58.6%
associate--l+58.6%
+-commutative58.6%
Simplified44.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.5%
Simplified34.5%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in x around 0 25.8%
associate--l+42.2%
Simplified42.2%
Final simplification42.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 93.4%
associate-+l+93.4%
+-commutative93.4%
associate-+r-74.8%
associate-+l-58.6%
+-commutative58.6%
associate--l+58.6%
+-commutative58.6%
Simplified44.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.5%
Simplified34.5%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in y around inf 14.9%
Final simplification14.9%
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 (* x 0.5)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 + (x * 0.5)) - 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 = (1.0d0 + (x * 0.5d0)) - sqrt(x)
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 * 0.5)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 + (x * 0.5)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 + Float64(x * 0.5)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (1.0 + (x * 0.5)) - 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[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\left(1 + x \cdot 0.5\right) - \sqrt{x}
\end{array}
Initial program 93.4%
associate-+l+93.4%
+-commutative93.4%
associate-+r-74.8%
associate-+l-58.6%
+-commutative58.6%
associate--l+58.6%
+-commutative58.6%
Simplified44.0%
Taylor expanded in t around inf 34.0%
+-commutative34.0%
+-commutative34.0%
associate--l+34.5%
Simplified34.5%
Taylor expanded in z around inf 20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in y around inf 14.9%
Taylor expanded in x around 0 15.7%
Final simplification15.7%
(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 2023171
(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))))