
(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 13 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)) 0.8)
(/ 1.0 (+ t_1 (sqrt x)))
(+
(+ 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)) <= 0.8) {
tmp = 1.0 / (t_1 + sqrt(x));
} 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)) <= 0.8d0) then
tmp = 1.0d0 / (t_1 + sqrt(x))
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)) <= 0.8) {
tmp = 1.0 / (t_1 + Math.sqrt(x));
} 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)) <= 0.8: tmp = 1.0 / (t_1 + math.sqrt(x)) 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)) <= 0.8) tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); 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)) <= 0.8)
tmp = 1.0 / (t_1 + sqrt(x));
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], 0.8], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $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 0.8:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\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)) < 0.80000000000000004Initial program 85.8%
associate-+l+85.8%
+-commutative85.8%
associate-+r-42.9%
associate-+l-11.1%
+-commutative11.1%
associate--l+11.1%
+-commutative11.1%
Simplified7.8%
Taylor expanded in t around inf 4.7%
associate--l+24.0%
+-commutative24.0%
+-commutative24.0%
Simplified24.0%
Taylor expanded in z around inf 5.8%
+-commutative5.8%
associate--l+6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in y around inf 4.4%
flip--4.4%
add-sqr-sqrt4.8%
add-sqr-sqrt4.4%
Applied egg-rr4.4%
associate--l+9.5%
+-inverses9.5%
metadata-eval9.5%
+-commutative9.5%
Simplified9.5%
if 0.80000000000000004 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.7%
associate-+l+97.7%
associate-+l-97.7%
+-commutative97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
flip--97.7%
add-sqr-sqrt79.8%
+-commutative79.8%
add-sqr-sqrt98.0%
+-commutative98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 98.6%
flip--98.8%
add-sqr-sqrt83.9%
add-sqr-sqrt99.2%
Applied egg-rr99.2%
associate--l+99.6%
+-inverses99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification54.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 y)) (sqrt y))) (t_2 (sqrt (+ x 1.0))))
(if (<= (+ t_1 (- t_2 (sqrt x))) 1.0)
(/ 1.0 (+ t_2 (sqrt x)))
(+
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ 1.0 t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y)) - sqrt(y);
double t_2 = sqrt((x + 1.0));
double tmp;
if ((t_1 + (t_2 - sqrt(x))) <= 1.0) {
tmp = 1.0 / (t_2 + sqrt(x));
} else {
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + y)) - sqrt(y)
t_2 = sqrt((x + 1.0d0))
if ((t_1 + (t_2 - sqrt(x))) <= 1.0d0) then
tmp = 1.0d0 / (t_2 + sqrt(x))
else
tmp = ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + t)) - sqrt(t))) + (1.0d0 + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if ((t_1 + (t_2 - Math.sqrt(x))) <= 1.0) {
tmp = 1.0 / (t_2 + Math.sqrt(x));
} else {
tmp = ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (1.0 + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) - math.sqrt(y) t_2 = math.sqrt((x + 1.0)) tmp = 0 if (t_1 + (t_2 - math.sqrt(x))) <= 1.0: tmp = 1.0 / (t_2 + math.sqrt(x)) else: tmp = ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (1.0 + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_1 + Float64(t_2 - sqrt(x))) <= 1.0) tmp = Float64(1.0 / Float64(t_2 + sqrt(x))); 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 + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y)) - sqrt(y);
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_1 + (t_2 - sqrt(x))) <= 1.0)
tmp = 1.0 / (t_2 + sqrt(x));
else
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (1.0 + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 + N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0], N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $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 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y} - \sqrt{y}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;t_1 + \left(t_2 - \sqrt{x}\right) \leq 1:\\
\;\;\;\;\frac{1}{t_2 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(1 + t_1\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 89.3%
associate-+l+89.3%
+-commutative89.3%
associate-+r-58.0%
associate-+l-34.7%
+-commutative34.7%
associate--l+34.7%
+-commutative34.7%
Simplified24.0%
Taylor expanded in t around inf 5.0%
associate--l+19.0%
+-commutative19.0%
+-commutative19.0%
Simplified19.0%
Taylor expanded in z around inf 4.7%
+-commutative4.7%
associate--l+14.0%
+-commutative14.0%
Simplified14.0%
Taylor expanded in y around inf 13.0%
flip--13.0%
add-sqr-sqrt13.3%
add-sqr-sqrt13.0%
Applied egg-rr13.0%
associate--l+16.7%
+-inverses16.7%
metadata-eval16.7%
+-commutative16.7%
Simplified16.7%
if 1 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 97.2%
associate-+l+97.2%
associate-+l-97.2%
+-commutative97.2%
sub-neg97.2%
sub-neg97.2%
+-commutative97.2%
+-commutative97.2%
Simplified97.2%
flip--97.2%
add-sqr-sqrt81.0%
+-commutative81.0%
add-sqr-sqrt97.6%
+-commutative97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 98.4%
Taylor expanded in x around 0 92.3%
associate--l+91.0%
Simplified92.3%
Final simplification40.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= (- t_1 (sqrt x)) 0.8)
(/ 1.0 (+ t_1 (sqrt x)))
(+
(+ (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))) (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ t_1 (- (- (sqrt (+ 1.0 y)) (sqrt y)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if ((t_1 - sqrt(x)) <= 0.8) {
tmp = 1.0 / (t_1 + sqrt(x));
} else {
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + ((sqrt((1.0 + y)) - sqrt(y)) - sqrt(x)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if ((t_1 - sqrt(x)) <= 0.8d0) then
tmp = 1.0d0 / (t_1 + sqrt(x))
else
tmp = ((1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))) + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_1 + ((sqrt((1.0d0 + y)) - sqrt(y)) - sqrt(x)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if ((t_1 - Math.sqrt(x)) <= 0.8) {
tmp = 1.0 / (t_1 + Math.sqrt(x));
} else {
tmp = ((1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_1 + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if (t_1 - math.sqrt(x)) <= 0.8: tmp = 1.0 / (t_1 + math.sqrt(x)) else: tmp = ((1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_1 + ((math.sqrt((1.0 + y)) - math.sqrt(y)) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_1 - sqrt(x)) <= 0.8) tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_1 + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) - sqrt(x)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_1 - sqrt(x)) <= 0.8)
tmp = 1.0 / (t_1 + sqrt(x));
else
tmp = ((1.0 / (sqrt(z) + sqrt((1.0 + z)))) + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + ((sqrt((1.0 + y)) - sqrt(y)) - sqrt(x)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.8], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $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[(t$95$1 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;t_1 - \sqrt{x} \leq 0.8:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{z} + \sqrt{1 + z}} + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t_1 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.80000000000000004Initial program 85.8%
associate-+l+85.8%
+-commutative85.8%
associate-+r-42.9%
associate-+l-11.1%
+-commutative11.1%
associate--l+11.1%
+-commutative11.1%
Simplified7.8%
Taylor expanded in t around inf 4.7%
associate--l+24.0%
+-commutative24.0%
+-commutative24.0%
Simplified24.0%
Taylor expanded in z around inf 5.8%
+-commutative5.8%
associate--l+6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in y around inf 4.4%
flip--4.4%
add-sqr-sqrt4.8%
add-sqr-sqrt4.4%
Applied egg-rr4.4%
associate--l+9.5%
+-inverses9.5%
metadata-eval9.5%
+-commutative9.5%
Simplified9.5%
if 0.80000000000000004 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.7%
associate-+l+97.7%
associate-+l-97.7%
+-commutative97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
flip--97.7%
add-sqr-sqrt79.8%
+-commutative79.8%
add-sqr-sqrt98.0%
+-commutative98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 98.6%
Final simplification54.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) (sqrt (+ 1.0 z)))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 7.5e-32)
(+ (- (- (sqrt (+ 1.0 t)) (sqrt t)) t_1) 2.0)
(if (<= y 2.05e+22)
(+ t_2 (- (- (sqrt (+ 1.0 y)) (sqrt y)) (+ (sqrt x) t_1)))
(/ 1.0 (+ t_2 (sqrt x)))))))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 t_2 = sqrt((x + 1.0));
double tmp;
if (y <= 7.5e-32) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) - t_1) + 2.0;
} else if (y <= 2.05e+22) {
tmp = t_2 + ((sqrt((1.0 + y)) - sqrt(y)) - (sqrt(x) + t_1));
} else {
tmp = 1.0 / (t_2 + 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(z) - sqrt((1.0d0 + z))
t_2 = sqrt((x + 1.0d0))
if (y <= 7.5d-32) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) - t_1) + 2.0d0
else if (y <= 2.05d+22) then
tmp = t_2 + ((sqrt((1.0d0 + y)) - sqrt(y)) - (sqrt(x) + t_1))
else
tmp = 1.0d0 / (t_2 + 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(z) - Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 7.5e-32) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - t_1) + 2.0;
} else if (y <= 2.05e+22) {
tmp = t_2 + ((Math.sqrt((1.0 + y)) - Math.sqrt(y)) - (Math.sqrt(x) + t_1));
} else {
tmp = 1.0 / (t_2 + Math.sqrt(x));
}
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)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if y <= 7.5e-32: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) - t_1) + 2.0 elif y <= 2.05e+22: tmp = t_2 + ((math.sqrt((1.0 + y)) - math.sqrt(y)) - (math.sqrt(x) + t_1)) else: tmp = 1.0 / (t_2 + math.sqrt(x)) 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))) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 7.5e-32) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - t_1) + 2.0); elseif (y <= 2.05e+22) tmp = Float64(t_2 + Float64(Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) - Float64(sqrt(x) + t_1))); else tmp = Float64(1.0 / Float64(t_2 + 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(z) - sqrt((1.0 + z));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 7.5e-32)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) - t_1) + 2.0;
elseif (y <= 2.05e+22)
tmp = t_2 + ((sqrt((1.0 + y)) - sqrt(y)) - (sqrt(x) + t_1));
else
tmp = 1.0 / (t_2 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.5e-32], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 2.05e+22], N[(t$95$2 + N[(N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$2 + 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{z} - \sqrt{1 + z}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 7.5 \cdot 10^{-32}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) - t_1\right) + 2\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{+22}:\\
\;\;\;\;t_2 + \left(\left(\sqrt{1 + y} - \sqrt{y}\right) - \left(\sqrt{x} + t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_2 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 7.49999999999999953e-32Initial program 96.9%
associate-+l+96.9%
associate-+l-63.7%
+-commutative63.7%
sub-neg63.7%
sub-neg63.7%
+-commutative63.7%
+-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 60.8%
Taylor expanded in y around 0 60.8%
if 7.49999999999999953e-32 < y < 2.0499999999999999e22Initial program 88.4%
associate-+l+88.4%
+-commutative88.4%
associate-+r-49.9%
associate-+l-44.4%
+-commutative44.4%
associate--l+44.4%
+-commutative44.4%
Simplified35.7%
Taylor expanded in t around inf 30.4%
+-commutative30.4%
+-commutative30.4%
associate--l+31.9%
Simplified31.9%
if 2.0499999999999999e22 < y Initial program 86.4%
associate-+l+86.4%
+-commutative86.4%
associate-+r-86.4%
associate-+l-52.8%
+-commutative52.8%
associate--l+52.8%
+-commutative52.8%
Simplified35.6%
Taylor expanded in t around inf 3.2%
associate--l+4.5%
+-commutative4.5%
+-commutative4.5%
Simplified4.5%
Taylor expanded in z around inf 3.2%
+-commutative3.2%
associate--l+19.7%
+-commutative19.7%
Simplified19.7%
Taylor expanded in y around inf 20.1%
flip--20.1%
add-sqr-sqrt20.3%
add-sqr-sqrt20.1%
Applied egg-rr20.1%
associate--l+24.2%
+-inverses24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.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 (<= y 70000000000.0)
(+
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(- (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt z) (sqrt (+ 1.0 z)))))
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 70000000000.0) {
tmp = (1.0 + (sqrt((1.0 + y)) - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) - (sqrt(z) - sqrt((1.0 + z))));
} else {
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 70000000000.0d0) then
tmp = (1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))) + ((sqrt((1.0d0 + t)) - sqrt(t)) - (sqrt(z) - sqrt((1.0d0 + z))))
else
tmp = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 70000000000.0) {
tmp = (1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y))) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - (Math.sqrt(z) - Math.sqrt((1.0 + z))));
} else {
tmp = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 70000000000.0: tmp = (1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) - (math.sqrt(z) - math.sqrt((1.0 + z)))) else: tmp = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 70000000000.0) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - Float64(sqrt(z) - sqrt(Float64(1.0 + z))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 70000000000.0)
tmp = (1.0 + (sqrt((1.0 + y)) - sqrt(y))) + ((sqrt((1.0 + t)) - sqrt(t)) - (sqrt(z) - sqrt((1.0 + z))));
else
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 70000000000.0], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 70000000000:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \left(\sqrt{z} - \sqrt{1 + z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 7e10Initial program 96.1%
associate-+l+96.1%
associate-+l-60.9%
+-commutative60.9%
sub-neg60.9%
sub-neg60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in x around 0 57.3%
associate--l+57.3%
Simplified57.3%
if 7e10 < y Initial program 85.3%
associate-+l+85.3%
+-commutative85.3%
associate-+r-85.0%
associate-+l-53.1%
+-commutative53.1%
associate--l+53.1%
+-commutative53.1%
Simplified36.7%
Taylor expanded in t around inf 4.8%
associate--l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in z around inf 3.8%
+-commutative3.8%
associate--l+19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in y around inf 19.9%
flip--19.9%
add-sqr-sqrt20.1%
add-sqr-sqrt19.9%
Applied egg-rr19.9%
associate--l+23.8%
+-inverses23.8%
metadata-eval23.8%
+-commutative23.8%
Simplified23.8%
Final simplification44.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 5e+18)
(- 1.0 (- (- (+ (sqrt y) (sqrt z)) t_1) (sqrt (+ 1.0 z))))
(+ (- t_1 (sqrt y)) (- (sqrt (+ x 1.0)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 5e+18) {
tmp = 1.0 - (((sqrt(y) + sqrt(z)) - t_1) - sqrt((1.0 + z)));
} else {
tmp = (t_1 - sqrt(y)) + (sqrt((x + 1.0)) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 5d+18) then
tmp = 1.0d0 - (((sqrt(y) + sqrt(z)) - t_1) - sqrt((1.0d0 + z)))
else
tmp = (t_1 - sqrt(y)) + (sqrt((x + 1.0d0)) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 5e+18) {
tmp = 1.0 - (((Math.sqrt(y) + Math.sqrt(z)) - t_1) - Math.sqrt((1.0 + z)));
} else {
tmp = (t_1 - Math.sqrt(y)) + (Math.sqrt((x + 1.0)) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 5e+18: tmp = 1.0 - (((math.sqrt(y) + math.sqrt(z)) - t_1) - math.sqrt((1.0 + z))) else: tmp = (t_1 - math.sqrt(y)) + (math.sqrt((x + 1.0)) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 5e+18) tmp = Float64(1.0 - Float64(Float64(Float64(sqrt(y) + sqrt(z)) - t_1) - sqrt(Float64(1.0 + z)))); else tmp = Float64(Float64(t_1 - sqrt(y)) + Float64(sqrt(Float64(x + 1.0)) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 5e+18)
tmp = 1.0 - (((sqrt(y) + sqrt(z)) - t_1) - sqrt((1.0 + z)));
else
tmp = (t_1 - sqrt(y)) + (sqrt((x + 1.0)) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 5e+18], N[(1.0 - N[(N[(N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - 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 + y}\\
\mathbf{if}\;z \leq 5 \cdot 10^{+18}:\\
\;\;\;\;1 - \left(\left(\left(\sqrt{y} + \sqrt{z}\right) - t_1\right) - \sqrt{1 + z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \sqrt{y}\right) + \left(\sqrt{x + 1} - \sqrt{x}\right)\\
\end{array}
\end{array}
if z < 5e18Initial program 95.4%
associate-+l+95.4%
+-commutative95.4%
associate-+r-76.6%
associate-+l-52.7%
+-commutative52.7%
associate--l+52.7%
+-commutative52.7%
Simplified50.0%
Taylor expanded in t around inf 21.7%
associate--l+25.9%
+-commutative25.9%
+-commutative25.9%
Simplified25.9%
Taylor expanded in x around 0 35.7%
associate--l+47.3%
+-commutative47.3%
associate--l+57.1%
Simplified57.1%
if 5e18 < z Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
associate-+r-63.7%
associate-+l-57.0%
+-commutative57.0%
associate--l+56.9%
+-commutative56.9%
Simplified19.0%
Taylor expanded in t around inf 4.4%
associate--l+25.2%
+-commutative25.2%
+-commutative25.2%
Simplified25.2%
Taylor expanded in z around inf 27.2%
+-commutative27.2%
associate--l+36.4%
+-commutative36.4%
Simplified36.4%
expm1-log1p-u33.0%
Applied egg-rr33.0%
expm1-log1p-u36.4%
flip--36.6%
add-sqr-sqrt30.8%
+-commutative30.8%
+-commutative30.8%
+-commutative30.8%
unpow230.8%
associate-+r-30.8%
+-commutative30.8%
*-un-lft-identity30.8%
Applied egg-rr37.3%
*-lft-identity37.3%
+-commutative37.3%
sub-neg37.3%
associate-+l+53.2%
+-commutative53.2%
sub-neg53.2%
Simplified53.2%
Final simplification55.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 3.8e-20)
(+ (- (- (sqrt (+ 1.0 t)) (sqrt t)) (- (sqrt z) (sqrt (+ 1.0 z)))) 2.0)
(if (<= y 1.12e+26)
(+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e-20) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) - (sqrt(z) - sqrt((1.0 + z)))) + 2.0;
} else if (y <= 1.12e+26) {
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.8d-20) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) - (sqrt(z) - sqrt((1.0d0 + z)))) + 2.0d0
else if (y <= 1.12d+26) then
tmp = 1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e-20) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) - (Math.sqrt(z) - Math.sqrt((1.0 + z)))) + 2.0;
} else if (y <= 1.12e+26) {
tmp = 1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.8e-20: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) - (math.sqrt(z) - math.sqrt((1.0 + z)))) + 2.0 elif y <= 1.12e+26: tmp = 1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3.8e-20) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) - Float64(sqrt(z) - sqrt(Float64(1.0 + z)))) + 2.0); elseif (y <= 1.12e+26) tmp = Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3.8e-20)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) - (sqrt(z) - sqrt((1.0 + z)))) + 2.0;
elseif (y <= 1.12e+26)
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
else
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3.8e-20], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] - N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 1.12e+26], N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{-20}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) - \left(\sqrt{z} - \sqrt{1 + z}\right)\right) + 2\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+26}:\\
\;\;\;\;1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 3.7999999999999998e-20Initial program 96.9%
associate-+l+96.9%
associate-+l-62.7%
+-commutative62.7%
sub-neg62.7%
sub-neg62.7%
+-commutative62.7%
+-commutative62.7%
Simplified62.7%
Taylor expanded in x around 0 59.1%
Taylor expanded in y around 0 59.1%
if 3.7999999999999998e-20 < y < 1.1200000000000001e26Initial program 86.1%
associate-+l+86.1%
+-commutative86.1%
associate-+r-53.7%
associate-+l-43.8%
+-commutative43.8%
associate--l+43.8%
+-commutative43.8%
Simplified33.8%
Taylor expanded in t around inf 18.0%
associate--l+29.7%
+-commutative29.7%
+-commutative29.7%
Simplified29.7%
Taylor expanded in z around inf 20.8%
+-commutative20.8%
associate--l+20.8%
+-commutative20.8%
Simplified20.8%
flip--20.9%
add-sqr-sqrt20.8%
Applied egg-rr20.8%
+-commutative20.8%
associate--l+20.8%
unpow220.8%
+-commutative20.8%
+-commutative20.8%
Simplified20.8%
Taylor expanded in x around 0 43.1%
if 1.1200000000000001e26 < y Initial program 86.5%
associate-+l+86.5%
+-commutative86.5%
associate-+r-86.5%
associate-+l-53.9%
+-commutative53.9%
associate--l+53.9%
+-commutative53.9%
Simplified36.3%
Taylor expanded in t around inf 3.2%
associate--l+4.4%
+-commutative4.4%
+-commutative4.4%
Simplified4.4%
Taylor expanded in z around inf 3.2%
+-commutative3.2%
associate--l+20.1%
+-commutative20.1%
Simplified20.1%
Taylor expanded in y around inf 20.5%
flip--20.5%
add-sqr-sqrt20.6%
add-sqr-sqrt20.5%
Applied egg-rr20.5%
associate--l+24.5%
+-inverses24.5%
metadata-eval24.5%
+-commutative24.5%
Simplified24.5%
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 (<= x 1.18e-20) (+ 1.0 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.18e-20) {
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.18d-20) then
tmp = 1.0d0 + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.18e-20) {
tmp = 1.0 + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.18e-20: tmp = 1.0 + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.18e-20) tmp = Float64(1.0 + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.18e-20)
tmp = 1.0 + (1.0 / (sqrt((1.0 + y)) + sqrt(y)));
else
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.18e-20], N[(1.0 + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.18 \cdot 10^{-20}:\\
\;\;\;\;1 + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if x < 1.1800000000000001e-20Initial program 97.8%
associate-+l+97.8%
+-commutative97.8%
associate-+r-97.8%
associate-+l-97.8%
+-commutative97.8%
associate--l+97.8%
+-commutative97.8%
Simplified62.5%
Taylor expanded in t around inf 22.2%
associate--l+26.9%
+-commutative26.9%
+-commutative26.9%
Simplified26.9%
Taylor expanded in z around inf 29.1%
+-commutative29.1%
associate--l+41.0%
+-commutative41.0%
Simplified41.0%
flip--41.0%
add-sqr-sqrt34.7%
Applied egg-rr34.7%
+-commutative34.7%
associate--l+34.7%
unpow234.7%
+-commutative34.7%
+-commutative34.7%
Simplified34.7%
Taylor expanded in x around 0 40.9%
if 1.1800000000000001e-20 < x Initial program 86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+r-47.2%
associate-+l-17.9%
+-commutative17.9%
associate--l+17.9%
+-commutative17.9%
Simplified12.1%
Taylor expanded in t around inf 6.1%
associate--l+24.4%
+-commutative24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in z around inf 7.6%
+-commutative7.6%
associate--l+9.2%
+-commutative9.2%
Simplified9.2%
Taylor expanded in y around inf 6.0%
flip--6.1%
add-sqr-sqrt6.4%
add-sqr-sqrt6.1%
Applied egg-rr6.1%
associate--l+10.8%
+-inverses10.8%
metadata-eval10.8%
+-commutative10.8%
Simplified10.8%
Final simplification24.7%
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)) (sqrt x)))) (if (<= y 0.78) (+ 1.0 t_1) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (y <= 0.78) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (y <= 0.78d0) then
tmp = 1.0d0 + t_1
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (y <= 0.78) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if y <= 0.78: tmp = 1.0 + t_1 else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (y <= 0.78) tmp = Float64(1.0 + t_1); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (y <= 0.78)
tmp = 1.0 + t_1;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.78], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;y \leq 0.78:\\
\;\;\;\;1 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 0.78000000000000003Initial program 96.8%
associate-+l+96.8%
+-commutative96.8%
associate-+r-61.6%
associate-+l-56.5%
+-commutative56.5%
associate--l+56.5%
+-commutative56.5%
Simplified34.8%
Taylor expanded in t around inf 19.3%
associate--l+39.0%
+-commutative39.0%
+-commutative39.0%
Simplified39.0%
Taylor expanded in z around inf 27.1%
+-commutative27.1%
associate--l+27.1%
+-commutative27.1%
Simplified27.1%
Taylor expanded in y around 0 26.2%
associate--l+40.6%
Simplified40.6%
if 0.78000000000000003 < y Initial program 85.1%
associate-+l+85.1%
+-commutative85.1%
associate-+r-82.4%
associate-+l-52.3%
+-commutative52.3%
associate--l+52.3%
+-commutative52.3%
Simplified36.1%
Taylor expanded in t around inf 5.9%
associate--l+7.7%
+-commutative7.7%
+-commutative7.7%
Simplified7.7%
Taylor expanded in z around inf 4.8%
+-commutative4.8%
associate--l+19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in y around inf 19.2%
Final simplification31.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 70000000000.0) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 70000000000.0) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 70000000000.0d0) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 70000000000.0) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 70000000000.0: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 70000000000.0) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 70000000000.0)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 70000000000.0], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 70000000000:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 7e10Initial program 96.1%
associate-+l+96.1%
+-commutative96.1%
associate-+r-60.9%
associate-+l-55.8%
+-commutative55.8%
associate--l+55.8%
+-commutative55.8%
Simplified34.4%
Taylor expanded in t around inf 19.3%
associate--l+38.4%
+-commutative38.4%
+-commutative38.4%
Simplified38.4%
Taylor expanded in z around inf 26.7%
+-commutative26.7%
associate--l+26.6%
+-commutative26.6%
Simplified26.6%
Taylor expanded in x around 0 46.9%
associate--l+46.9%
Simplified46.9%
if 7e10 < y Initial program 85.3%
associate-+l+85.3%
+-commutative85.3%
associate-+r-85.0%
associate-+l-53.1%
+-commutative53.1%
associate--l+53.1%
+-commutative53.1%
Simplified36.7%
Taylor expanded in t around inf 4.8%
associate--l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in z around inf 3.8%
+-commutative3.8%
associate--l+19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in y around inf 19.9%
Final simplification36.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 (<= x 1.18e-20) (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))) (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.18e-20) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.18d-20) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.18e-20) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.18e-20: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.18e-20) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.18e-20)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.18e-20], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.18 \cdot 10^{-20}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if x < 1.1800000000000001e-20Initial program 97.8%
associate-+l+97.8%
+-commutative97.8%
associate-+r-97.8%
associate-+l-97.8%
+-commutative97.8%
associate--l+97.8%
+-commutative97.8%
Simplified62.5%
Taylor expanded in t around inf 22.2%
associate--l+26.9%
+-commutative26.9%
+-commutative26.9%
Simplified26.9%
Taylor expanded in z around inf 29.1%
+-commutative29.1%
associate--l+41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in x around 0 29.1%
associate--l+41.0%
Simplified41.0%
if 1.1800000000000001e-20 < x Initial program 86.6%
associate-+l+86.6%
+-commutative86.6%
associate-+r-47.2%
associate-+l-17.9%
+-commutative17.9%
associate--l+17.9%
+-commutative17.9%
Simplified12.1%
Taylor expanded in t around inf 6.1%
associate--l+24.4%
+-commutative24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in z around inf 7.6%
+-commutative7.6%
associate--l+9.2%
+-commutative9.2%
Simplified9.2%
Taylor expanded in y around inf 6.0%
flip--6.1%
add-sqr-sqrt6.4%
add-sqr-sqrt6.1%
Applied egg-rr6.1%
associate--l+10.8%
+-inverses10.8%
metadata-eval10.8%
+-commutative10.8%
Simplified10.8%
Final simplification24.7%
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 91.8%
associate-+l+91.8%
+-commutative91.8%
associate-+r-70.5%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified35.3%
Taylor expanded in t around inf 13.5%
associate--l+25.6%
+-commutative25.6%
+-commutative25.6%
Simplified25.6%
Taylor expanded in z around inf 17.5%
+-commutative17.5%
associate--l+23.8%
+-commutative23.8%
Simplified23.8%
Taylor expanded in y around inf 14.6%
Final simplification14.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 91.8%
associate-+l+91.8%
+-commutative91.8%
associate-+r-70.5%
associate-+l-54.7%
+-commutative54.7%
associate--l+54.7%
+-commutative54.7%
Simplified35.3%
Taylor expanded in t around inf 13.5%
associate--l+25.6%
+-commutative25.6%
+-commutative25.6%
Simplified25.6%
Taylor expanded in z around inf 17.5%
+-commutative17.5%
associate--l+23.8%
+-commutative23.8%
Simplified23.8%
Taylor expanded in y around inf 14.6%
Taylor expanded in x around 0 31.5%
Final simplification31.5%
(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 2023249
(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))))