
(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 23 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 (+ 1.0 y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (sqrt (+ x 1.0)))
(t_5 (+ (- t_4 (sqrt x)) (- t_1 (sqrt y))))
(t_6 (+ t_3 t_5))
(t_7 (/ 1.0 (+ t_1 (sqrt y)))))
(if (<= t_6 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ t_7 t_3))
(if (<= t_6 2.02)
(- (+ t_4 (+ t_7 (/ 1.0 (+ t_2 (sqrt z))))) (sqrt x))
(+ t_5 (+ t_3 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((x + 1.0));
double t_5 = (t_4 - sqrt(x)) + (t_1 - sqrt(y));
double t_6 = t_3 + t_5;
double t_7 = 1.0 / (t_1 + sqrt(y));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + (t_7 + t_3);
} else if (t_6 <= 2.02) {
tmp = (t_4 + (t_7 + (1.0 / (t_2 + sqrt(z))))) - sqrt(x);
} else {
tmp = t_5 + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((x + 1.0d0))
t_5 = (t_4 - sqrt(x)) + (t_1 - sqrt(y))
t_6 = t_3 + t_5
t_7 = 1.0d0 / (t_1 + sqrt(y))
if (t_6 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_7 + t_3)
else if (t_6 <= 2.02d0) then
tmp = (t_4 + (t_7 + (1.0d0 / (t_2 + sqrt(z))))) - sqrt(x)
else
tmp = t_5 + (t_3 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((x + 1.0));
double t_5 = (t_4 - Math.sqrt(x)) + (t_1 - Math.sqrt(y));
double t_6 = t_3 + t_5;
double t_7 = 1.0 / (t_1 + Math.sqrt(y));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_7 + t_3);
} else if (t_6 <= 2.02) {
tmp = (t_4 + (t_7 + (1.0 / (t_2 + Math.sqrt(z))))) - Math.sqrt(x);
} else {
tmp = t_5 + (t_3 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((x + 1.0)) t_5 = (t_4 - math.sqrt(x)) + (t_1 - math.sqrt(y)) t_6 = t_3 + t_5 t_7 = 1.0 / (t_1 + math.sqrt(y)) tmp = 0 if t_6 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_7 + t_3) elif t_6 <= 2.02: tmp = (t_4 + (t_7 + (1.0 / (t_2 + math.sqrt(z))))) - math.sqrt(x) else: tmp = t_5 + (t_3 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = sqrt(Float64(x + 1.0)) t_5 = Float64(Float64(t_4 - sqrt(x)) + Float64(t_1 - sqrt(y))) t_6 = Float64(t_3 + t_5) t_7 = Float64(1.0 / Float64(t_1 + sqrt(y))) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_7 + t_3)); elseif (t_6 <= 2.02) tmp = Float64(Float64(t_4 + Float64(t_7 + Float64(1.0 / Float64(t_2 + sqrt(z))))) - sqrt(x)); else tmp = Float64(t_5 + Float64(t_3 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((x + 1.0));
t_5 = (t_4 - sqrt(x)) + (t_1 - sqrt(y));
t_6 = t_3 + t_5;
t_7 = 1.0 / (t_1 + sqrt(y));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + (t_7 + t_3);
elseif (t_6 <= 2.02)
tmp = (t_4 + (t_7 + (1.0 / (t_2 + sqrt(z))))) - sqrt(x);
else
tmp = t_5 + (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$3 + t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$7 + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.02], N[(N[(t$95$4 + N[(t$95$7 + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(t$95$5 + N[(t$95$3 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
t_4 := \sqrt{x + 1}\\
t_5 := \left(t\_4 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\\
t_6 := t\_3 + t\_5\\
t_7 := \frac{1}{t\_1 + \sqrt{y}}\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_7 + t\_3\right)\\
\mathbf{elif}\;t\_6 \leq 2.02:\\
\;\;\;\;\left(t\_4 + \left(t\_7 + \frac{1}{t\_2 + \sqrt{z}}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;t\_5 + \left(t\_3 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0Initial program 43.8%
associate-+l+43.8%
associate-+l+43.8%
+-commutative43.8%
+-commutative43.8%
associate-+l-43.8%
+-commutative43.8%
+-commutative43.8%
Simplified43.8%
flip--43.8%
add-sqr-sqrt18.2%
add-sqr-sqrt43.8%
Applied egg-rr43.8%
associate--l+60.3%
+-inverses60.3%
metadata-eval60.3%
Simplified60.3%
Taylor expanded in t around inf 21.0%
Taylor expanded in x around inf 35.7%
if 0.0 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.02000000000000002Initial program 95.4%
associate-+l+95.4%
associate-+l+95.4%
+-commutative95.4%
+-commutative95.4%
associate-+l-79.4%
+-commutative79.4%
+-commutative79.4%
Simplified79.4%
associate--r-95.4%
+-commutative95.4%
flip--95.6%
flip--95.6%
frac-add95.6%
Applied egg-rr96.5%
Simplified97.6%
flip--79.5%
add-sqr-sqrt65.9%
add-sqr-sqrt79.7%
Applied egg-rr98.8%
associate--l+80.1%
+-inverses80.1%
metadata-eval80.1%
Simplified98.9%
Taylor expanded in t around inf 34.0%
if 2.02000000000000002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 99.9%
associate-+l+99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
flip--99.9%
add-sqr-sqrt70.5%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification41.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (sqrt (+ 1.0 t)))
(t_3 (sqrt (+ 1.0 z)))
(t_4 (+ t_3 (sqrt z)))
(t_5 (sqrt (+ 1.0 y)))
(t_6 (+ (- t_1 (sqrt x)) (- t_5 (sqrt y))))
(t_7 (/ 1.0 (+ t_5 (sqrt y)))))
(if (<= t_6 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ t_7 (- t_3 (sqrt z))))
(if (<= t_6 2.0)
(- (+ t_1 (+ t_7 (/ 1.0 t_4))) (sqrt x))
(+ t_6 (/ (+ t_2 (+ (sqrt t) t_4)) (* (+ t_2 (sqrt t)) t_4)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt((1.0 + z));
double t_4 = t_3 + sqrt(z);
double t_5 = sqrt((1.0 + y));
double t_6 = (t_1 - sqrt(x)) + (t_5 - sqrt(y));
double t_7 = 1.0 / (t_5 + sqrt(y));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + (t_7 + (t_3 - sqrt(z)));
} else if (t_6 <= 2.0) {
tmp = (t_1 + (t_7 + (1.0 / t_4))) - sqrt(x);
} else {
tmp = t_6 + ((t_2 + (sqrt(t) + t_4)) / ((t_2 + sqrt(t)) * t_4));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((1.0d0 + z))
t_4 = t_3 + sqrt(z)
t_5 = sqrt((1.0d0 + y))
t_6 = (t_1 - sqrt(x)) + (t_5 - sqrt(y))
t_7 = 1.0d0 / (t_5 + sqrt(y))
if (t_6 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_7 + (t_3 - sqrt(z)))
else if (t_6 <= 2.0d0) then
tmp = (t_1 + (t_7 + (1.0d0 / t_4))) - sqrt(x)
else
tmp = t_6 + ((t_2 + (sqrt(t) + t_4)) / ((t_2 + sqrt(t)) * t_4))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((1.0 + z));
double t_4 = t_3 + Math.sqrt(z);
double t_5 = Math.sqrt((1.0 + y));
double t_6 = (t_1 - Math.sqrt(x)) + (t_5 - Math.sqrt(y));
double t_7 = 1.0 / (t_5 + Math.sqrt(y));
double tmp;
if (t_6 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_7 + (t_3 - Math.sqrt(z)));
} else if (t_6 <= 2.0) {
tmp = (t_1 + (t_7 + (1.0 / t_4))) - Math.sqrt(x);
} else {
tmp = t_6 + ((t_2 + (Math.sqrt(t) + t_4)) / ((t_2 + Math.sqrt(t)) * t_4));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((1.0 + t)) t_3 = math.sqrt((1.0 + z)) t_4 = t_3 + math.sqrt(z) t_5 = math.sqrt((1.0 + y)) t_6 = (t_1 - math.sqrt(x)) + (t_5 - math.sqrt(y)) t_7 = 1.0 / (t_5 + math.sqrt(y)) tmp = 0 if t_6 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_7 + (t_3 - math.sqrt(z))) elif t_6 <= 2.0: tmp = (t_1 + (t_7 + (1.0 / t_4))) - math.sqrt(x) else: tmp = t_6 + ((t_2 + (math.sqrt(t) + t_4)) / ((t_2 + math.sqrt(t)) * t_4)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(1.0 + t)) t_3 = sqrt(Float64(1.0 + z)) t_4 = Float64(t_3 + sqrt(z)) t_5 = sqrt(Float64(1.0 + y)) t_6 = Float64(Float64(t_1 - sqrt(x)) + Float64(t_5 - sqrt(y))) t_7 = Float64(1.0 / Float64(t_5 + sqrt(y))) tmp = 0.0 if (t_6 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_7 + Float64(t_3 - sqrt(z)))); elseif (t_6 <= 2.0) tmp = Float64(Float64(t_1 + Float64(t_7 + Float64(1.0 / t_4))) - sqrt(x)); else tmp = Float64(t_6 + Float64(Float64(t_2 + Float64(sqrt(t) + t_4)) / Float64(Float64(t_2 + sqrt(t)) * t_4))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((1.0 + t));
t_3 = sqrt((1.0 + z));
t_4 = t_3 + sqrt(z);
t_5 = sqrt((1.0 + y));
t_6 = (t_1 - sqrt(x)) + (t_5 - sqrt(y));
t_7 = 1.0 / (t_5 + sqrt(y));
tmp = 0.0;
if (t_6 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + (t_7 + (t_3 - sqrt(z)));
elseif (t_6 <= 2.0)
tmp = (t_1 + (t_7 + (1.0 / t_4))) - sqrt(x);
else
tmp = t_6 + ((t_2 + (sqrt(t) + t_4)) / ((t_2 + sqrt(t)) * t_4));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(1.0 / N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$7 + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 2.0], N[(N[(t$95$1 + N[(t$95$7 + N[(1.0 / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(t$95$6 + N[(N[(t$95$2 + N[(N[Sqrt[t], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$2 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{1 + z}\\
t_4 := t\_3 + \sqrt{z}\\
t_5 := \sqrt{1 + y}\\
t_6 := \left(t\_1 - \sqrt{x}\right) + \left(t\_5 - \sqrt{y}\right)\\
t_7 := \frac{1}{t\_5 + \sqrt{y}}\\
\mathbf{if}\;t\_6 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_7 + \left(t\_3 - \sqrt{z}\right)\right)\\
\mathbf{elif}\;t\_6 \leq 2:\\
\;\;\;\;\left(t\_1 + \left(t\_7 + \frac{1}{t\_4}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;t\_6 + \frac{t\_2 + \left(\sqrt{t} + t\_4\right)}{\left(t\_2 + \sqrt{t}\right) \cdot t\_4}\\
\end{array}
\end{array}
if (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 0.0Initial program 70.9%
associate-+l+70.9%
associate-+l+70.9%
+-commutative70.9%
+-commutative70.9%
associate-+l-48.0%
+-commutative48.0%
+-commutative48.0%
Simplified48.0%
flip--48.0%
add-sqr-sqrt24.3%
add-sqr-sqrt48.0%
Applied egg-rr48.0%
associate--l+56.7%
+-inverses56.7%
metadata-eval56.7%
Simplified56.7%
Taylor expanded in t around inf 40.8%
Taylor expanded in x around inf 48.9%
if 0.0 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) < 2Initial program 96.2%
associate-+l+96.2%
associate-+l+96.2%
+-commutative96.2%
+-commutative96.2%
associate-+l-82.4%
+-commutative82.4%
+-commutative82.4%
Simplified82.4%
associate--r-96.2%
+-commutative96.2%
flip--96.4%
flip--96.4%
frac-add96.4%
Applied egg-rr97.1%
Simplified98.1%
flip--82.5%
add-sqr-sqrt72.5%
add-sqr-sqrt82.8%
Applied egg-rr99.3%
associate--l+82.8%
+-inverses82.8%
metadata-eval82.8%
Simplified99.4%
Taylor expanded in t around inf 41.6%
if 2 < (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) Initial program 89.9%
associate-+l+89.9%
associate-+l+89.9%
+-commutative89.9%
+-commutative89.9%
associate-+l-73.8%
+-commutative73.8%
+-commutative73.8%
Simplified73.8%
associate--r-89.9%
+-commutative89.9%
flip--90.0%
flip--90.0%
frac-add90.0%
Applied egg-rr90.7%
Simplified94.2%
associate-+l-54.4%
associate-+l+54.4%
Applied egg-rr54.4%
associate--r-94.2%
associate-+l+94.2%
+-commutative94.2%
Simplified94.2%
Final simplification43.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (sqrt (+ 1.0 z)))
(t_3 (- t_2 (sqrt z)))
(t_4 (sqrt (+ x 1.0)))
(t_5 (+ t_3 (+ (- t_4 (sqrt x)) (- t_1 (sqrt y)))))
(t_6 (/ 1.0 (+ t_1 (sqrt y)))))
(if (<= t_5 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ t_6 t_3))
(if (<= t_5 2.02)
(- (+ t_4 (+ t_6 (/ 1.0 (+ t_2 (sqrt z))))) (sqrt x))
(+
(+ t_3 (/ 1.0 (+ (sqrt (+ 1.0 t)) (sqrt t))))
(- (+ 1.0 t_1) (+ (sqrt x) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt((1.0 + z));
double t_3 = t_2 - sqrt(z);
double t_4 = sqrt((x + 1.0));
double t_5 = t_3 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)));
double t_6 = 1.0 / (t_1 + sqrt(y));
double tmp;
if (t_5 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + (t_6 + t_3);
} else if (t_5 <= 2.02) {
tmp = (t_4 + (t_6 + (1.0 / (t_2 + sqrt(z))))) - sqrt(x);
} else {
tmp = (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt((1.0d0 + z))
t_3 = t_2 - sqrt(z)
t_4 = sqrt((x + 1.0d0))
t_5 = t_3 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)))
t_6 = 1.0d0 / (t_1 + sqrt(y))
if (t_5 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_6 + t_3)
else if (t_5 <= 2.02d0) then
tmp = (t_4 + (t_6 + (1.0d0 / (t_2 + sqrt(z))))) - sqrt(x)
else
tmp = (t_3 + (1.0d0 / (sqrt((1.0d0 + t)) + sqrt(t)))) + ((1.0d0 + t_1) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt((1.0 + z));
double t_3 = t_2 - Math.sqrt(z);
double t_4 = Math.sqrt((x + 1.0));
double t_5 = t_3 + ((t_4 - Math.sqrt(x)) + (t_1 - Math.sqrt(y)));
double t_6 = 1.0 / (t_1 + Math.sqrt(y));
double tmp;
if (t_5 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_6 + t_3);
} else if (t_5 <= 2.02) {
tmp = (t_4 + (t_6 + (1.0 / (t_2 + Math.sqrt(z))))) - Math.sqrt(x);
} else {
tmp = (t_3 + (1.0 / (Math.sqrt((1.0 + t)) + Math.sqrt(t)))) + ((1.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt((1.0 + z)) t_3 = t_2 - math.sqrt(z) t_4 = math.sqrt((x + 1.0)) t_5 = t_3 + ((t_4 - math.sqrt(x)) + (t_1 - math.sqrt(y))) t_6 = 1.0 / (t_1 + math.sqrt(y)) tmp = 0 if t_5 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_6 + t_3) elif t_5 <= 2.02: tmp = (t_4 + (t_6 + (1.0 / (t_2 + math.sqrt(z))))) - math.sqrt(x) else: tmp = (t_3 + (1.0 / (math.sqrt((1.0 + t)) + math.sqrt(t)))) + ((1.0 + t_1) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = sqrt(Float64(1.0 + z)) t_3 = Float64(t_2 - sqrt(z)) t_4 = sqrt(Float64(x + 1.0)) t_5 = Float64(t_3 + Float64(Float64(t_4 - sqrt(x)) + Float64(t_1 - sqrt(y)))) t_6 = Float64(1.0 / Float64(t_1 + sqrt(y))) tmp = 0.0 if (t_5 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_6 + t_3)); elseif (t_5 <= 2.02) tmp = Float64(Float64(t_4 + Float64(t_6 + Float64(1.0 / Float64(t_2 + sqrt(z))))) - sqrt(x)); else tmp = Float64(Float64(t_3 + Float64(1.0 / Float64(sqrt(Float64(1.0 + t)) + sqrt(t)))) + Float64(Float64(1.0 + t_1) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt((1.0 + z));
t_3 = t_2 - sqrt(z);
t_4 = sqrt((x + 1.0));
t_5 = t_3 + ((t_4 - sqrt(x)) + (t_1 - sqrt(y)));
t_6 = 1.0 / (t_1 + sqrt(y));
tmp = 0.0;
if (t_5 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + (t_6 + t_3);
elseif (t_5 <= 2.02)
tmp = (t_4 + (t_6 + (1.0 / (t_2 + sqrt(z))))) - sqrt(x);
else
tmp = (t_3 + (1.0 / (sqrt((1.0 + t)) + sqrt(t)))) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 + N[(N[(t$95$4 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$6 + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.02], N[(N[(t$95$4 + N[(t$95$6 + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$3 + N[(1.0 / N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{1 + z}\\
t_3 := t\_2 - \sqrt{z}\\
t_4 := \sqrt{x + 1}\\
t_5 := t\_3 + \left(\left(t\_4 - \sqrt{x}\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
t_6 := \frac{1}{t\_1 + \sqrt{y}}\\
\mathbf{if}\;t\_5 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_6 + t\_3\right)\\
\mathbf{elif}\;t\_5 \leq 2.02:\\
\;\;\;\;\left(t\_4 + \left(t\_6 + \frac{1}{t\_2 + \sqrt{z}}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_3 + \frac{1}{\sqrt{1 + t} + \sqrt{t}}\right) + \left(\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 0.0Initial program 43.8%
associate-+l+43.8%
associate-+l+43.8%
+-commutative43.8%
+-commutative43.8%
associate-+l-43.8%
+-commutative43.8%
+-commutative43.8%
Simplified43.8%
flip--43.8%
add-sqr-sqrt18.2%
add-sqr-sqrt43.8%
Applied egg-rr43.8%
associate--l+60.3%
+-inverses60.3%
metadata-eval60.3%
Simplified60.3%
Taylor expanded in t around inf 21.0%
Taylor expanded in x around inf 35.7%
if 0.0 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.02000000000000002Initial program 95.4%
associate-+l+95.4%
associate-+l+95.4%
+-commutative95.4%
+-commutative95.4%
associate-+l-79.4%
+-commutative79.4%
+-commutative79.4%
Simplified79.4%
associate--r-95.4%
+-commutative95.4%
flip--95.6%
flip--95.6%
frac-add95.6%
Applied egg-rr96.5%
Simplified97.6%
flip--79.5%
add-sqr-sqrt65.9%
add-sqr-sqrt79.7%
Applied egg-rr98.8%
associate--l+80.1%
+-inverses80.1%
metadata-eval80.1%
Simplified98.9%
Taylor expanded in t around inf 34.0%
if 2.02000000000000002 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 99.9%
associate-+l+99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 96.4%
flip--99.9%
add-sqr-sqrt70.5%
add-sqr-sqrt99.9%
Applied egg-rr96.4%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
Simplified96.4%
Final simplification41.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 t)) (sqrt t)))
(t_2 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))))
(t_3 (- (sqrt (+ x 1.0)) (sqrt x)))
(t_4 (sqrt (+ 1.0 z)))
(t_5 (+ t_4 (sqrt z))))
(if (<= t_3 0.0)
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ t_2 (- t_4 (sqrt z))))
(+ t_3 (+ t_2 (/ (+ t_1 t_5) (* t_1 t_5)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + t)) + sqrt(t);
double t_2 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double t_3 = sqrt((x + 1.0)) - sqrt(x);
double t_4 = sqrt((1.0 + z));
double t_5 = t_4 + sqrt(z);
double tmp;
if (t_3 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + (t_2 + (t_4 - sqrt(z)));
} else {
tmp = t_3 + (t_2 + ((t_1 + t_5) / (t_1 * t_5)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = sqrt((1.0d0 + t)) + sqrt(t)
t_2 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
t_3 = sqrt((x + 1.0d0)) - sqrt(x)
t_4 = sqrt((1.0d0 + z))
t_5 = t_4 + sqrt(z)
if (t_3 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_2 + (t_4 - sqrt(z)))
else
tmp = t_3 + (t_2 + ((t_1 + t_5) / (t_1 * t_5)))
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 + t)) + Math.sqrt(t);
double t_2 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double t_3 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double t_4 = Math.sqrt((1.0 + z));
double t_5 = t_4 + Math.sqrt(z);
double tmp;
if (t_3 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_2 + (t_4 - Math.sqrt(z)));
} else {
tmp = t_3 + (t_2 + ((t_1 + t_5) / (t_1 * t_5)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + t)) + math.sqrt(t) t_2 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) t_3 = math.sqrt((x + 1.0)) - math.sqrt(x) t_4 = math.sqrt((1.0 + z)) t_5 = t_4 + math.sqrt(z) tmp = 0 if t_3 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_2 + (t_4 - math.sqrt(z))) else: tmp = t_3 + (t_2 + ((t_1 + t_5) / (t_1 * t_5))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + t)) + sqrt(t)) t_2 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) t_3 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) t_4 = sqrt(Float64(1.0 + z)) t_5 = Float64(t_4 + sqrt(z)) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_2 + Float64(t_4 - sqrt(z)))); else tmp = Float64(t_3 + Float64(t_2 + Float64(Float64(t_1 + t_5) / Float64(t_1 * t_5)))); 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 + t)) + sqrt(t);
t_2 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
t_3 = sqrt((x + 1.0)) - sqrt(x);
t_4 = sqrt((1.0 + z));
t_5 = t_4 + sqrt(z);
tmp = 0.0;
if (t_3 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + (t_2 + (t_4 - sqrt(z)));
else
tmp = t_3 + (t_2 + ((t_1 + t_5) / (t_1 * t_5)));
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 + t), $MachinePrecision]], $MachinePrecision] + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(t$95$2 + N[(N[(t$95$1 + t$95$5), $MachinePrecision] / N[(t$95$1 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + t} + \sqrt{t}\\
t_2 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
t_3 := \sqrt{x + 1} - \sqrt{x}\\
t_4 := \sqrt{1 + z}\\
t_5 := t\_4 + \sqrt{z}\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_2 + \left(t\_4 - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_2 + \frac{t\_1 + t\_5}{t\_1 \cdot t\_5}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 82.7%
associate-+l+82.7%
associate-+l+82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l-65.2%
+-commutative65.2%
+-commutative65.2%
Simplified65.2%
flip--65.3%
add-sqr-sqrt53.0%
add-sqr-sqrt65.6%
Applied egg-rr65.6%
associate--l+70.1%
+-inverses70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in t around inf 47.1%
Taylor expanded in x around inf 51.3%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.5%
associate-+l+96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
associate-+l-81.7%
+-commutative81.7%
+-commutative81.7%
Simplified81.7%
associate--r-96.5%
+-commutative96.5%
flip--96.8%
flip--96.8%
frac-add96.8%
Applied egg-rr97.4%
Simplified98.3%
flip--81.8%
add-sqr-sqrt67.3%
add-sqr-sqrt81.9%
Applied egg-rr99.2%
associate--l+82.0%
+-inverses82.0%
metadata-eval82.0%
Simplified99.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 (+ 1.0 y)) (sqrt y)))
(- (sqrt (+ 1.0 z)) (sqrt z))))
(t_2 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t_2 0.0) (+ (* 0.5 (sqrt (/ 1.0 x))) t_1) (+ t_2 t_1))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = (1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (sqrt((1.0 + z)) - sqrt(z));
double t_2 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_2 <= 0.0) {
tmp = (0.5 * sqrt((1.0 / x))) + t_1;
} else {
tmp = t_2 + t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + (sqrt((1.0d0 + z)) - sqrt(z))
t_2 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_2 <= 0.0d0) then
tmp = (0.5d0 * sqrt((1.0d0 / x))) + t_1
else
tmp = t_2 + 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 = (1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + (Math.sqrt((1.0 + z)) - Math.sqrt(z));
double t_2 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_2 <= 0.0) {
tmp = (0.5 * Math.sqrt((1.0 / x))) + t_1;
} else {
tmp = t_2 + t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = (1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + (math.sqrt((1.0 + z)) - math.sqrt(z)) t_2 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_2 <= 0.0: tmp = (0.5 * math.sqrt((1.0 / x))) + t_1 else: tmp = t_2 + t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + Float64(sqrt(Float64(1.0 + z)) - sqrt(z))) t_2 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + t_1); else tmp = Float64(t_2 + 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 = (1.0 / (sqrt((1.0 + y)) + sqrt(y))) + (sqrt((1.0 + z)) - sqrt(z));
t_2 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_2 <= 0.0)
tmp = (0.5 * sqrt((1.0 / x))) + t_1;
else
tmp = t_2 + 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[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$2 + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{\sqrt{1 + y} + \sqrt{y}} + \left(\sqrt{1 + z} - \sqrt{z}\right)\\
t_2 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2 + t\_1\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0Initial program 82.7%
associate-+l+82.7%
associate-+l+82.7%
+-commutative82.7%
+-commutative82.7%
associate-+l-65.2%
+-commutative65.2%
+-commutative65.2%
Simplified65.2%
flip--65.3%
add-sqr-sqrt53.0%
add-sqr-sqrt65.6%
Applied egg-rr65.6%
associate--l+70.1%
+-inverses70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in t around inf 47.1%
Taylor expanded in x around inf 51.3%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 96.5%
associate-+l+96.5%
associate-+l+96.5%
+-commutative96.5%
+-commutative96.5%
associate-+l-81.7%
+-commutative81.7%
+-commutative81.7%
Simplified81.7%
flip--81.8%
add-sqr-sqrt67.3%
add-sqr-sqrt81.9%
Applied egg-rr81.9%
associate--l+82.0%
+-inverses82.0%
metadata-eval82.0%
Simplified82.0%
Taylor expanded in t around inf 57.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (- t_1 (sqrt z)))
(t_3 (sqrt (+ 1.0 y)))
(t_4 (/ 1.0 (+ t_3 (sqrt y)))))
(if (<= x 1.85e-196)
(+
(+ 1.0 (- t_3 (+ (sqrt x) (sqrt y))))
(+ t_2 (- (sqrt (+ 1.0 t)) (sqrt t))))
(if (<= x 75000000.0)
(- (+ (sqrt (+ x 1.0)) (+ t_4 (/ 1.0 (+ t_1 (sqrt z))))) (sqrt x))
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ t_4 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 = t_1 - sqrt(z);
double t_3 = sqrt((1.0 + y));
double t_4 = 1.0 / (t_3 + sqrt(y));
double tmp;
if (x <= 1.85e-196) {
tmp = (1.0 + (t_3 - (sqrt(x) + sqrt(y)))) + (t_2 + (sqrt((1.0 + t)) - sqrt(t)));
} else if (x <= 75000000.0) {
tmp = (sqrt((x + 1.0)) + (t_4 + (1.0 / (t_1 + sqrt(z))))) - sqrt(x);
} else {
tmp = (0.5 * sqrt((1.0 / x))) + (t_4 + 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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = t_1 - sqrt(z)
t_3 = sqrt((1.0d0 + y))
t_4 = 1.0d0 / (t_3 + sqrt(y))
if (x <= 1.85d-196) then
tmp = (1.0d0 + (t_3 - (sqrt(x) + sqrt(y)))) + (t_2 + (sqrt((1.0d0 + t)) - sqrt(t)))
else if (x <= 75000000.0d0) then
tmp = (sqrt((x + 1.0d0)) + (t_4 + (1.0d0 / (t_1 + sqrt(z))))) - sqrt(x)
else
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_4 + 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 = t_1 - Math.sqrt(z);
double t_3 = Math.sqrt((1.0 + y));
double t_4 = 1.0 / (t_3 + Math.sqrt(y));
double tmp;
if (x <= 1.85e-196) {
tmp = (1.0 + (t_3 - (Math.sqrt(x) + Math.sqrt(y)))) + (t_2 + (Math.sqrt((1.0 + t)) - Math.sqrt(t)));
} else if (x <= 75000000.0) {
tmp = (Math.sqrt((x + 1.0)) + (t_4 + (1.0 / (t_1 + Math.sqrt(z))))) - Math.sqrt(x);
} else {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_4 + 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 = t_1 - math.sqrt(z) t_3 = math.sqrt((1.0 + y)) t_4 = 1.0 / (t_3 + math.sqrt(y)) tmp = 0 if x <= 1.85e-196: tmp = (1.0 + (t_3 - (math.sqrt(x) + math.sqrt(y)))) + (t_2 + (math.sqrt((1.0 + t)) - math.sqrt(t))) elif x <= 75000000.0: tmp = (math.sqrt((x + 1.0)) + (t_4 + (1.0 / (t_1 + math.sqrt(z))))) - math.sqrt(x) else: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_4 + 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(t_1 - sqrt(z)) t_3 = sqrt(Float64(1.0 + y)) t_4 = Float64(1.0 / Float64(t_3 + sqrt(y))) tmp = 0.0 if (x <= 1.85e-196) tmp = Float64(Float64(1.0 + Float64(t_3 - Float64(sqrt(x) + sqrt(y)))) + Float64(t_2 + Float64(sqrt(Float64(1.0 + t)) - sqrt(t)))); elseif (x <= 75000000.0) tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(t_4 + Float64(1.0 / Float64(t_1 + sqrt(z))))) - sqrt(x)); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_4 + 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 = t_1 - sqrt(z);
t_3 = sqrt((1.0 + y));
t_4 = 1.0 / (t_3 + sqrt(y));
tmp = 0.0;
if (x <= 1.85e-196)
tmp = (1.0 + (t_3 - (sqrt(x) + sqrt(y)))) + (t_2 + (sqrt((1.0 + t)) - sqrt(t)));
elseif (x <= 75000000.0)
tmp = (sqrt((x + 1.0)) + (t_4 + (1.0 / (t_1 + sqrt(z))))) - sqrt(x);
else
tmp = (0.5 * sqrt((1.0 / x))) + (t_4 + 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[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.85e-196], N[(N[(1.0 + N[(t$95$3 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 75000000.0], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$4 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + 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 := t\_1 - \sqrt{z}\\
t_3 := \sqrt{1 + y}\\
t_4 := \frac{1}{t\_3 + \sqrt{y}}\\
\mathbf{if}\;x \leq 1.85 \cdot 10^{-196}:\\
\;\;\;\;\left(1 + \left(t\_3 - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + \left(t\_2 + \left(\sqrt{1 + t} - \sqrt{t}\right)\right)\\
\mathbf{elif}\;x \leq 75000000:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(t\_4 + \frac{1}{t\_1 + \sqrt{z}}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_4 + t\_2\right)\\
\end{array}
\end{array}
if x < 1.85000000000000005e-196Initial program 97.1%
associate-+l+97.1%
sub-neg97.1%
sub-neg97.1%
+-commutative97.1%
+-commutative97.1%
+-commutative97.1%
Simplified97.1%
Taylor expanded in x around 0 62.7%
associate--l+97.1%
Simplified97.1%
if 1.85000000000000005e-196 < x < 7.5e7Initial program 96.7%
associate-+l+96.7%
associate-+l+96.7%
+-commutative96.7%
+-commutative96.7%
associate-+l-80.0%
+-commutative80.0%
+-commutative80.0%
Simplified80.0%
associate--r-96.7%
+-commutative96.7%
flip--96.9%
flip--96.9%
frac-add96.9%
Applied egg-rr97.6%
Simplified98.7%
flip--80.0%
add-sqr-sqrt66.0%
add-sqr-sqrt80.0%
Applied egg-rr99.5%
associate--l+80.1%
+-inverses80.1%
metadata-eval80.1%
Simplified99.6%
Taylor expanded in t around inf 61.6%
if 7.5e7 < x Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-65.4%
+-commutative65.4%
+-commutative65.4%
Simplified65.4%
flip--65.5%
add-sqr-sqrt52.9%
add-sqr-sqrt65.8%
Applied egg-rr65.8%
associate--l+70.2%
+-inverses70.2%
metadata-eval70.2%
Simplified70.2%
Taylor expanded in t around inf 46.5%
Taylor expanded in x around inf 50.6%
Final simplification62.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))) (t_2 (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y)))))
(if (<= x 72000000.0)
(- (+ (sqrt (+ x 1.0)) (+ t_2 (/ 1.0 (+ t_1 (sqrt z))))) (sqrt x))
(+ (* 0.5 (sqrt (/ 1.0 x))) (+ t_2 (- t_1 (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
double tmp;
if (x <= 72000000.0) {
tmp = (sqrt((x + 1.0)) + (t_2 + (1.0 / (t_1 + sqrt(z))))) - sqrt(x);
} else {
tmp = (0.5 * sqrt((1.0 / x))) + (t_2 + (t_1 - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = 1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))
if (x <= 72000000.0d0) then
tmp = (sqrt((x + 1.0d0)) + (t_2 + (1.0d0 / (t_1 + sqrt(z))))) - sqrt(x)
else
tmp = (0.5d0 * sqrt((1.0d0 / x))) + (t_2 + (t_1 - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + z));
double t_2 = 1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y));
double tmp;
if (x <= 72000000.0) {
tmp = (Math.sqrt((x + 1.0)) + (t_2 + (1.0 / (t_1 + Math.sqrt(z))))) - Math.sqrt(x);
} else {
tmp = (0.5 * Math.sqrt((1.0 / x))) + (t_2 + (t_1 - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = 1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y)) tmp = 0 if x <= 72000000.0: tmp = (math.sqrt((x + 1.0)) + (t_2 + (1.0 / (t_1 + math.sqrt(z))))) - math.sqrt(x) else: tmp = (0.5 * math.sqrt((1.0 / x))) + (t_2 + (t_1 - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) tmp = 0.0 if (x <= 72000000.0) tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(t_2 + Float64(1.0 / Float64(t_1 + sqrt(z))))) - sqrt(x)); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / x))) + Float64(t_2 + Float64(t_1 - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + z));
t_2 = 1.0 / (sqrt((1.0 + y)) + sqrt(y));
tmp = 0.0;
if (x <= 72000000.0)
tmp = (sqrt((x + 1.0)) + (t_2 + (1.0 / (t_1 + sqrt(z))))) - sqrt(x);
else
tmp = (0.5 * sqrt((1.0 / x))) + (t_2 + (t_1 - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 72000000.0], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$2 + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
t_2 := \frac{1}{\sqrt{1 + y} + \sqrt{y}}\\
\mathbf{if}\;x \leq 72000000:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(t\_2 + \frac{1}{t\_1 + \sqrt{z}}\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}} + \left(t\_2 + \left(t\_1 - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if x < 7.2e7Initial program 96.8%
associate-+l+96.8%
associate-+l+96.8%
+-commutative96.8%
+-commutative96.8%
associate-+l-81.8%
+-commutative81.8%
+-commutative81.8%
Simplified81.8%
associate--r-96.8%
+-commutative96.8%
flip--97.1%
flip--97.1%
frac-add97.1%
Applied egg-rr97.7%
Simplified98.7%
flip--81.9%
add-sqr-sqrt67.7%
add-sqr-sqrt82.0%
Applied egg-rr99.6%
associate--l+82.1%
+-inverses82.1%
metadata-eval82.1%
Simplified99.7%
Taylor expanded in t around inf 59.2%
if 7.2e7 < x Initial program 82.6%
associate-+l+82.6%
associate-+l+82.6%
+-commutative82.6%
+-commutative82.6%
associate-+l-65.4%
+-commutative65.4%
+-commutative65.4%
Simplified65.4%
flip--65.5%
add-sqr-sqrt52.9%
add-sqr-sqrt65.8%
Applied egg-rr65.8%
associate--l+70.2%
+-inverses70.2%
metadata-eval70.2%
Simplified70.2%
Taylor expanded in t around inf 46.5%
Taylor expanded in x around inf 50.6%
Final simplification55.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y)))
(t_2 (+ (sqrt x) (sqrt y)))
(t_3 (sqrt (+ 1.0 z))))
(if (<= z 4.7e-29)
(+ (+ (- t_3 (sqrt z)) (- (sqrt (+ 1.0 t)) (sqrt t))) (- 2.0 t_2))
(if (<= z 7.4e+30)
(- (+ (/ 1.0 (+ t_3 (sqrt z))) (+ 1.0 t_1)) t_2)
(- (+ (/ 1.0 (+ t_1 (sqrt y))) (sqrt (+ x 1.0))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double t_2 = sqrt(x) + sqrt(y);
double t_3 = sqrt((1.0 + z));
double tmp;
if (z <= 4.7e-29) {
tmp = ((t_3 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_2);
} else if (z <= 7.4e+30) {
tmp = ((1.0 / (t_3 + sqrt(z))) + (1.0 + t_1)) - t_2;
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
t_2 = sqrt(x) + sqrt(y)
t_3 = sqrt((1.0d0 + z))
if (z <= 4.7d-29) then
tmp = ((t_3 - sqrt(z)) + (sqrt((1.0d0 + t)) - sqrt(t))) + (2.0d0 - t_2)
else if (z <= 7.4d+30) then
tmp = ((1.0d0 / (t_3 + sqrt(z))) + (1.0d0 + t_1)) - t_2
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double t_2 = Math.sqrt(x) + Math.sqrt(y);
double t_3 = Math.sqrt((1.0 + z));
double tmp;
if (z <= 4.7e-29) {
tmp = ((t_3 - Math.sqrt(z)) + (Math.sqrt((1.0 + t)) - Math.sqrt(t))) + (2.0 - t_2);
} else if (z <= 7.4e+30) {
tmp = ((1.0 / (t_3 + Math.sqrt(z))) + (1.0 + t_1)) - t_2;
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) t_2 = math.sqrt(x) + math.sqrt(y) t_3 = math.sqrt((1.0 + z)) tmp = 0 if z <= 4.7e-29: tmp = ((t_3 - math.sqrt(z)) + (math.sqrt((1.0 + t)) - math.sqrt(t))) + (2.0 - t_2) elif z <= 7.4e+30: tmp = ((1.0 / (t_3 + math.sqrt(z))) + (1.0 + t_1)) - t_2 else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) t_2 = Float64(sqrt(x) + sqrt(y)) t_3 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (z <= 4.7e-29) tmp = Float64(Float64(Float64(t_3 - sqrt(z)) + Float64(sqrt(Float64(1.0 + t)) - sqrt(t))) + Float64(2.0 - t_2)); elseif (z <= 7.4e+30) tmp = Float64(Float64(Float64(1.0 / Float64(t_3 + sqrt(z))) + Float64(1.0 + t_1)) - t_2); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
t_2 = sqrt(x) + sqrt(y);
t_3 = sqrt((1.0 + z));
tmp = 0.0;
if (z <= 4.7e-29)
tmp = ((t_3 - sqrt(z)) + (sqrt((1.0 + t)) - sqrt(t))) + (2.0 - t_2);
elseif (z <= 7.4e+30)
tmp = ((1.0 / (t_3 + sqrt(z))) + (1.0 + t_1)) - t_2;
else
tmp = ((1.0 / (t_1 + sqrt(y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4.7e-29], N[(N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 - t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.4e+30], N[(N[(N[(1.0 / N[(t$95$3 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
t_2 := \sqrt{x} + \sqrt{y}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;z \leq 4.7 \cdot 10^{-29}:\\
\;\;\;\;\left(\left(t\_3 - \sqrt{z}\right) + \left(\sqrt{1 + t} - \sqrt{t}\right)\right) + \left(2 - t\_2\right)\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+30}:\\
\;\;\;\;\left(\frac{1}{t\_3 + \sqrt{z}} + \left(1 + t\_1\right)\right) - t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 4.6999999999999998e-29Initial program 96.4%
associate-+l+96.4%
sub-neg96.4%
sub-neg96.4%
+-commutative96.4%
+-commutative96.4%
+-commutative96.4%
Simplified96.4%
Taylor expanded in x around 0 49.6%
Taylor expanded in y around 0 24.5%
if 4.6999999999999998e-29 < z < 7.40000000000000032e30Initial program 84.9%
associate-+l+84.9%
associate-+l+84.9%
+-commutative84.9%
+-commutative84.9%
associate-+l-60.3%
+-commutative60.3%
+-commutative60.3%
Simplified60.3%
associate--r-84.9%
+-commutative84.9%
flip--86.6%
flip--86.6%
frac-add86.5%
Applied egg-rr90.6%
Simplified97.6%
Taylor expanded in t around inf 22.7%
Taylor expanded in x around 0 16.4%
associate-+r+16.4%
Simplified16.4%
if 7.40000000000000032e30 < z Initial program 85.1%
associate-+l+85.1%
associate-+l+85.1%
+-commutative85.1%
+-commutative85.1%
associate-+l-85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
flip--85.1%
add-sqr-sqrt72.2%
add-sqr-sqrt85.5%
Applied egg-rr85.5%
associate--l+89.4%
+-inverses89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in t around inf 49.5%
Taylor expanded in z around inf 32.1%
Final simplification27.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z))))
(if (<= y 50000000.0)
(-
(+ (/ 1.0 (+ t_1 (sqrt z))) (+ 1.0 (sqrt (+ 1.0 y))))
(+ (sqrt x) (sqrt y)))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- t_1 (sqrt z)) (* 0.5 (sqrt (/ 1.0 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 (y <= 50000000.0) {
tmp = ((1.0 / (t_1 + sqrt(z))) + (1.0 + sqrt((1.0 + y)))) - (sqrt(x) + sqrt(y));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (0.5 * sqrt((1.0 / 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 (y <= 50000000.0d0) then
tmp = ((1.0d0 / (t_1 + sqrt(z))) + (1.0d0 + sqrt((1.0d0 + y)))) - (sqrt(x) + sqrt(y))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (0.5d0 * sqrt((1.0d0 / 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 (y <= 50000000.0) {
tmp = ((1.0 / (t_1 + Math.sqrt(z))) + (1.0 + Math.sqrt((1.0 + y)))) - (Math.sqrt(x) + Math.sqrt(y));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((t_1 - Math.sqrt(z)) + (0.5 * Math.sqrt((1.0 / 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 y <= 50000000.0: tmp = ((1.0 / (t_1 + math.sqrt(z))) + (1.0 + math.sqrt((1.0 + y)))) - (math.sqrt(x) + math.sqrt(y)) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((t_1 - math.sqrt(z)) + (0.5 * math.sqrt((1.0 / 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 (y <= 50000000.0) tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(1.0 + sqrt(Float64(1.0 + y)))) - Float64(sqrt(x) + sqrt(y))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(t_1 - sqrt(z)) + Float64(0.5 * sqrt(Float64(1.0 / 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 (y <= 50000000.0)
tmp = ((1.0 / (t_1 + sqrt(z))) + (1.0 + sqrt((1.0 + y)))) - (sqrt(x) + sqrt(y));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((t_1 - sqrt(z)) + (0.5 * sqrt((1.0 / 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[y, 50000000.0], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 50000000:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{z}} + \left(1 + \sqrt{1 + y}\right)\right) - \left(\sqrt{x} + \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(t\_1 - \sqrt{z}\right) + 0.5 \cdot \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if y < 5e7Initial program 97.7%
associate-+l+97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
associate-+l-84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
associate--r-97.7%
+-commutative97.7%
flip--97.7%
flip--97.7%
frac-add97.7%
Applied egg-rr98.4%
Simplified99.3%
Taylor expanded in t around inf 35.1%
Taylor expanded in x around 0 31.6%
associate-+r+31.6%
Simplified31.6%
if 5e7 < y Initial program 83.0%
associate-+l+83.0%
associate-+l+83.0%
+-commutative83.0%
+-commutative83.0%
associate-+l-64.5%
+-commutative64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in y around inf 68.9%
Taylor expanded in t around inf 47.9%
Final simplification40.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 (<= y 50000000.0)
(+ t_1 (- (+ 1.0 (sqrt (+ 1.0 y))) (+ (sqrt x) (sqrt y))))
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (+ t_1 (* 0.5 (sqrt (/ 1.0 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 (y <= 50000000.0) {
tmp = t_1 + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (t_1 + (0.5 * sqrt((1.0 / 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 (y <= 50000000.0d0) then
tmp = t_1 + ((1.0d0 + sqrt((1.0d0 + y))) - (sqrt(x) + sqrt(y)))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + (t_1 + (0.5d0 * sqrt((1.0d0 / 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 (y <= 50000000.0) {
tmp = t_1 + ((1.0 + Math.sqrt((1.0 + y))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (t_1 + (0.5 * Math.sqrt((1.0 / 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 y <= 50000000.0: tmp = t_1 + ((1.0 + math.sqrt((1.0 + y))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + (t_1 + (0.5 * math.sqrt((1.0 / 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 (y <= 50000000.0) tmp = Float64(t_1 + Float64(Float64(1.0 + sqrt(Float64(1.0 + y))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / 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 (y <= 50000000.0)
tmp = t_1 + ((1.0 + sqrt((1.0 + y))) - (sqrt(x) + sqrt(y)));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (t_1 + (0.5 * sqrt((1.0 / 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[y, 50000000.0], N[(t$95$1 + N[(N[(1.0 + N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z} - \sqrt{z}\\
\mathbf{if}\;y \leq 50000000:\\
\;\;\;\;t\_1 + \left(\left(1 + \sqrt{1 + y}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{y}}\right)\\
\end{array}
\end{array}
if y < 5e7Initial program 97.7%
associate-+l+97.7%
sub-neg97.7%
sub-neg97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 50.8%
Taylor expanded in t around inf 31.1%
if 5e7 < y Initial program 83.0%
associate-+l+83.0%
associate-+l+83.0%
+-commutative83.0%
+-commutative83.0%
associate-+l-64.5%
+-commutative64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in y around inf 68.9%
Taylor expanded in t around inf 47.9%
Final simplification40.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= y 5400.0)
(+ (- (sqrt (+ 1.0 z)) (sqrt z)) (- (+ 1.0 t_1) (+ (sqrt x) (sqrt y))))
(- (+ (/ 1.0 (+ t_1 (sqrt y))) (sqrt (+ x 1.0))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (y <= 5400.0) {
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (y <= 5400.0d0) then
tmp = (sqrt((1.0d0 + z)) - sqrt(z)) + ((1.0d0 + t_1) - (sqrt(x) + sqrt(y)))
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (y <= 5400.0) {
tmp = (Math.sqrt((1.0 + z)) - Math.sqrt(z)) + ((1.0 + t_1) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if y <= 5400.0: tmp = (math.sqrt((1.0 + z)) - math.sqrt(z)) + ((1.0 + t_1) - (math.sqrt(x) + math.sqrt(y))) else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (y <= 5400.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) - sqrt(z)) + Float64(Float64(1.0 + t_1) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (y <= 5400.0)
tmp = (sqrt((1.0 + z)) - sqrt(z)) + ((1.0 + t_1) - (sqrt(x) + sqrt(y)));
else
tmp = ((1.0 / (t_1 + sqrt(y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 5400.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;y \leq 5400:\\
\;\;\;\;\left(\sqrt{1 + z} - \sqrt{z}\right) + \left(\left(1 + t\_1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 5400Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 51.3%
Taylor expanded in t around inf 31.7%
if 5400 < y Initial program 83.1%
associate-+l+83.1%
associate-+l+83.1%
+-commutative83.1%
+-commutative83.1%
associate-+l-65.1%
+-commutative65.1%
+-commutative65.1%
Simplified65.1%
flip--65.1%
add-sqr-sqrt40.5%
add-sqr-sqrt65.5%
Applied egg-rr65.5%
associate--l+69.6%
+-inverses69.6%
metadata-eval69.6%
Simplified69.6%
Taylor expanded in t around inf 47.2%
Taylor expanded in z around inf 20.0%
Final simplification25.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 y))))
(if (<= z 4.8e+15)
(+ 1.0 (+ t_1 (- (sqrt (+ 1.0 z)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))))
(- (+ (/ 1.0 (+ t_1 (sqrt y))) (sqrt (+ x 1.0))) (sqrt x)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y));
double tmp;
if (z <= 4.8e+15) {
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
} else {
tmp = ((1.0 / (t_1 + sqrt(y))) + sqrt((x + 1.0))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 4.8d+15) then
tmp = 1.0d0 + (t_1 + (sqrt((1.0d0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))))
else
tmp = ((1.0d0 / (t_1 + sqrt(y))) + sqrt((x + 1.0d0))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 4.8e+15) {
tmp = 1.0 + (t_1 + (Math.sqrt((1.0 + z)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)))));
} else {
tmp = ((1.0 / (t_1 + Math.sqrt(y))) + Math.sqrt((x + 1.0))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) tmp = 0 if z <= 4.8e+15: tmp = 1.0 + (t_1 + (math.sqrt((1.0 + z)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))))) else: tmp = ((1.0 / (t_1 + math.sqrt(y))) + math.sqrt((x + 1.0))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 4.8e+15) tmp = Float64(1.0 + Float64(t_1 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))))); else tmp = Float64(Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + sqrt(Float64(x + 1.0))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 4.8e+15)
tmp = 1.0 + (t_1 + (sqrt((1.0 + z)) - (sqrt(x) + (sqrt(y) + sqrt(z)))));
else
tmp = ((1.0 / (t_1 + sqrt(y))) + sqrt((x + 1.0))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4.8e+15], N[(1.0 + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 4.8 \cdot 10^{+15}:\\
\;\;\;\;1 + \left(t\_1 + \left(\sqrt{1 + z} - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{t\_1 + \sqrt{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\end{array}
\end{array}
if z < 4.8e15Initial program 95.4%
associate-+l+95.4%
sub-neg95.4%
sub-neg95.4%
+-commutative95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 21.0%
associate--l+25.3%
Simplified25.3%
Taylor expanded in x around 0 18.2%
associate--l+28.7%
associate-+r-28.7%
+-commutative28.7%
Simplified28.7%
if 4.8e15 < z Initial program 84.8%
associate-+l+84.8%
associate-+l+84.8%
+-commutative84.8%
+-commutative84.8%
associate-+l-84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
flip--84.8%
add-sqr-sqrt70.9%
add-sqr-sqrt85.2%
Applied egg-rr85.2%
associate--l+88.9%
+-inverses88.9%
metadata-eval88.9%
Simplified88.9%
Taylor expanded in t around inf 48.3%
Taylor expanded in z around inf 31.9%
Final simplification30.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 (<= x 2.4e+21) (- (+ (/ 1.0 (+ (sqrt (+ 1.0 y)) (sqrt y))) (sqrt (+ x 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 <= 2.4e+21) {
tmp = ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + sqrt((x + 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 <= 2.4d+21) then
tmp = ((1.0d0 / (sqrt((1.0d0 + y)) + sqrt(y))) + sqrt((x + 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 <= 2.4e+21) {
tmp = ((1.0 / (Math.sqrt((1.0 + y)) + Math.sqrt(y))) + Math.sqrt((x + 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 <= 2.4e+21: tmp = ((1.0 / (math.sqrt((1.0 + y)) + math.sqrt(y))) + math.sqrt((x + 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 <= 2.4e+21) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + y)) + sqrt(y))) + sqrt(Float64(x + 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 <= 2.4e+21)
tmp = ((1.0 / (sqrt((1.0 + y)) + sqrt(y))) + sqrt((x + 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, 2.4e+21], N[(N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(x + 1.0), $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 2.4 \cdot 10^{+21}:\\
\;\;\;\;\left(\frac{1}{\sqrt{1 + y} + \sqrt{y}} + \sqrt{x + 1}\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 2.4e21Initial program 95.6%
associate-+l+95.6%
associate-+l+95.6%
+-commutative95.6%
+-commutative95.6%
associate-+l-80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
flip--80.4%
add-sqr-sqrt65.9%
add-sqr-sqrt80.5%
Applied egg-rr80.5%
associate--l+80.7%
+-inverses80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in t around inf 56.9%
Taylor expanded in z around inf 39.1%
if 2.4e21 < x Initial program 83.3%
associate-+l+83.3%
sub-neg83.3%
sub-neg83.3%
+-commutative83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 3.3%
associate--l+4.8%
Simplified4.8%
Taylor expanded in x around inf 3.2%
mul-1-neg3.2%
Simplified3.2%
Taylor expanded in x around inf 9.7%
Final simplification25.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 5.8e+22) (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))) (* 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 <= 5.8e+22) {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} 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 <= 5.8d+22) then
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
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 <= 5.8e+22) {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} 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 <= 5.8e+22: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) 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 <= 5.8e+22) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); 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 <= 5.8e+22)
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
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, 5.8e+22], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $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 5.8 \cdot 10^{+22}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 5.8e22Initial program 95.6%
associate-+l+95.6%
sub-neg95.6%
sub-neg95.6%
+-commutative95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in t around inf 19.9%
associate--l+39.4%
Simplified39.4%
Taylor expanded in z around inf 23.8%
associate--l+39.3%
Simplified39.3%
if 5.8e22 < x Initial program 83.3%
associate-+l+83.3%
sub-neg83.3%
sub-neg83.3%
+-commutative83.3%
+-commutative83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 3.3%
associate--l+4.8%
Simplified4.8%
Taylor expanded in x around inf 3.2%
mul-1-neg3.2%
Simplified3.2%
Taylor expanded in x around inf 9.7%
Final simplification25.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 0.45)
(+ 2.0 (- (* 0.5 (+ y (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y))))
(+
(* 0.5 (sqrt (/ 1.0 y)))
(+ 1.0 (- (* x (+ 0.5 (* x (fma 0.0625 x -0.125)))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.45) {
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = (0.5 * sqrt((1.0 / y))) + (1.0 + ((x * (0.5 + (x * fma(0.0625, x, -0.125)))) - sqrt(x)));
}
return tmp;
}
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 0.45) tmp = Float64(2.0 + Float64(Float64(0.5 * Float64(y + sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * fma(0.0625, x, -0.125)))) - sqrt(x)))); end return 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, 0.45], N[(2.0 + N[(N[(0.5 * N[(y + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * N[(0.5 + N[(x * N[(0.0625 * x + -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.45:\\
\;\;\;\;2 + \left(0.5 \cdot \left(y + \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{y}} + \left(1 + \left(x \cdot \left(0.5 + x \cdot \mathsf{fma}\left(0.0625, x, -0.125\right)\right) - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if y < 0.450000000000000011Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 18.7%
associate--l+22.9%
Simplified22.9%
Taylor expanded in z around inf 23.8%
Taylor expanded in y around 0 23.8%
*-commutative23.8%
Simplified23.8%
Taylor expanded in x around 0 21.3%
associate--l+21.3%
distribute-lft-out21.3%
Simplified21.3%
if 0.450000000000000011 < y Initial program 83.1%
associate-+l+83.1%
associate-+l+83.1%
+-commutative83.1%
+-commutative83.1%
associate-+l-65.1%
+-commutative65.1%
+-commutative65.1%
Simplified65.1%
Taylor expanded in y around inf 68.7%
Taylor expanded in x around 0 41.1%
associate--l+41.1%
fma-neg41.1%
metadata-eval41.1%
Simplified41.1%
Taylor expanded in y around 0 20.1%
Final simplification20.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 0.7) (+ 2.0 (- (* 0.5 (+ y (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y)))) (+ 1.0 (- (* x (+ 0.5 (* x (- (* x 0.0625) 0.125)))) (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 0.7) {
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 + ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) - 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 <= 0.7d0) then
tmp = 2.0d0 + ((0.5d0 * (y + sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 + ((x * (0.5d0 + (x * ((x * 0.0625d0) - 0.125d0)))) - 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 <= 0.7) {
tmp = 2.0 + ((0.5 * (y + Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 + ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 0.7: tmp = 2.0 + ((0.5 * (y + math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 + ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) - 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 <= 0.7) tmp = Float64(2.0 + Float64(Float64(0.5 * Float64(y + sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.0625) - 0.125)))) - 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 <= 0.7)
tmp = 2.0 + ((0.5 * (y + sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 + ((x * (0.5 + (x * ((x * 0.0625) - 0.125)))) - 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, 0.7], N[(2.0 + N[(N[(0.5 * N[(y + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $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 0.7:\\
\;\;\;\;2 + \left(0.5 \cdot \left(y + \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 0.69999999999999996Initial program 97.9%
associate-+l+97.9%
sub-neg97.9%
sub-neg97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 18.7%
associate--l+22.9%
Simplified22.9%
Taylor expanded in z around inf 23.8%
Taylor expanded in y around 0 23.8%
*-commutative23.8%
Simplified23.8%
Taylor expanded in x around 0 21.3%
associate--l+21.3%
distribute-lft-out21.3%
Simplified21.3%
if 0.69999999999999996 < y Initial program 83.1%
associate-+l+83.1%
sub-neg83.1%
sub-neg83.1%
+-commutative83.1%
+-commutative83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in t around inf 6.7%
associate--l+23.7%
Simplified23.7%
Taylor expanded in x around inf 20.0%
mul-1-neg20.0%
Simplified20.0%
Taylor expanded in x around 0 20.1%
associate--l+20.1%
fma-neg20.1%
metadata-eval20.1%
Simplified20.1%
Taylor expanded in x around 0 20.1%
Final simplification20.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 (<= x 1.3) (+ 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 <= 1.3) {
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 <= 1.3d0) 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 <= 1.3) {
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 <= 1.3: 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 <= 1.3) tmp = Float64(1.0 + Float64(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 <= 1.3)
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, 1.3], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * N[(N[(x * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $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.3:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot \left(x \cdot 0.0625 - 0.125\right)\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.30000000000000004Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 19.8%
associate--l+40.2%
Simplified40.2%
Taylor expanded in x around inf 28.2%
mul-1-neg28.2%
Simplified28.2%
Taylor expanded in x around 0 28.2%
associate--l+28.2%
fma-neg28.2%
metadata-eval28.2%
Simplified28.2%
Taylor expanded in x around 0 28.2%
if 1.30000000000000004 < x Initial program 82.9%
associate-+l+82.9%
sub-neg82.9%
sub-neg82.9%
+-commutative82.9%
+-commutative82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 4.6%
associate--l+6.4%
Simplified6.4%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 9.9%
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(Float64(1.0 + 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[(N[(1.0 + N[(x * N[(0.5 + N[(x * -0.125), $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 1.1:\\
\;\;\;\;\left(1 + x \cdot \left(0.5 + x \cdot -0.125\right)\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1.1000000000000001Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 19.8%
associate--l+40.2%
Simplified40.2%
Taylor expanded in x around inf 28.2%
mul-1-neg28.2%
Simplified28.2%
Taylor expanded in x around 0 28.2%
*-commutative28.2%
Simplified28.2%
if 1.1000000000000001 < x Initial program 82.9%
associate-+l+82.9%
sub-neg82.9%
sub-neg82.9%
+-commutative82.9%
+-commutative82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 4.6%
associate--l+6.4%
Simplified6.4%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 9.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 (<= x 0.92) (- (+ 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 <= 0.92) {
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 <= 0.92d0) 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 <= 0.92) {
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 <= 0.92: 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 <= 0.92) tmp = Float64(Float64(1.0 + 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 <= 0.92)
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, 0.92], N[(N[(1.0 + N[(x * 0.5), $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 0.92:\\
\;\;\;\;\left(1 + x \cdot 0.5\right) - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.92000000000000004Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 19.8%
associate--l+40.2%
Simplified40.2%
Taylor expanded in x around inf 28.2%
mul-1-neg28.2%
Simplified28.2%
Taylor expanded in x around 0 28.2%
if 0.92000000000000004 < x Initial program 82.9%
associate-+l+82.9%
sub-neg82.9%
sub-neg82.9%
+-commutative82.9%
+-commutative82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 4.6%
associate--l+6.4%
Simplified6.4%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 9.9%
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 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 19.8%
associate--l+40.2%
Simplified40.2%
Taylor expanded in x around inf 28.2%
mul-1-neg28.2%
Simplified28.2%
Taylor expanded in x around 0 28.2%
associate--l+28.2%
*-commutative28.2%
Simplified28.2%
if 1 < x Initial program 82.9%
associate-+l+82.9%
sub-neg82.9%
sub-neg82.9%
+-commutative82.9%
+-commutative82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in t around inf 4.6%
associate--l+6.4%
Simplified6.4%
Taylor expanded in x around inf 3.6%
mul-1-neg3.6%
Simplified3.6%
Taylor expanded in x around inf 9.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 (<= x 0.28) (- 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.28) {
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.28d0) 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.28) {
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.28: 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.28) 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.28)
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.28], 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.28:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.28000000000000003Initial program 96.9%
associate-+l+96.9%
sub-neg96.9%
sub-neg96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 19.2%
associate--l+39.7%
Simplified39.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.28000000000000003 < x Initial program 83.0%
associate-+l+83.0%
sub-neg83.0%
sub-neg83.0%
+-commutative83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
Taylor expanded in t around inf 5.3%
associate--l+7.2%
Simplified7.2%
Taylor expanded in x around inf 3.7%
mul-1-neg3.7%
Simplified3.7%
Taylor expanded in x around inf 10.0%
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 89.9%
associate-+l+89.9%
sub-neg89.9%
sub-neg89.9%
+-commutative89.9%
+-commutative89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in t around inf 12.2%
associate--l+23.3%
Simplified23.3%
Taylor expanded in x around inf 15.9%
mul-1-neg15.9%
Simplified15.9%
Taylor expanded in x around 0 14.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt 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 89.9%
associate-+l+89.9%
sub-neg89.9%
sub-neg89.9%
+-commutative89.9%
+-commutative89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in t around inf 12.2%
associate--l+23.3%
Simplified23.3%
Taylor expanded in x around inf 15.9%
mul-1-neg15.9%
Simplified15.9%
Taylor expanded in x around 0 14.8%
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 2024146
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (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))))