
(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 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(t_2 (sqrt (+ 1.0 x)))
(t_3 (- t_2 (sqrt x)))
(t_4 (sqrt (+ 1.0 z))))
(if (<= t_3 0.999999999998)
(+ (+ (/ 1.0 (+ t_2 (sqrt x))) t_1) (- t_4 (sqrt z)))
(+
(+ t_1 t_3)
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_4 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double t_2 = sqrt((1.0 + x));
double t_3 = t_2 - sqrt(x);
double t_4 = sqrt((1.0 + z));
double tmp;
if (t_3 <= 0.999999999998) {
tmp = ((1.0 / (t_2 + sqrt(x))) + t_1) + (t_4 - sqrt(z));
} else {
tmp = (t_1 + t_3) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_4 + sqrt(z))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
t_2 = sqrt((1.0d0 + x))
t_3 = t_2 - sqrt(x)
t_4 = sqrt((1.0d0 + z))
if (t_3 <= 0.999999999998d0) then
tmp = ((1.0d0 / (t_2 + sqrt(x))) + t_1) + (t_4 - sqrt(z))
else
tmp = (t_1 + t_3) + ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_4 + sqrt(z))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double t_2 = Math.sqrt((1.0 + x));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = Math.sqrt((1.0 + z));
double tmp;
if (t_3 <= 0.999999999998) {
tmp = ((1.0 / (t_2 + Math.sqrt(x))) + t_1) + (t_4 - Math.sqrt(z));
} else {
tmp = (t_1 + t_3) + ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_4 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) t_2 = math.sqrt((1.0 + x)) t_3 = t_2 - math.sqrt(x) t_4 = math.sqrt((1.0 + z)) tmp = 0 if t_3 <= 0.999999999998: tmp = ((1.0 / (t_2 + math.sqrt(x))) + t_1) + (t_4 - math.sqrt(z)) else: tmp = (t_1 + t_3) + ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_4 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) t_2 = sqrt(Float64(1.0 + x)) t_3 = Float64(t_2 - sqrt(x)) t_4 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t_3 <= 0.999999999998) tmp = Float64(Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + t_1) + Float64(t_4 - sqrt(z))); else tmp = Float64(Float64(t_1 + t_3) + Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_4 + sqrt(z))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
t_2 = sqrt((1.0 + x));
t_3 = t_2 - sqrt(x);
t_4 = sqrt((1.0 + z));
tmp = 0.0;
if (t_3 <= 0.999999999998)
tmp = ((1.0 / (t_2 + sqrt(x))) + t_1) + (t_4 - sqrt(z));
else
tmp = (t_1 + t_3) + ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_4 + sqrt(z))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.999999999998], N[(N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + t$95$3), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
t_2 := \sqrt{1 + x}\\
t_3 := t_2 - \sqrt{x}\\
t_4 := \sqrt{1 + z}\\
\mathbf{if}\;t_3 \leq 0.999999999998:\\
\;\;\;\;\left(\frac{1}{t_2 + \sqrt{x}} + t_1\right) + \left(t_4 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + t_3\right) + \left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t_4 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.99999999999800004Initial program 88.0%
associate-+l+88.0%
associate-+l-48.6%
associate-+l-88.0%
sub-neg88.0%
sub-neg88.0%
+-commutative88.0%
+-commutative88.0%
+-commutative88.0%
Simplified88.0%
flip--88.4%
add-sqr-sqrt55.5%
+-commutative55.5%
add-sqr-sqrt89.3%
+-commutative89.3%
Applied egg-rr89.3%
associate--l+91.7%
+-inverses91.7%
metadata-eval91.7%
Simplified91.7%
flip--91.7%
add-sqr-sqrt71.1%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
associate--l+93.7%
+-inverses93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in t around inf 49.7%
if 0.99999999999800004 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.5%
associate-+l+97.5%
associate-+l-97.5%
associate-+l-97.5%
sub-neg97.5%
sub-neg97.5%
+-commutative97.5%
+-commutative97.5%
+-commutative97.5%
Simplified97.5%
flip--97.6%
add-sqr-sqrt72.9%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
Simplified98.3%
flip--97.8%
add-sqr-sqrt75.5%
add-sqr-sqrt97.8%
Applied egg-rr98.6%
associate--l+98.1%
+-inverses98.1%
metadata-eval98.1%
Simplified98.9%
Final simplification71.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (- (sqrt (+ 1.0 z)) (sqrt z)))
(t_3 (sqrt (+ 1.0 x)))
(t_4 (+ (- t_3 (sqrt x)) (- t_1 (sqrt y)))))
(if (<= (+ t_2 t_4) 2.1)
(+ (+ (/ 1.0 (+ t_3 (sqrt x))) (/ 1.0 (+ t_1 (sqrt y)))) t_2)
(+ t_4 (+ t_2 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double t_3 = sqrt((1.0 + x));
double t_4 = (t_3 - sqrt(x)) + (t_1 - sqrt(y));
double tmp;
if ((t_2 + t_4) <= 2.1) {
tmp = ((1.0 / (t_3 + sqrt(x))) + (1.0 / (t_1 + sqrt(y)))) + t_2;
} else {
tmp = t_4 + (t_2 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
t_3 = sqrt((1.0d0 + x))
t_4 = (t_3 - sqrt(x)) + (t_1 - sqrt(y))
if ((t_2 + t_4) <= 2.1d0) then
tmp = ((1.0d0 / (t_3 + sqrt(x))) + (1.0d0 / (t_1 + sqrt(y)))) + t_2
else
tmp = t_4 + (t_2 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + x));
double t_4 = (t_3 - Math.sqrt(x)) + (t_1 - Math.sqrt(y));
double tmp;
if ((t_2 + t_4) <= 2.1) {
tmp = ((1.0 / (t_3 + Math.sqrt(x))) + (1.0 / (t_1 + Math.sqrt(y)))) + t_2;
} else {
tmp = t_4 + (t_2 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) t_3 = math.sqrt((1.0 + x)) t_4 = (t_3 - math.sqrt(x)) + (t_1 - math.sqrt(y)) tmp = 0 if (t_2 + t_4) <= 2.1: tmp = ((1.0 / (t_3 + math.sqrt(x))) + (1.0 / (t_1 + math.sqrt(y)))) + t_2 else: tmp = t_4 + (t_2 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_3 = sqrt(Float64(1.0 + x)) t_4 = Float64(Float64(t_3 - sqrt(x)) + Float64(t_1 - sqrt(y))) tmp = 0.0 if (Float64(t_2 + t_4) <= 2.1) tmp = Float64(Float64(Float64(1.0 / Float64(t_3 + sqrt(x))) + Float64(1.0 / Float64(t_1 + sqrt(y)))) + t_2); else tmp = Float64(t_4 + Float64(t_2 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z)) - sqrt(z);
t_3 = sqrt((1.0 + x));
t_4 = (t_3 - sqrt(x)) + (t_1 - sqrt(y));
tmp = 0.0;
if ((t_2 + t_4) <= 2.1)
tmp = ((1.0 / (t_3 + sqrt(x))) + (1.0 / (t_1 + sqrt(y)))) + t_2;
else
tmp = t_4 + (t_2 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 + t$95$4), $MachinePrecision], 2.1], N[(N[(N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(t$95$4 + N[(t$95$2 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
t_3 := \sqrt{1 + x}\\
t_4 := \left(t_3 - \sqrt{x}\right) + \left(t_1 - \sqrt{y}\right)\\
\mathbf{if}\;t_2 + t_4 \leq 2.1:\\
\;\;\;\;\left(\frac{1}{t_3 + \sqrt{x}} + \frac{1}{t_1 + \sqrt{y}}\right) + t_2\\
\mathbf{else}:\\
\;\;\;\;t_4 + \left(t_2 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 2.10000000000000009Initial program 91.5%
associate-+l+91.5%
associate-+l-67.2%
associate-+l-91.5%
sub-neg91.5%
sub-neg91.5%
+-commutative91.5%
+-commutative91.5%
+-commutative91.5%
Simplified91.5%
flip--91.7%
add-sqr-sqrt71.4%
+-commutative71.4%
add-sqr-sqrt92.3%
+-commutative92.3%
Applied egg-rr92.3%
associate--l+93.8%
+-inverses93.8%
metadata-eval93.8%
Simplified93.8%
flip--93.9%
add-sqr-sqrt70.0%
add-sqr-sqrt94.2%
Applied egg-rr94.2%
associate--l+95.3%
+-inverses95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in t around inf 53.1%
if 2.10000000000000009 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) Initial program 99.1%
associate-+l+99.1%
associate-+l-99.1%
associate-+l-99.1%
sub-neg99.1%
sub-neg99.1%
+-commutative99.1%
+-commutative99.1%
+-commutative99.1%
Simplified99.1%
flip--99.9%
add-sqr-sqrt84.4%
+-commutative84.4%
add-sqr-sqrt99.9%
+-commutative99.9%
Applied egg-rr99.9%
+-commutative99.9%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Final simplification58.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 x)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (+ (- t_1 (sqrt x)) (- t_3 (sqrt y)))))
(if (<= t_4 1.2)
(+ (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y)))) (- t_2 (sqrt z)))
(+ (+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_2 (sqrt z)))) t_4))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + y));
double t_4 = (t_1 - sqrt(x)) + (t_3 - sqrt(y));
double tmp;
if (t_4 <= 1.2) {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (t_2 - sqrt(z));
} else {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_2 + sqrt(z)))) + t_4;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + y))
t_4 = (t_1 - sqrt(x)) + (t_3 - sqrt(y))
if (t_4 <= 1.2d0) then
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + (t_2 - sqrt(z))
else
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_2 + sqrt(z)))) + t_4
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + y));
double t_4 = (t_1 - Math.sqrt(x)) + (t_3 - Math.sqrt(y));
double tmp;
if (t_4 <= 1.2) {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + (t_2 - Math.sqrt(z));
} else {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_2 + Math.sqrt(z)))) + t_4;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + y)) t_4 = (t_1 - math.sqrt(x)) + (t_3 - math.sqrt(y)) tmp = 0 if t_4 <= 1.2: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + (t_2 - math.sqrt(z)) else: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_2 + math.sqrt(z)))) + t_4 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = sqrt(Float64(1.0 + z)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 - sqrt(y))) tmp = 0.0 if (t_4 <= 1.2) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + Float64(t_2 - sqrt(z))); else tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_2 + sqrt(z)))) + t_4); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + y));
t_4 = (t_1 - sqrt(x)) + (t_3 - sqrt(y));
tmp = 0.0;
if (t_4 <= 1.2)
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + (t_2 - sqrt(z));
else
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_2 + sqrt(z)))) + t_4;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 1.2], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + y}\\
t_4 := \left(t_1 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\\
\mathbf{if}\;t_4 \leq 1.2:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + \left(t_2 - \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t_2 + \sqrt{z}}\right) + t_4\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) < 1.19999999999999996Initial program 90.3%
associate-+l+90.3%
associate-+l-61.2%
associate-+l-90.3%
sub-neg90.3%
sub-neg90.3%
+-commutative90.3%
+-commutative90.3%
+-commutative90.3%
Simplified90.3%
flip--90.6%
add-sqr-sqrt66.3%
+-commutative66.3%
add-sqr-sqrt91.3%
+-commutative91.3%
Applied egg-rr91.3%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
Simplified93.0%
flip--93.2%
add-sqr-sqrt64.6%
add-sqr-sqrt93.6%
Applied egg-rr93.6%
associate--l+94.9%
+-inverses94.9%
metadata-eval94.9%
Simplified94.9%
Taylor expanded in t around inf 50.4%
if 1.19999999999999996 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) Initial program 98.1%
associate-+l+98.1%
associate-+l-98.1%
associate-+l-98.1%
sub-neg98.1%
sub-neg98.1%
+-commutative98.1%
+-commutative98.1%
+-commutative98.1%
Simplified98.1%
flip--98.0%
add-sqr-sqrt75.8%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification62.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 (+ 1.0 x)))
(t_2 (- (sqrt (+ 1.0 z)) (sqrt z)))
(t_3 (sqrt (+ 1.0 y))))
(if (<= t_2 0.9999996)
(+ (+ (/ 1.0 (+ t_1 (sqrt x))) (/ 1.0 (+ t_3 (sqrt y)))) t_2)
(+
(+ (- t_1 (sqrt x)) (- t_3 (sqrt y)))
(+
(/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))
(- (+ 1.0 (* z 0.5)) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double t_3 = sqrt((1.0 + y));
double tmp;
if (t_2 <= 0.9999996) {
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + t_2;
} else {
tmp = ((t_1 - sqrt(x)) + (t_3 - sqrt(y))) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((1.0 + (z * 0.5)) - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
t_3 = sqrt((1.0d0 + y))
if (t_2 <= 0.9999996d0) then
tmp = ((1.0d0 / (t_1 + sqrt(x))) + (1.0d0 / (t_3 + sqrt(y)))) + t_2
else
tmp = ((t_1 - sqrt(x)) + (t_3 - sqrt(y))) + ((1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))) + ((1.0d0 + (z * 0.5d0)) - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + y));
double tmp;
if (t_2 <= 0.9999996) {
tmp = ((1.0 / (t_1 + Math.sqrt(x))) + (1.0 / (t_3 + Math.sqrt(y)))) + t_2;
} else {
tmp = ((t_1 - Math.sqrt(x)) + (t_3 - Math.sqrt(y))) + ((1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))) + ((1.0 + (z * 0.5)) - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) t_3 = math.sqrt((1.0 + y)) tmp = 0 if t_2 <= 0.9999996: tmp = ((1.0 / (t_1 + math.sqrt(x))) + (1.0 / (t_3 + math.sqrt(y)))) + t_2 else: tmp = ((t_1 - math.sqrt(x)) + (t_3 - math.sqrt(y))) + ((1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t))) + ((1.0 + (z * 0.5)) - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) t_3 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (t_2 <= 0.9999996) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(1.0 / Float64(t_3 + sqrt(y)))) + t_2); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + Float64(t_3 - sqrt(y))) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))) + Float64(Float64(1.0 + Float64(z * 0.5)) - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
t_2 = sqrt((1.0 + z)) - sqrt(z);
t_3 = sqrt((1.0 + y));
tmp = 0.0;
if (t_2 <= 0.9999996)
tmp = ((1.0 / (t_1 + sqrt(x))) + (1.0 / (t_3 + sqrt(y)))) + t_2;
else
tmp = ((t_1 - sqrt(x)) + (t_3 - sqrt(y))) + ((1.0 / (sqrt((1.0 + t)) + sqrt(t))) + ((1.0 + (z * 0.5)) - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 0.9999996], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
t_3 := \sqrt{1 + y}\\
\mathbf{if}\;t_2 \leq 0.9999996:\\
\;\;\;\;\left(\frac{1}{t_1 + \sqrt{x}} + \frac{1}{t_3 + \sqrt{y}}\right) + t_2\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t_1 - \sqrt{x}\right) + \left(t_3 - \sqrt{y}\right)\right) + \left(\frac{1}{\sqrt{1 + t} + \sqrt{t}} + \left(\left(1 + z \cdot 0.5\right) - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 0.99999959999999999Initial program 87.9%
associate-+l+87.9%
associate-+l-65.5%
associate-+l-87.9%
sub-neg87.9%
sub-neg87.9%
+-commutative87.9%
+-commutative87.9%
+-commutative87.9%
Simplified87.9%
flip--88.3%
add-sqr-sqrt74.9%
+-commutative74.9%
add-sqr-sqrt89.0%
+-commutative89.0%
Applied egg-rr89.0%
associate--l+91.1%
+-inverses91.1%
metadata-eval91.1%
Simplified91.1%
flip--91.3%
add-sqr-sqrt73.2%
add-sqr-sqrt91.7%
Applied egg-rr91.7%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
Simplified93.3%
Taylor expanded in t around inf 53.3%
if 0.99999959999999999 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 98.4%
associate-+l+98.4%
associate-+l-77.6%
associate-+l-98.4%
sub-neg98.4%
sub-neg98.4%
+-commutative98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
flip--98.6%
add-sqr-sqrt78.3%
+-commutative78.3%
add-sqr-sqrt98.9%
+-commutative98.9%
Applied egg-rr98.9%
+-commutative98.9%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around 0 99.2%
Final simplification72.5%
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 x)) (sqrt x))) (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))) (+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
}
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 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + ((sqrt((1.0d0 + z)) - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t)))
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 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + ((sqrt((1.0 + z)) - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t)));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $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])\\
\\
\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)
\end{array}
Initial program 92.3%
associate-+l+92.3%
associate-+l-70.6%
associate-+l-92.3%
sub-neg92.3%
sub-neg92.3%
+-commutative92.3%
+-commutative92.3%
+-commutative92.3%
Simplified92.3%
flip--92.5%
add-sqr-sqrt74.4%
+-commutative74.4%
add-sqr-sqrt93.0%
+-commutative93.0%
Applied egg-rr93.0%
associate--l+94.3%
+-inverses94.3%
metadata-eval94.3%
Simplified94.3%
flip--94.4%
add-sqr-sqrt73.1%
add-sqr-sqrt94.7%
Applied egg-rr94.7%
associate--l+95.7%
+-inverses95.7%
metadata-eval95.7%
Simplified95.7%
Final simplification95.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t 29000000000000.0)
(+ 2.0 (+ (sqrt (+ 1.0 t)) (- 1.0 (sqrt t))))
(+
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(- (sqrt (+ 1.0 z)) (sqrt z)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 29000000000000.0) {
tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
} else {
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - sqrt(z));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 29000000000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + t)) + (1.0d0 - sqrt(t)))
else
tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y)))) + (sqrt((1.0d0 + z)) - sqrt(z))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 29000000000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + t)) + (1.0 - Math.sqrt(t)));
} else {
tmp = ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y)))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= 29000000000000.0: tmp = 2.0 + (math.sqrt((1.0 + t)) + (1.0 - math.sqrt(t))) else: tmp = ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)))) + (math.sqrt((1.0 + z)) - math.sqrt(z)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= 29000000000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(1.0 - sqrt(t)))); else tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y)))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))); 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 (t <= 29000000000000.0)
tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
else
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (1.0 / (sqrt((1.0 + y)) + sqrt(y)))) + (sqrt((1.0 + z)) - sqrt(z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, 29000000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 29000000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \frac{1}{\sqrt{1 + y} + \sqrt{y}}\right) + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
\end{array}
\end{array}
if t < 2.9e13Initial program 96.8%
Simplified19.4%
Taylor expanded in y around 0 16.4%
associate--l+35.1%
associate--l+56.6%
+-commutative56.6%
associate--r+59.4%
associate--l+53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in x around 0 20.7%
associate--l+46.8%
associate--l+33.7%
Simplified33.7%
Taylor expanded in z around 0 27.4%
if 2.9e13 < t Initial program 87.0%
associate-+l+87.0%
associate-+l-65.8%
associate-+l-87.0%
sub-neg87.0%
sub-neg87.0%
+-commutative87.0%
+-commutative87.0%
+-commutative87.0%
Simplified87.0%
flip--87.5%
add-sqr-sqrt71.9%
+-commutative71.9%
add-sqr-sqrt88.3%
+-commutative88.3%
Applied egg-rr88.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
flip--90.9%
add-sqr-sqrt73.7%
add-sqr-sqrt91.3%
Applied egg-rr91.3%
associate--l+92.9%
+-inverses92.9%
metadata-eval92.9%
Simplified92.9%
Taylor expanded in t around inf 92.9%
Final simplification57.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 (<= t 29000000000000.0)
(+ 2.0 (+ (sqrt (+ 1.0 t)) (- 1.0 (sqrt t))))
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (- (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 (t <= 29000000000000.0) {
tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
} else {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (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 (t <= 29000000000000.0d0) then
tmp = 2.0d0 + (sqrt((1.0d0 + t)) + (1.0d0 - sqrt(t)))
else
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (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 (t <= 29000000000000.0) {
tmp = 2.0 + (Math.sqrt((1.0 + t)) + (1.0 - Math.sqrt(t)));
} else {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (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 t <= 29000000000000.0: tmp = 2.0 + (math.sqrt((1.0 + t)) + (1.0 - math.sqrt(t))) else: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (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 (t <= 29000000000000.0) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + t)) + Float64(1.0 - sqrt(t)))); else tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + 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 (t <= 29000000000000.0)
tmp = 2.0 + (sqrt((1.0 + t)) + (1.0 - sqrt(t)));
else
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (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[t, 29000000000000.0], N[(2.0 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 29000000000000:\\
\;\;\;\;2 + \left(\sqrt{1 + t} + \left(1 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 2.9e13Initial program 96.8%
Simplified19.4%
Taylor expanded in y around 0 16.4%
associate--l+35.1%
associate--l+56.6%
+-commutative56.6%
associate--r+59.4%
associate--l+53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in x around 0 20.7%
associate--l+46.8%
associate--l+33.7%
Simplified33.7%
Taylor expanded in z around 0 27.4%
if 2.9e13 < t Initial program 87.0%
associate-+l+87.0%
associate-+l-65.8%
associate-+l-87.0%
sub-neg87.0%
sub-neg87.0%
+-commutative87.0%
+-commutative87.0%
+-commutative87.0%
Simplified87.0%
flip--87.5%
add-sqr-sqrt71.9%
+-commutative71.9%
add-sqr-sqrt88.3%
+-commutative88.3%
Applied egg-rr88.3%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in t around inf 90.9%
Final simplification56.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 (+ 1.0 x))))
(if (<= y 4.7e+17)
(+
(sqrt (+ 1.0 y))
(- (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (sqrt z)))) (sqrt y)))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + x));
double tmp;
if (y <= 4.7e+17) {
tmp = sqrt((1.0 + y)) + ((t_1 + (sqrt((1.0 + z)) - (sqrt(x) + sqrt(z)))) - sqrt(y));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + x))
if (y <= 4.7d+17) then
tmp = sqrt((1.0d0 + y)) + ((t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + sqrt(z)))) - sqrt(y))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + x));
double tmp;
if (y <= 4.7e+17) {
tmp = Math.sqrt((1.0 + y)) + ((t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + Math.sqrt(z)))) - Math.sqrt(y));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + x)) tmp = 0 if y <= 4.7e+17: tmp = math.sqrt((1.0 + y)) + ((t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + math.sqrt(z)))) - math.sqrt(y)) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (y <= 4.7e+17) tmp = Float64(sqrt(Float64(1.0 + y)) + Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + sqrt(z)))) - sqrt(y))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + x));
tmp = 0.0;
if (y <= 4.7e+17)
tmp = sqrt((1.0 + y)) + ((t_1 + (sqrt((1.0 + z)) - (sqrt(x) + sqrt(z)))) - sqrt(y));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.7e+17], N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + x}\\
\mathbf{if}\;y \leq 4.7 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{1 + y} + \left(\left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \sqrt{z}\right)\right)\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.7e17Initial program 96.9%
Simplified37.1%
Taylor expanded in t around inf 35.0%
associate--l+41.0%
+-commutative41.0%
Simplified41.0%
if 4.7e17 < y Initial program 86.4%
Simplified3.9%
Taylor expanded in t around inf 3.3%
associate--l+20.4%
+-commutative20.4%
associate-+r+20.4%
Simplified20.4%
Taylor expanded in z around inf 20.3%
Taylor expanded in y around inf 21.8%
flip--22.4%
div-inv22.4%
add-sqr-sqrt22.6%
add-sqr-sqrt22.8%
Applied egg-rr22.8%
associate-*r/22.8%
*-rgt-identity22.8%
associate--l+26.6%
+-inverses26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
Final simplification34.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 (+ 1.0 y))))
(if (<= y 8.6e-24)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (sqrt z)))))
(if (<= y 3.2e+17)
(+ (+ 1.0 (* x 0.5)) (- t_1 (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (y <= 8.6e-24) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
} else if (y <= 3.2e+17) {
tmp = (1.0 + (x * 0.5)) + (t_1 - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (y <= 8.6d-24) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(y) + sqrt(z))))
else if (y <= 3.2d+17) then
tmp = (1.0d0 + (x * 0.5d0)) + (t_1 - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 8.6e-24) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + Math.sqrt(z))));
} else if (y <= 3.2e+17) {
tmp = (1.0 + (x * 0.5)) + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if y <= 8.6e-24: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + math.sqrt(z)))) elif y <= 3.2e+17: tmp = (1.0 + (x * 0.5)) + (t_1 - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 8.6e-24) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + sqrt(z))))); elseif (y <= 3.2e+17) tmp = Float64(Float64(1.0 + Float64(x * 0.5)) + Float64(t_1 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 8.6e-24)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(y) + sqrt(z))));
elseif (y <= 3.2e+17)
tmp = (1.0 + (x * 0.5)) + (t_1 - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 8.6e-24], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+17], N[(N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 8.6 \cdot 10^{-24}:\\
\;\;\;\;1 + \left(t_1 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) + \left(t_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 8.6000000000000006e-24Initial program 97.5%
Simplified38.1%
Taylor expanded in t around inf 15.8%
associate--l+20.2%
+-commutative20.2%
associate-+r+20.2%
Simplified20.2%
Taylor expanded in x around 0 26.6%
associate--l+42.7%
associate--l+57.6%
+-commutative57.6%
Simplified57.6%
if 8.6000000000000006e-24 < y < 3.2e17Initial program 92.8%
Simplified29.4%
Taylor expanded in t around inf 15.4%
associate--l+20.3%
+-commutative20.3%
associate-+r+20.3%
Simplified20.3%
Taylor expanded in z around inf 12.3%
Taylor expanded in x around 0 12.3%
*-commutative11.6%
Simplified12.3%
if 3.2e17 < y Initial program 86.4%
Simplified3.9%
Taylor expanded in t around inf 3.3%
associate--l+20.4%
+-commutative20.4%
associate-+r+20.4%
Simplified20.4%
Taylor expanded in z around inf 20.3%
Taylor expanded in y around inf 21.8%
flip--22.4%
div-inv22.4%
add-sqr-sqrt22.6%
add-sqr-sqrt22.8%
Applied egg-rr22.8%
associate-*r/22.8%
*-rgt-identity22.8%
associate--l+26.6%
+-inverses26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
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
(if (<= y 1.04e-22)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 3.5e+17)
(+ (+ 1.0 (* x 0.5)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.04e-22) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 3.5e+17) {
tmp = (1.0 + (x * 0.5)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.04d-22) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 3.5d+17) then
tmp = (1.0d0 + (x * 0.5d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.04e-22) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 3.5e+17) {
tmp = (1.0 + (x * 0.5)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 1.04e-22: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 3.5e+17: tmp = (1.0 + (x * 0.5)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 1.04e-22) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 3.5e+17) 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(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 1.04e-22)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 3.5e+17)
tmp = (1.0 + (x * 0.5)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 1.04e-22], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 3.5e+17], 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[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.04 \cdot 10^{-22}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.04e-22Initial program 97.5%
Simplified37.9%
Taylor expanded in t around inf 15.7%
associate--l+20.2%
+-commutative20.2%
associate-+r+20.2%
Simplified20.2%
Taylor expanded in y around 0 20.2%
Taylor expanded in x around 0 26.4%
associate--l+57.3%
Simplified57.3%
if 1.04e-22 < y < 3.5e17Initial program 92.4%
Simplified30.2%
Taylor expanded in t around inf 16.2%
associate--l+20.5%
+-commutative20.5%
associate-+r+20.5%
Simplified20.5%
Taylor expanded in z around inf 11.8%
Taylor expanded in x around 0 11.8%
*-commutative11.2%
Simplified11.8%
if 3.5e17 < y Initial program 86.4%
Simplified3.9%
Taylor expanded in t around inf 3.3%
associate--l+20.4%
+-commutative20.4%
associate-+r+20.4%
Simplified20.4%
Taylor expanded in z around inf 20.3%
Taylor expanded in y around inf 21.8%
flip--22.4%
div-inv22.4%
add-sqr-sqrt22.6%
add-sqr-sqrt22.8%
Applied egg-rr22.8%
associate-*r/22.8%
*-rgt-identity22.8%
associate--l+26.6%
+-inverses26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
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
(if (<= y 2.05e-22)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) 2.0)
(if (<= y 4e+17)
(+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y)))
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e-22) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
} else if (y <= 4e+17) {
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
} else {
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.05d-22) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + 2.0d0
else if (y <= 4d+17) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
else
tmp = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e-22) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + 2.0;
} else if (y <= 4e+17) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
} else {
tmp = 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 2.05e-22: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + 2.0 elif y <= 4e+17: tmp = 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y)) else: tmp = 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 2.05e-22) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + 2.0); elseif (y <= 4e+17) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))); else tmp = Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 2.05e-22)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + 2.0;
elseif (y <= 4e+17)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
else
tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 2.05e-22], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], If[LessEqual[y, 4e+17], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.05 \cdot 10^{-22}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + 2\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.05e-22Initial program 97.5%
Simplified37.9%
Taylor expanded in t around inf 15.7%
associate--l+20.2%
+-commutative20.2%
associate-+r+20.2%
Simplified20.2%
Taylor expanded in y around 0 20.2%
Taylor expanded in x around 0 26.4%
associate--l+57.3%
Simplified57.3%
if 2.05e-22 < y < 4e17Initial program 92.4%
Simplified30.2%
Taylor expanded in t around inf 16.2%
associate--l+20.5%
+-commutative20.5%
associate-+r+20.5%
Simplified20.5%
Taylor expanded in z around inf 11.8%
Taylor expanded in x around 0 40.0%
associate--l+40.1%
Simplified40.1%
if 4e17 < y Initial program 86.4%
Simplified3.9%
Taylor expanded in t around inf 3.3%
associate--l+20.4%
+-commutative20.4%
associate-+r+20.4%
Simplified20.4%
Taylor expanded in z around inf 20.3%
Taylor expanded in y around inf 21.8%
flip--22.4%
div-inv22.4%
add-sqr-sqrt22.6%
add-sqr-sqrt22.8%
Applied egg-rr22.8%
associate-*r/22.8%
*-rgt-identity22.8%
associate--l+26.6%
+-inverses26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
Final simplification42.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 1.2e+15) (+ (- (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.2e+15) {
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.2d+15) 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.2e+15) {
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.2e+15: 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.2e+15) 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.2e+15)
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.2e+15], 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.2 \cdot 10^{+15}:\\
\;\;\;\;\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.2e15Initial program 97.0%
Simplified30.5%
Taylor expanded in t around inf 16.4%
associate--l+20.5%
+-commutative20.5%
associate-+r+20.5%
Simplified20.5%
Taylor expanded in y around 0 29.4%
Taylor expanded in x around 0 43.9%
associate--l+43.9%
Simplified43.9%
if 1.2e15 < z Initial program 88.0%
Simplified15.0%
Taylor expanded in t around inf 4.7%
associate--l+20.2%
+-commutative20.2%
associate-+r+20.2%
Simplified20.2%
Taylor expanded in z around inf 34.2%
Taylor expanded in x around 0 37.8%
associate--l+56.6%
Simplified56.6%
Final simplification50.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (- (sqrt (+ 1.0 y)) (sqrt y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (sqrt((1.0 + y)) - sqrt(y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 + (sqrt((1.0d0 + y)) - sqrt(y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (Math.sqrt((1.0 + y)) - Math.sqrt(y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (math.sqrt((1.0 + y)) - math.sqrt(y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (sqrt((1.0 + y)) - sqrt(y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \left(\sqrt{1 + y} - \sqrt{y}\right)
\end{array}
Initial program 92.3%
Simplified22.4%
Taylor expanded in t around inf 10.3%
associate--l+20.3%
+-commutative20.3%
associate-+r+20.3%
Simplified20.3%
Taylor expanded in z around inf 23.5%
Taylor expanded in x around 0 30.4%
associate--l+46.8%
Simplified46.8%
Final simplification46.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ 1.0 x)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + x)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + x)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + x)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + x)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + x)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + x} - \sqrt{x}
\end{array}
Initial program 92.3%
Simplified22.4%
Taylor expanded in t around inf 10.3%
associate--l+20.3%
+-commutative20.3%
associate-+r+20.3%
Simplified20.3%
Taylor expanded in z around inf 23.5%
Taylor expanded in y around inf 15.5%
Final simplification15.5%
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 92.3%
Simplified22.4%
Taylor expanded in t around inf 10.3%
associate--l+20.3%
+-commutative20.3%
associate-+r+20.3%
Simplified20.3%
Taylor expanded in z around inf 23.5%
Taylor expanded in y around inf 15.5%
Taylor expanded in x around 0 15.5%
*-commutative15.5%
Simplified15.5%
Final simplification15.5%
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 92.3%
Simplified22.4%
Taylor expanded in t around inf 10.3%
associate--l+20.3%
+-commutative20.3%
associate-+r+20.3%
Simplified20.3%
Taylor expanded in z around inf 23.5%
Taylor expanded in y around inf 15.5%
Taylor expanded in x around 0 32.5%
Final simplification32.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 2023318
(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))))