
(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 22 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 (+ y 1.0)) (sqrt y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_1 5e-7)
(+
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_2 (sqrt z)) t_3))
(+
(+ (- 1.0 (sqrt x)) (pow (sqrt t_1) 2.0))
(+ t_3 (/ 1.0 (+ t_2 (sqrt z))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_1 <= 5e-7) {
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
} else {
tmp = ((1.0 - sqrt(x)) + pow(sqrt(t_1), 2.0)) + (t_3 + (1.0 / (t_2 + 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((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_1 <= 5d-7) then
tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_2 - sqrt(z)) + t_3)
else
tmp = ((1.0d0 - sqrt(x)) + (sqrt(t_1) ** 2.0d0)) + (t_3 + (1.0d0 / (t_2 + 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((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_1 <= 5e-7) {
tmp = ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_2 - Math.sqrt(z)) + t_3);
} else {
tmp = ((1.0 - Math.sqrt(x)) + Math.pow(Math.sqrt(t_1), 2.0)) + (t_3 + (1.0 / (t_2 + Math.sqrt(z))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_1 <= 5e-7: tmp = ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (0.5 * math.sqrt((1.0 / y)))) + ((t_2 - math.sqrt(z)) + t_3) else: tmp = ((1.0 - math.sqrt(x)) + math.pow(math.sqrt(t_1), 2.0)) + (t_3 + (1.0 / (t_2 + math.sqrt(z)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_1 <= 5e-7) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_2 - sqrt(z)) + t_3)); else tmp = Float64(Float64(Float64(1.0 - sqrt(x)) + (sqrt(t_1) ^ 2.0)) + Float64(t_3 + Float64(1.0 / Float64(t_2 + 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((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_1 <= 5e-7)
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
else
tmp = ((1.0 - sqrt(x)) + (sqrt(t_1) ^ 2.0)) + (t_3 + (1.0 / (t_2 + 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[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-7], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[Power[N[Sqrt[t$95$1], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(1.0 / N[(t$95$2 + 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 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_2 - \sqrt{z}\right) + t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - \sqrt{x}\right) + {\left(\sqrt{t\_1}\right)}^{2}\right) + \left(t\_3 + \frac{1}{t\_2 + \sqrt{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 4.99999999999999977e-7Initial program 86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
Simplified86.7%
flip--86.7%
add-sqr-sqrt74.5%
+-commutative74.5%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+89.9%
+-inverses89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in y around inf 92.1%
if 4.99999999999999977e-7 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 48.9%
flip--48.9%
add-sqr-sqrt39.3%
add-sqr-sqrt49.2%
Applied egg-rr49.2%
associate--l+49.2%
+-inverses49.2%
metadata-eval49.2%
+-commutative49.2%
Simplified49.2%
add-sqr-sqrt49.2%
pow249.2%
Applied egg-rr49.2%
Final simplification70.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 (+ y 1.0)) (sqrt y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= t_1 5e-7)
(+
(+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (* 0.5 (sqrt (/ 1.0 y))))
(+ (- t_2 (sqrt z)) t_3))
(+ (+ t_3 (/ 1.0 (+ t_2 (sqrt z)))) (+ (- 1.0 (sqrt x)) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0)) - sqrt(y);
double t_2 = sqrt((1.0 + z));
double t_3 = sqrt((1.0 + t)) - sqrt(t);
double tmp;
if (t_1 <= 5e-7) {
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
} else {
tmp = (t_3 + (1.0 / (t_2 + sqrt(z)))) + ((1.0 - sqrt(x)) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((y + 1.0d0)) - sqrt(y)
t_2 = sqrt((1.0d0 + z))
t_3 = sqrt((1.0d0 + t)) - sqrt(t)
if (t_1 <= 5d-7) then
tmp = ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (0.5d0 * sqrt((1.0d0 / y)))) + ((t_2 - sqrt(z)) + t_3)
else
tmp = (t_3 + (1.0d0 / (t_2 + sqrt(z)))) + ((1.0d0 - sqrt(x)) + 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((y + 1.0)) - Math.sqrt(y);
double t_2 = Math.sqrt((1.0 + z));
double t_3 = Math.sqrt((1.0 + t)) - Math.sqrt(t);
double tmp;
if (t_1 <= 5e-7) {
tmp = ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (0.5 * Math.sqrt((1.0 / y)))) + ((t_2 - Math.sqrt(z)) + t_3);
} else {
tmp = (t_3 + (1.0 / (t_2 + Math.sqrt(z)))) + ((1.0 - Math.sqrt(x)) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) - math.sqrt(y) t_2 = math.sqrt((1.0 + z)) t_3 = math.sqrt((1.0 + t)) - math.sqrt(t) tmp = 0 if t_1 <= 5e-7: tmp = ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (0.5 * math.sqrt((1.0 / y)))) + ((t_2 - math.sqrt(z)) + t_3) else: tmp = (t_3 + (1.0 / (t_2 + math.sqrt(z)))) + ((1.0 - math.sqrt(x)) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) tmp = 0.0 if (t_1 <= 5e-7) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(0.5 * sqrt(Float64(1.0 / y)))) + Float64(Float64(t_2 - sqrt(z)) + t_3)); else tmp = Float64(Float64(t_3 + Float64(1.0 / Float64(t_2 + sqrt(z)))) + Float64(Float64(1.0 - sqrt(x)) + 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((y + 1.0)) - sqrt(y);
t_2 = sqrt((1.0 + z));
t_3 = sqrt((1.0 + t)) - sqrt(t);
tmp = 0.0;
if (t_1 <= 5e-7)
tmp = ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (0.5 * sqrt((1.0 / y)))) + ((t_2 - sqrt(z)) + t_3);
else
tmp = (t_3 + (1.0 / (t_2 + sqrt(z)))) + ((1.0 - sqrt(x)) + 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[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-7], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1} - \sqrt{y}\\
t_2 := \sqrt{1 + z}\\
t_3 := \sqrt{1 + t} - \sqrt{t}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) + \left(\left(t\_2 - \sqrt{z}\right) + t\_3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_3 + \frac{1}{t\_2 + \sqrt{z}}\right) + \left(\left(1 - \sqrt{x}\right) + t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 4.99999999999999977e-7Initial program 86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
Simplified86.7%
flip--86.7%
add-sqr-sqrt74.5%
+-commutative74.5%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+89.9%
+-inverses89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in y around inf 92.1%
if 4.99999999999999977e-7 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 48.9%
flip--48.9%
add-sqr-sqrt39.3%
add-sqr-sqrt49.2%
Applied egg-rr49.2%
associate--l+49.2%
+-inverses49.2%
metadata-eval49.2%
+-commutative49.2%
Simplified49.2%
Final simplification70.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 z))) (t_2 (- (sqrt (+ y 1.0)) (sqrt y))))
(if (<= y 56000000000000.0)
(+
(+ (- (sqrt (+ 1.0 t)) (sqrt t)) (/ 1.0 (+ t_1 (sqrt z))))
(+ (- 1.0 (sqrt x)) t_2))
(+ (- t_1 (sqrt z)) (+ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) t_2)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double tmp;
if (y <= 56000000000000.0) {
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z)))) + ((1.0 - sqrt(x)) + t_2);
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + t_2);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
if (y <= 56000000000000.0d0) then
tmp = ((sqrt((1.0d0 + t)) - sqrt(t)) + (1.0d0 / (t_1 + sqrt(z)))) + ((1.0d0 - sqrt(x)) + t_2)
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + t_2)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double tmp;
if (y <= 56000000000000.0) {
tmp = ((Math.sqrt((1.0 + t)) - Math.sqrt(t)) + (1.0 / (t_1 + Math.sqrt(z)))) + ((1.0 - Math.sqrt(x)) + t_2);
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + t_2);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) tmp = 0 if y <= 56000000000000.0: tmp = ((math.sqrt((1.0 + t)) - math.sqrt(t)) + (1.0 / (t_1 + math.sqrt(z)))) + ((1.0 - math.sqrt(x)) + t_2) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + t_2) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) tmp = 0.0 if (y <= 56000000000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + t)) - sqrt(t)) + Float64(1.0 / Float64(t_1 + sqrt(z)))) + Float64(Float64(1.0 - sqrt(x)) + t_2)); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + t_2)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = sqrt((y + 1.0)) - sqrt(y);
tmp = 0.0;
if (y <= 56000000000000.0)
tmp = ((sqrt((1.0 + t)) - sqrt(t)) + (1.0 / (t_1 + sqrt(z)))) + ((1.0 - sqrt(x)) + t_2);
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + t_2);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 56000000000000.0], N[(N[(N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \sqrt{y + 1} - \sqrt{y}\\
\mathbf{if}\;y \leq 56000000000000:\\
\;\;\;\;\left(\left(\sqrt{1 + t} - \sqrt{t}\right) + \frac{1}{t\_1 + \sqrt{z}}\right) + \left(\left(1 - \sqrt{x}\right) + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + t\_2\right)\\
\end{array}
\end{array}
if y < 5.6e13Initial program 97.6%
associate-+l+97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 48.9%
flip--48.9%
add-sqr-sqrt39.3%
add-sqr-sqrt49.2%
Applied egg-rr49.2%
associate--l+49.2%
+-inverses49.2%
metadata-eval49.2%
+-commutative49.2%
Simplified49.2%
if 5.6e13 < y Initial program 86.7%
associate-+l+86.7%
+-commutative86.7%
+-commutative86.7%
+-commutative86.7%
Simplified86.7%
flip--86.7%
add-sqr-sqrt74.5%
+-commutative74.5%
add-sqr-sqrt87.0%
+-commutative87.0%
Applied egg-rr87.0%
associate--l+89.9%
+-inverses89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in t around inf 50.4%
Final simplification49.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 z))))
(if (<= t 1.9e+25)
(-
(+ (+ t_1 2.0) (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(+ (sqrt y) (+ (sqrt x) (sqrt z))))
(+
(- t_1 (sqrt z))
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(- (sqrt (+ y 1.0)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double tmp;
if (t <= 1.9e+25) {
tmp = ((t_1 + 2.0) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) - (sqrt(y) + (sqrt(x) + sqrt(z)));
} else {
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (sqrt((y + 1.0)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
if (t <= 1.9d+25) then
tmp = ((t_1 + 2.0d0) + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t)))) - (sqrt(y) + (sqrt(x) + sqrt(z)))
else
tmp = (t_1 - sqrt(z)) + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (sqrt((y + 1.0d0)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double tmp;
if (t <= 1.9e+25) {
tmp = ((t_1 + 2.0) + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z)));
} else {
tmp = (t_1 - Math.sqrt(z)) + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) tmp = 0 if t <= 1.9e+25: tmp = ((t_1 + 2.0) + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z))) else: tmp = (t_1 - math.sqrt(z)) + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (math.sqrt((y + 1.0)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (t <= 1.9e+25) tmp = Float64(Float64(Float64(t_1 + 2.0) + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z)))); else tmp = Float64(Float64(t_1 - sqrt(z)) + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
tmp = 0.0;
if (t <= 1.9e+25)
tmp = ((t_1 + 2.0) + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) - (sqrt(y) + (sqrt(x) + sqrt(z)));
else
tmp = (t_1 - sqrt(z)) + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (sqrt((y + 1.0)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.9e+25], N[(N[(N[(t$95$1 + 2.0), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - 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[(y + 1.0), $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}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;t \leq 1.9 \cdot 10^{+25}:\\
\;\;\;\;\left(\left(t\_1 + 2\right) + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{z}\right) + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 1.9e25Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-76.7%
associate-+l-57.9%
associate-+r-54.4%
Simplified44.7%
flip--44.7%
add-sqr-sqrt44.5%
add-sqr-sqrt44.7%
+-commutative44.7%
+-commutative44.7%
Applied egg-rr44.7%
associate--r+45.2%
div-sub45.2%
+-inverses45.2%
metadata-eval45.2%
+-inverses45.2%
sub-neg45.2%
associate-+l+44.7%
+-commutative44.7%
sub-neg44.7%
div-sub44.7%
neg-sub044.7%
sub-neg44.7%
+-commutative44.7%
associate-+l+45.2%
sub-neg45.2%
+-inverses45.2%
metadata-eval45.2%
metadata-eval45.2%
Simplified45.2%
Taylor expanded in x around 0 23.1%
Taylor expanded in y around 0 16.9%
associate-+r+16.9%
+-commutative16.9%
+-commutative16.9%
associate-+r+16.9%
+-commutative16.9%
Simplified16.9%
if 1.9e25 < t Initial program 86.9%
associate-+l+86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
flip--86.9%
add-sqr-sqrt72.2%
+-commutative72.2%
add-sqr-sqrt87.4%
+-commutative87.4%
Applied egg-rr87.4%
associate--l+90.2%
+-inverses90.2%
metadata-eval90.2%
Simplified90.2%
Taylor expanded in t around inf 90.2%
Final simplification51.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= t 1.9e+25)
(+
(+ t_1 (- (sqrt (+ 1.0 t)) (sqrt t)))
(+ (- 1.0 (sqrt x)) (- 1.0 (sqrt y))))
(+
t_1
(+
(/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x)))
(- (sqrt (+ y 1.0)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (t <= 1.9e+25) {
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 - sqrt(x)) + (1.0 - sqrt(y)));
} else {
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (sqrt((y + 1.0)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + z)) - sqrt(z)
if (t <= 1.9d+25) then
tmp = (t_1 + (sqrt((1.0d0 + t)) - sqrt(t))) + ((1.0d0 - sqrt(x)) + (1.0d0 - sqrt(y)))
else
tmp = t_1 + ((1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) + (sqrt((y + 1.0d0)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (t <= 1.9e+25) {
tmp = (t_1 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + ((1.0 - Math.sqrt(x)) + (1.0 - Math.sqrt(y)));
} else {
tmp = t_1 + ((1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if t <= 1.9e+25: tmp = (t_1 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + ((1.0 - math.sqrt(x)) + (1.0 - math.sqrt(y))) else: tmp = t_1 + ((1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) + (math.sqrt((y + 1.0)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (t <= 1.9e+25) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(Float64(1.0 - sqrt(x)) + Float64(1.0 - sqrt(y)))); else tmp = Float64(t_1 + Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (t <= 1.9e+25)
tmp = (t_1 + (sqrt((1.0 + t)) - sqrt(t))) + ((1.0 - sqrt(x)) + (1.0 - sqrt(y)));
else
tmp = t_1 + ((1.0 / (sqrt((1.0 + x)) + sqrt(x))) + (sqrt((y + 1.0)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.9e+25], N[(N[(t$95$1 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $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}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;t \leq 1.9 \cdot 10^{+25}:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(\left(1 - \sqrt{x}\right) + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\frac{1}{\sqrt{1 + x} + \sqrt{x}} + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if t < 1.9e25Initial program 97.1%
associate-+l+97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 53.3%
Taylor expanded in y around 0 26.5%
if 1.9e25 < t Initial program 86.9%
associate-+l+86.9%
+-commutative86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
flip--86.9%
add-sqr-sqrt72.2%
+-commutative72.2%
add-sqr-sqrt87.4%
+-commutative87.4%
Applied egg-rr87.4%
associate--l+90.2%
+-inverses90.2%
metadata-eval90.2%
Simplified90.2%
Taylor expanded in t around inf 90.2%
Final simplification56.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 (- 1.0 (sqrt x))) (t_2 (- (sqrt (+ 1.0 z)) (sqrt z))))
(if (<= y 2.8e-22)
(+ (+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t))) (+ t_1 (- 1.0 (sqrt y))))
(if (<= y 9e+22)
(+ t_2 (+ t_1 (/ 1.0 (+ (sqrt y) (sqrt (+ y 1.0))))))
(/ (+ 1.0 (- x x)) (+ (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 = 1.0 - sqrt(x);
double t_2 = sqrt((1.0 + z)) - sqrt(z);
double tmp;
if (y <= 2.8e-22) {
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 - sqrt(y)));
} else if (y <= 9e+22) {
tmp = t_2 + (t_1 + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
} else {
tmp = (1.0 + (x - x)) / (sqrt((1.0 + x)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - sqrt(x)
t_2 = sqrt((1.0d0 + z)) - sqrt(z)
if (y <= 2.8d-22) then
tmp = (t_2 + (sqrt((1.0d0 + t)) - sqrt(t))) + (t_1 + (1.0d0 - sqrt(y)))
else if (y <= 9d+22) then
tmp = t_2 + (t_1 + (1.0d0 / (sqrt(y) + sqrt((y + 1.0d0)))))
else
tmp = (1.0d0 + (x - x)) / (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 = 1.0 - Math.sqrt(x);
double t_2 = Math.sqrt((1.0 + z)) - Math.sqrt(z);
double tmp;
if (y <= 2.8e-22) {
tmp = (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (t_1 + (1.0 - Math.sqrt(y)));
} else if (y <= 9e+22) {
tmp = t_2 + (t_1 + (1.0 / (Math.sqrt(y) + Math.sqrt((y + 1.0)))));
} else {
tmp = (1.0 + (x - x)) / (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 = 1.0 - math.sqrt(x) t_2 = math.sqrt((1.0 + z)) - math.sqrt(z) tmp = 0 if y <= 2.8e-22: tmp = (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (t_1 + (1.0 - math.sqrt(y))) elif y <= 9e+22: tmp = t_2 + (t_1 + (1.0 / (math.sqrt(y) + math.sqrt((y + 1.0))))) else: tmp = (1.0 + (x - x)) / (math.sqrt((1.0 + x)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 - sqrt(x)) t_2 = Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) tmp = 0.0 if (y <= 2.8e-22) tmp = Float64(Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(t_1 + Float64(1.0 - sqrt(y)))); elseif (y <= 9e+22) tmp = Float64(t_2 + Float64(t_1 + Float64(1.0 / Float64(sqrt(y) + sqrt(Float64(y + 1.0)))))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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 = 1.0 - sqrt(x);
t_2 = sqrt((1.0 + z)) - sqrt(z);
tmp = 0.0;
if (y <= 2.8e-22)
tmp = (t_2 + (sqrt((1.0 + t)) - sqrt(t))) + (t_1 + (1.0 - sqrt(y)));
elseif (y <= 9e+22)
tmp = t_2 + (t_1 + (1.0 / (sqrt(y) + sqrt((y + 1.0)))));
else
tmp = (1.0 + (x - x)) / (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[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.8e-22], N[(N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+22], N[(t$95$2 + N[(t$95$1 + N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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 := 1 - \sqrt{x}\\
t_2 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 2.8 \cdot 10^{-22}:\\
\;\;\;\;\left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(t\_1 + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+22}:\\
\;\;\;\;t\_2 + \left(t\_1 + \frac{1}{\sqrt{y} + \sqrt{y + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 2.79999999999999995e-22Initial program 97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 49.0%
Taylor expanded in y around 0 49.0%
if 2.79999999999999995e-22 < y < 8.9999999999999996e22Initial program 94.6%
associate-+l+94.6%
+-commutative94.6%
+-commutative94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in x around 0 50.1%
Taylor expanded in t around inf 27.0%
flip--27.0%
add-sqr-sqrt26.9%
add-sqr-sqrt26.9%
Applied egg-rr26.9%
associate--l+26.9%
+-inverses26.9%
metadata-eval26.9%
+-commutative26.9%
Simplified26.9%
if 8.9999999999999996e22 < y Initial program 86.9%
+-commutative86.9%
associate-+r+86.9%
associate-+r-44.4%
associate-+l-23.6%
associate-+r-4.3%
Simplified3.7%
Taylor expanded in t around inf 3.6%
associate--l+22.8%
+-commutative22.8%
+-commutative22.8%
Simplified22.8%
Taylor expanded in x around inf 22.2%
mul-1-neg22.2%
Simplified22.2%
flip-+22.2%
add-sqr-sqrt22.3%
pow222.3%
Applied egg-rr22.3%
associate--l+24.0%
unpow224.0%
sqr-neg24.0%
rem-square-sqrt26.0%
sub-neg26.0%
remove-double-neg26.0%
Simplified26.0%
Final simplification36.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 (<= y 1.2e+22)
(+
(/ 1.0 (+ (sqrt (+ 1.0 z)) (sqrt z)))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (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.2e+22) {
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (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.2d+22) then
tmp = (1.0d0 / (sqrt((1.0d0 + z)) + sqrt(z))) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (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.2e+22) {
tmp = (1.0 / (Math.sqrt((1.0 + z)) + Math.sqrt(z))) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (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.2e+22: tmp = (1.0 / (math.sqrt((1.0 + z)) + math.sqrt(z))) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (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.2e+22) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + z)) + sqrt(z))) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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.2e+22)
tmp = (1.0 / (sqrt((1.0 + z)) + sqrt(z))) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
else
tmp = (1.0 + (x - x)) / (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.2e+22], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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.2 \cdot 10^{+22}:\\
\;\;\;\;\frac{1}{\sqrt{1 + z} + \sqrt{z}} + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.2e22Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 49.1%
flip--49.1%
add-sqr-sqrt39.5%
add-sqr-sqrt49.4%
Applied egg-rr49.4%
associate--l+49.4%
+-inverses49.4%
metadata-eval49.4%
+-commutative49.4%
Simplified49.4%
Taylor expanded in t around inf 27.7%
if 1.2e22 < y Initial program 86.9%
+-commutative86.9%
associate-+r+86.9%
associate-+r-44.4%
associate-+l-23.6%
associate-+r-4.3%
Simplified3.7%
Taylor expanded in t around inf 3.6%
associate--l+22.8%
+-commutative22.8%
+-commutative22.8%
Simplified22.8%
Taylor expanded in x around inf 22.2%
mul-1-neg22.2%
Simplified22.2%
flip-+22.2%
add-sqr-sqrt22.3%
pow222.3%
Applied egg-rr22.3%
associate--l+24.0%
unpow224.0%
sqr-neg24.0%
rem-square-sqrt26.0%
sub-neg26.0%
remove-double-neg26.0%
Simplified26.0%
Final simplification26.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.2e+22)
(-
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (+ 1.0 (+ (sqrt x) (sqrt (+ y 1.0)))))
(sqrt y))
(/ (+ 1.0 (- x x)) (+ (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.2e+22) {
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt(x) + sqrt((y + 1.0))))) - sqrt(y);
} else {
tmp = (1.0 + (x - x)) / (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.2d+22) then
tmp = ((sqrt((1.0d0 + z)) - sqrt(z)) + (1.0d0 + (sqrt(x) + sqrt((y + 1.0d0))))) - sqrt(y)
else
tmp = (1.0d0 + (x - x)) / (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.2e+22) {
tmp = ((Math.sqrt((1.0 + z)) - Math.sqrt(z)) + (1.0 + (Math.sqrt(x) + Math.sqrt((y + 1.0))))) - Math.sqrt(y);
} else {
tmp = (1.0 + (x - x)) / (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.2e+22: tmp = ((math.sqrt((1.0 + z)) - math.sqrt(z)) + (1.0 + (math.sqrt(x) + math.sqrt((y + 1.0))))) - math.sqrt(y) else: tmp = (1.0 + (x - x)) / (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.2e+22) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(1.0 + Float64(sqrt(x) + sqrt(Float64(y + 1.0))))) - sqrt(y)); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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.2e+22)
tmp = ((sqrt((1.0 + z)) - sqrt(z)) + (1.0 + (sqrt(x) + sqrt((y + 1.0))))) - sqrt(y);
else
tmp = (1.0 + (x - x)) / (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.2e+22], N[(N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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.2 \cdot 10^{+22}:\\
\;\;\;\;\left(\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(1 + \left(\sqrt{x} + \sqrt{y + 1}\right)\right)\right) - \sqrt{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.2e22Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 49.1%
Taylor expanded in t around inf 27.4%
+-commutative27.4%
associate-+r-27.4%
associate-+r-27.2%
sub-neg27.2%
associate-+l+27.2%
add-sqr-sqrt0.0%
sqrt-unprod30.1%
sqr-neg30.1%
add-sqr-sqrt30.1%
Applied egg-rr30.1%
if 1.2e22 < y Initial program 86.9%
+-commutative86.9%
associate-+r+86.9%
associate-+r-44.4%
associate-+l-23.6%
associate-+r-4.3%
Simplified3.7%
Taylor expanded in t around inf 3.6%
associate--l+22.8%
+-commutative22.8%
+-commutative22.8%
Simplified22.8%
Taylor expanded in x around inf 22.2%
mul-1-neg22.2%
Simplified22.2%
flip-+22.2%
add-sqr-sqrt22.3%
pow222.3%
Applied egg-rr22.3%
associate--l+24.0%
unpow224.0%
sqr-neg24.0%
rem-square-sqrt26.0%
sub-neg26.0%
remove-double-neg26.0%
Simplified26.0%
Final simplification28.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 1.2e+22)
(+
(- (sqrt (+ 1.0 z)) (sqrt z))
(+ (- 1.0 (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))))
(/ (+ 1.0 (- x x)) (+ (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.2e+22) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (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.2d+22) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y)))
else
tmp = (1.0d0 + (x - x)) / (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.2e+22) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
} else {
tmp = (1.0 + (x - x)) / (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.2e+22: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) else: tmp = (1.0 + (x - x)) / (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.2e+22) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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.2e+22)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y)));
else
tmp = (1.0 + (x - x)) / (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.2e+22], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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.2 \cdot 10^{+22}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.2e22Initial program 97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in x around 0 49.1%
Taylor expanded in t around inf 27.4%
if 1.2e22 < y Initial program 86.9%
+-commutative86.9%
associate-+r+86.9%
associate-+r-44.4%
associate-+l-23.6%
associate-+r-4.3%
Simplified3.7%
Taylor expanded in t around inf 3.6%
associate--l+22.8%
+-commutative22.8%
+-commutative22.8%
Simplified22.8%
Taylor expanded in x around inf 22.2%
mul-1-neg22.2%
Simplified22.2%
flip-+22.2%
add-sqr-sqrt22.3%
pow222.3%
Applied egg-rr22.3%
associate--l+24.0%
unpow224.0%
sqr-neg24.0%
rem-square-sqrt26.0%
sub-neg26.0%
remove-double-neg26.0%
Simplified26.0%
Final simplification26.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 (<= y 1.32e-21)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (- 2.0 (sqrt x)) (sqrt y)))
(if (<= y 3.55e+19)
(+
1.0
(- (+ (sqrt (+ y 1.0)) (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt y) (sqrt x))))
(/ (+ 1.0 (- x x)) (+ (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.32e-21) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 - sqrt(x)) - sqrt(y));
} else if (y <= 3.55e+19) {
tmp = 1.0 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (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.32d-21) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((2.0d0 - sqrt(x)) - sqrt(y))
else if (y <= 3.55d+19) then
tmp = 1.0d0 + ((sqrt((y + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(y) + sqrt(x)))
else
tmp = (1.0d0 + (x - x)) / (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.32e-21) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((2.0 - Math.sqrt(x)) - Math.sqrt(y));
} else if (y <= 3.55e+19) {
tmp = 1.0 + ((Math.sqrt((y + 1.0)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (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.32e-21: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((2.0 - math.sqrt(x)) - math.sqrt(y)) elif y <= 3.55e+19: tmp = 1.0 + ((math.sqrt((y + 1.0)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (1.0 + (x - x)) / (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.32e-21) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(2.0 - sqrt(x)) - sqrt(y))); elseif (y <= 3.55e+19) tmp = Float64(1.0 + Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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.32e-21)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 - sqrt(x)) - sqrt(y));
elseif (y <= 3.55e+19)
tmp = 1.0 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(y) + sqrt(x)));
else
tmp = (1.0 + (x - x)) / (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.32e-21], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.55e+19], N[(1.0 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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.32 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 3.55 \cdot 10^{+19}:\\
\;\;\;\;1 + \left(\left(\sqrt{y + 1} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.32e-21Initial program 97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 49.0%
Taylor expanded in t around inf 27.4%
Taylor expanded in y around 0 27.4%
associate--r+27.4%
Simplified27.4%
if 1.32e-21 < y < 3.55e19Initial program 96.6%
+-commutative96.6%
associate-+r+96.6%
associate-+r-96.7%
associate-+l-96.7%
associate-+r-96.6%
Simplified78.6%
Taylor expanded in t around inf 14.5%
associate--l+18.8%
+-commutative18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in x around 0 14.0%
Taylor expanded in z around inf 13.0%
associate--l+13.0%
+-commutative13.0%
Simplified13.0%
if 3.55e19 < y Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-44.6%
associate-+l-24.0%
associate-+r-4.7%
Simplified4.1%
Taylor expanded in t around inf 4.0%
associate--l+23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 22.5%
mul-1-neg22.5%
Simplified22.5%
flip-+22.5%
add-sqr-sqrt22.5%
pow222.5%
Applied egg-rr22.5%
associate--l+24.2%
unpow224.2%
sqr-neg24.2%
rem-square-sqrt26.3%
sub-neg26.3%
remove-double-neg26.3%
Simplified26.3%
Final simplification26.1%
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.32e-21)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (- 2.0 (sqrt x)) (sqrt y)))
(if (<= y 5e+19)
(+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x))))
(/ (+ 1.0 (- x x)) (+ (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.32e-21) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 - sqrt(x)) - sqrt(y));
} else if (y <= 5e+19) {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (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.32d-21) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((2.0d0 - sqrt(x)) - sqrt(y))
else if (y <= 5d+19) then
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = (1.0d0 + (x - x)) / (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.32e-21) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((2.0 - Math.sqrt(x)) - Math.sqrt(y));
} else if (y <= 5e+19) {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (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.32e-21: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((2.0 - math.sqrt(x)) - math.sqrt(y)) elif y <= 5e+19: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (1.0 + (x - x)) / (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.32e-21) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(2.0 - sqrt(x)) - sqrt(y))); elseif (y <= 5e+19) tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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.32e-21)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((2.0 - sqrt(x)) - sqrt(y));
elseif (y <= 5e+19)
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = (1.0 + (x - x)) / (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.32e-21], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+19], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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.32 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(2 - \sqrt{x}\right) - \sqrt{y}\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+19}:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.32e-21Initial program 97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 49.0%
Taylor expanded in t around inf 27.4%
Taylor expanded in y around 0 27.4%
associate--r+27.4%
Simplified27.4%
if 1.32e-21 < y < 5e19Initial program 96.6%
+-commutative96.6%
associate-+r+96.6%
associate-+r-96.7%
associate-+l-96.7%
associate-+r-96.6%
Simplified78.6%
Taylor expanded in t around inf 14.5%
associate--l+18.8%
+-commutative18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in x around 0 14.0%
Taylor expanded in z around inf 17.2%
associate--l+17.2%
Simplified17.2%
if 5e19 < y Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-44.6%
associate-+l-24.0%
associate-+r-4.7%
Simplified4.1%
Taylor expanded in t around inf 4.0%
associate--l+23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 22.5%
mul-1-neg22.5%
Simplified22.5%
flip-+22.5%
add-sqr-sqrt22.5%
pow222.5%
Applied egg-rr22.5%
associate--l+24.2%
unpow224.2%
sqr-neg24.2%
rem-square-sqrt26.3%
sub-neg26.3%
remove-double-neg26.3%
Simplified26.3%
Final simplification26.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 7.7e-25)
(+ 2.0 (- (sqrt (+ 1.0 z)) (+ (sqrt y) (+ (sqrt x) (sqrt z)))))
(if (<= y 5e+19)
(- (+ 1.0 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x)))
(/ (+ 1.0 (- x x)) (+ (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 <= 7.7e-25) {
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
} else if (y <= 5e+19) {
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = (1.0 + (x - x)) / (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 <= 7.7d-25) then
tmp = 2.0d0 + (sqrt((1.0d0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))))
else if (y <= 5d+19) then
tmp = (1.0d0 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = (1.0d0 + (x - x)) / (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 <= 7.7e-25) {
tmp = 2.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(y) + (Math.sqrt(x) + Math.sqrt(z))));
} else if (y <= 5e+19) {
tmp = (1.0 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = (1.0 + (x - x)) / (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 <= 7.7e-25: tmp = 2.0 + (math.sqrt((1.0 + z)) - (math.sqrt(y) + (math.sqrt(x) + math.sqrt(z)))) elif y <= 5e+19: tmp = (1.0 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = (1.0 + (x - x)) / (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 <= 7.7e-25) tmp = Float64(2.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(y) + Float64(sqrt(x) + sqrt(z))))); elseif (y <= 5e+19) tmp = Float64(Float64(1.0 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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 <= 7.7e-25)
tmp = 2.0 + (sqrt((1.0 + z)) - (sqrt(y) + (sqrt(x) + sqrt(z))));
elseif (y <= 5e+19)
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = (1.0 + (x - x)) / (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, 7.7e-25], N[(2.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+19], N[(N[(1.0 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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 7.7 \cdot 10^{-25}:\\
\;\;\;\;2 + \left(\sqrt{1 + z} - \left(\sqrt{y} + \left(\sqrt{x} + \sqrt{z}\right)\right)\right)\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+19}:\\
\;\;\;\;\left(1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 7.7000000000000002e-25Initial program 97.7%
+-commutative97.7%
associate-+r+97.6%
associate-+r-97.7%
associate-+l-97.7%
associate-+r-97.7%
Simplified78.0%
Taylor expanded in t around inf 15.2%
associate--l+19.5%
+-commutative19.5%
+-commutative19.5%
Simplified19.5%
Taylor expanded in x around 0 13.2%
Taylor expanded in y around 0 13.2%
associate--l+32.1%
+-commutative32.1%
associate-+r+32.1%
+-commutative32.1%
Simplified32.1%
if 7.7000000000000002e-25 < y < 5e19Initial program 96.6%
+-commutative96.6%
associate-+r+96.6%
associate-+r-96.7%
associate-+l-96.7%
associate-+r-96.6%
Simplified78.6%
Taylor expanded in t around inf 14.5%
associate--l+18.8%
+-commutative18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in x around 0 14.0%
Taylor expanded in z around inf 17.2%
if 5e19 < y Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-44.6%
associate-+l-24.0%
associate-+r-4.7%
Simplified4.1%
Taylor expanded in t around inf 4.0%
associate--l+23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 22.5%
mul-1-neg22.5%
Simplified22.5%
flip-+22.5%
add-sqr-sqrt22.5%
pow222.5%
Applied egg-rr22.5%
associate--l+24.2%
unpow224.2%
sqr-neg24.2%
rem-square-sqrt26.3%
sub-neg26.3%
remove-double-neg26.3%
Simplified26.3%
Final simplification28.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 3.6e+19) (- (+ 1.0 (sqrt (+ y 1.0))) (+ (sqrt y) (sqrt x))) (/ (+ 1.0 (- x x)) (+ (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 <= 3.6e+19) {
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
} else {
tmp = (1.0 + (x - x)) / (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 <= 3.6d+19) then
tmp = (1.0d0 + sqrt((y + 1.0d0))) - (sqrt(y) + sqrt(x))
else
tmp = (1.0d0 + (x - x)) / (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 <= 3.6e+19) {
tmp = (1.0 + Math.sqrt((y + 1.0))) - (Math.sqrt(y) + Math.sqrt(x));
} else {
tmp = (1.0 + (x - x)) / (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 <= 3.6e+19: tmp = (1.0 + math.sqrt((y + 1.0))) - (math.sqrt(y) + math.sqrt(x)) else: tmp = (1.0 + (x - x)) / (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 <= 3.6e+19) tmp = Float64(Float64(1.0 + sqrt(Float64(y + 1.0))) - Float64(sqrt(y) + sqrt(x))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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 <= 3.6e+19)
tmp = (1.0 + sqrt((y + 1.0))) - (sqrt(y) + sqrt(x));
else
tmp = (1.0 + (x - x)) / (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, 3.6e+19], N[(N[(1.0 + N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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 3.6 \cdot 10^{+19}:\\
\;\;\;\;\left(1 + \sqrt{y + 1}\right) - \left(\sqrt{y} + \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 3.6e19Initial program 97.6%
+-commutative97.6%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified78.1%
Taylor expanded in t around inf 15.1%
associate--l+19.4%
+-commutative19.4%
+-commutative19.4%
Simplified19.4%
Taylor expanded in x around 0 13.2%
Taylor expanded in z around inf 20.8%
if 3.6e19 < y Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-44.6%
associate-+l-24.0%
associate-+r-4.7%
Simplified4.1%
Taylor expanded in t around inf 4.0%
associate--l+23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 22.5%
mul-1-neg22.5%
Simplified22.5%
flip-+22.5%
add-sqr-sqrt22.5%
pow222.5%
Applied egg-rr22.5%
associate--l+24.2%
unpow224.2%
sqr-neg24.2%
rem-square-sqrt26.3%
sub-neg26.3%
remove-double-neg26.3%
Simplified26.3%
Final simplification23.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 3.6e+19) (+ 1.0 (- (sqrt (+ y 1.0)) (+ (sqrt y) (sqrt x)))) (/ (+ 1.0 (- x x)) (+ (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 <= 3.6e+19) {
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (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 <= 3.6d+19) then
tmp = 1.0d0 + (sqrt((y + 1.0d0)) - (sqrt(y) + sqrt(x)))
else
tmp = (1.0d0 + (x - x)) / (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 <= 3.6e+19) {
tmp = 1.0 + (Math.sqrt((y + 1.0)) - (Math.sqrt(y) + Math.sqrt(x)));
} else {
tmp = (1.0 + (x - x)) / (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 <= 3.6e+19: tmp = 1.0 + (math.sqrt((y + 1.0)) - (math.sqrt(y) + math.sqrt(x))) else: tmp = (1.0 + (x - x)) / (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 <= 3.6e+19) tmp = Float64(1.0 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(y) + sqrt(x)))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / 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 <= 3.6e+19)
tmp = 1.0 + (sqrt((y + 1.0)) - (sqrt(y) + sqrt(x)));
else
tmp = (1.0 + (x - x)) / (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, 3.6e+19], N[(1.0 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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 3.6 \cdot 10^{+19}:\\
\;\;\;\;1 + \left(\sqrt{y + 1} - \left(\sqrt{y} + \sqrt{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 3.6e19Initial program 97.6%
+-commutative97.6%
associate-+r+97.5%
associate-+r-97.6%
associate-+l-97.6%
associate-+r-97.6%
Simplified78.1%
Taylor expanded in t around inf 15.1%
associate--l+19.4%
+-commutative19.4%
+-commutative19.4%
Simplified19.4%
Taylor expanded in x around 0 13.2%
Taylor expanded in z around inf 20.8%
associate--l+20.8%
Simplified20.8%
if 3.6e19 < y Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-44.6%
associate-+l-24.0%
associate-+r-4.7%
Simplified4.1%
Taylor expanded in t around inf 4.0%
associate--l+23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 22.5%
mul-1-neg22.5%
Simplified22.5%
flip-+22.5%
add-sqr-sqrt22.5%
pow222.5%
Applied egg-rr22.5%
associate--l+24.2%
unpow224.2%
sqr-neg24.2%
rem-square-sqrt26.3%
sub-neg26.3%
remove-double-neg26.3%
Simplified26.3%
Final simplification23.4%
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 x)) (+ (sqrt (+ 1.0 x)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (1.0 + (x - x)) / (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 = (1.0d0 + (x - x)) / (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 (1.0 + (x - x)) / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (1.0 + (x - x)) / (math.sqrt((1.0 + x)) + math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(1.0 + Float64(x - x)) / 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 = (1.0 + (x - x)) / (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[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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])\\
\\
\frac{1 + \left(x - x\right)}{\sqrt{1 + x} + \sqrt{x}}
\end{array}
Initial program 92.3%
+-commutative92.3%
associate-+r+92.3%
associate-+r-71.9%
associate-+l-61.9%
associate-+r-52.6%
Simplified42.2%
Taylor expanded in t around inf 9.7%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in x around inf 16.4%
mul-1-neg16.4%
Simplified16.4%
flip-+16.4%
add-sqr-sqrt16.6%
pow216.6%
Applied egg-rr16.6%
associate--l+17.8%
unpow217.8%
sqr-neg17.8%
rem-square-sqrt19.1%
sub-neg19.1%
remove-double-neg19.1%
Simplified19.1%
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 60000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 60000000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / 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 <= 60000000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 <= 60000000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 60000000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 60000000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 <= 60000000.0)
tmp = sqrt((1.0 + x)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / 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, 60000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 60000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 6e7Initial program 97.3%
+-commutative97.3%
associate-+r+97.3%
associate-+r-58.4%
associate-+l-55.9%
associate-+r-52.3%
Simplified32.7%
Taylor expanded in t around inf 15.1%
associate--l+35.7%
+-commutative35.7%
+-commutative35.7%
Simplified35.7%
Taylor expanded in x around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
unsub-neg28.3%
Applied egg-rr28.3%
if 6e7 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-86.7%
associate-+l-68.5%
associate-+r-52.9%
Simplified52.7%
Taylor expanded in t around inf 3.7%
associate--l+5.3%
+-commutative5.3%
+-commutative5.3%
Simplified5.3%
Taylor expanded in x around inf 3.4%
mul-1-neg3.4%
Simplified3.4%
Taylor expanded in x around inf 9.1%
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 3.7) (- (+ 1.0 (* x (+ 0.5 (* x (- (* x 0.0625) 0.125))))) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.7) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / 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 <= 3.7d0) then
tmp = (1.0d0 + (x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0))))) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 <= 3.7) {
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 3.7: tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 3.7) tmp = Float64(Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125))))) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 <= 3.7)
tmp = (1.0 + (x * (0.5 + (x * ((x * 0.0625) - 0.125))))) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / 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, 3.7], N[(N[(1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.7:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 3.7000000000000002Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-58.9%
associate-+l-56.3%
associate-+r-52.7%
Simplified32.8%
Taylor expanded in t around inf 14.8%
associate--l+35.6%
+-commutative35.6%
+-commutative35.6%
Simplified35.6%
Taylor expanded in x around inf 28.2%
mul-1-neg28.2%
Simplified28.2%
Taylor expanded in x around 0 28.2%
if 3.7000000000000002 < x Initial program 86.7%
+-commutative86.7%
associate-+r+86.7%
associate-+r-85.6%
associate-+l-67.8%
associate-+r-52.4%
Simplified52.2%
Taylor expanded in t around inf 4.4%
associate--l+6.1%
+-commutative6.1%
+-commutative6.1%
Simplified6.1%
Taylor expanded in x around inf 4.0%
mul-1-neg4.0%
Simplified4.0%
Taylor expanded in x around inf 9.4%
Final simplification19.1%
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.1) (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.1) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / 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.1d0) then
tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / 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.1) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.1: tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.1) tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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.1)
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / 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.1], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / 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.1:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.1000000000000001Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-58.5%
associate-+l-56.0%
associate-+r-52.4%
Simplified32.2%
Taylor expanded in t around inf 14.7%
associate--l+35.7%
+-commutative35.7%
+-commutative35.7%
Simplified35.7%
Taylor expanded in x around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
Taylor expanded in x around 0 28.3%
associate--l+28.3%
Simplified28.3%
if 1.1000000000000001 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.7%
associate-+l-68.0%
associate-+r-52.8%
Simplified52.6%
Taylor expanded in t around inf 4.5%
associate--l+6.2%
+-commutative6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.1%
mul-1-neg4.1%
Simplified4.1%
Taylor expanded in x around inf 9.5%
Final simplification19.1%
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.0) (+ 1.0 (- (* x 0.5) (sqrt x))) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + ((x * 0.5) - sqrt(x));
} else {
tmp = 0.5 * sqrt((1.0 / 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.0d0) then
tmp = 1.0d0 + ((x * 0.5d0) - sqrt(x))
else
tmp = 0.5d0 * sqrt((1.0d0 / 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.0) {
tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = 1.0 + ((x * 0.5) - math.sqrt(x)) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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.0)
tmp = 1.0 + ((x * 0.5) - sqrt(x));
else
tmp = 0.5 * sqrt((1.0 / 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.0], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / 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:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-58.5%
associate-+l-56.0%
associate-+r-52.4%
Simplified32.2%
Taylor expanded in t around inf 14.7%
associate--l+35.7%
+-commutative35.7%
+-commutative35.7%
Simplified35.7%
Taylor expanded in x around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
Taylor expanded in x around 0 28.3%
associate--l+28.3%
Simplified28.3%
if 1 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.7%
associate-+l-68.0%
associate-+r-52.8%
Simplified52.6%
Taylor expanded in t around inf 4.5%
associate--l+6.2%
+-commutative6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.1%
mul-1-neg4.1%
Simplified4.1%
Taylor expanded in x around inf 9.5%
Final simplification19.1%
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 0.049) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.049) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / 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 <= 0.049d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / 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 <= 0.049) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.049: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.049) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / 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 <= 0.049)
tmp = 1.0 - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / 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, 0.049], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.049:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.049000000000000002Initial program 97.7%
+-commutative97.7%
associate-+r+97.7%
associate-+r-58.5%
associate-+l-56.0%
associate-+r-52.4%
Simplified32.2%
Taylor expanded in t around inf 14.7%
associate--l+35.7%
+-commutative35.7%
+-commutative35.7%
Simplified35.7%
Taylor expanded in x around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
Taylor expanded in x around 0 28.3%
if 0.049000000000000002 < x Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-85.7%
associate-+l-68.0%
associate-+r-52.8%
Simplified52.6%
Taylor expanded in t around inf 4.5%
associate--l+6.2%
+-commutative6.2%
+-commutative6.2%
Simplified6.2%
Taylor expanded in x around inf 4.1%
mul-1-neg4.1%
Simplified4.1%
Taylor expanded in x around inf 9.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 x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 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 = 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 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 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[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 92.3%
+-commutative92.3%
associate-+r+92.3%
associate-+r-71.9%
associate-+l-61.9%
associate-+r-52.6%
Simplified42.2%
Taylor expanded in t around inf 9.7%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in x around inf 16.4%
mul-1-neg16.4%
Simplified16.4%
Taylor expanded in x around 0 15.0%
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)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -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)
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);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -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[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 92.3%
+-commutative92.3%
associate-+r+92.3%
associate-+r-71.9%
associate-+l-61.9%
associate-+r-52.6%
Simplified42.2%
Taylor expanded in t around inf 9.7%
associate--l+21.2%
+-commutative21.2%
+-commutative21.2%
Simplified21.2%
Taylor expanded in x around 0 8.5%
Taylor expanded in x around inf 1.6%
neg-mul-11.6%
Simplified1.6%
(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 2024087
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 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))))