
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ 1.0 z)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (- t_2 (sqrt x)))
(t_4 (sqrt (+ 1.0 y)))
(t_5 (+ (+ t_3 (- t_4 (sqrt y))) (- t_1 (sqrt z)))))
(if (<= t_5 0.02)
(+
(/ 1.0 (+ (sqrt x) t_2))
(+
(* 0.5 (sqrt (/ 1.0 y)))
(- (+ (* 0.5 (sqrt (/ 1.0 t))) t_1) (sqrt z))))
(if (<= t_5 2.8)
(+
t_3
(+
(/ 1.0 (+ (sqrt y) t_4))
(/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) t_1)))) t)))
(+
t_4
(-
(+ t_1 (- t_3 (sqrt z)))
(+ (sqrt y) (/ -1.0 (+ (sqrt t) (sqrt (+ 1.0 t)))))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + z));
double t_2 = sqrt((x + 1.0));
double t_3 = t_2 - sqrt(x);
double t_4 = sqrt((1.0 + y));
double t_5 = (t_3 + (t_4 - sqrt(y))) + (t_1 - sqrt(z));
double tmp;
if (t_5 <= 0.02) {
tmp = (1.0 / (sqrt(x) + t_2)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_1) - sqrt(z)));
} else if (t_5 <= 2.8) {
tmp = t_3 + ((1.0 / (sqrt(y) + t_4)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t));
} else {
tmp = t_4 + ((t_1 + (t_3 - sqrt(z))) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + 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) :: tmp
t_1 = sqrt((1.0d0 + z))
t_2 = sqrt((x + 1.0d0))
t_3 = t_2 - sqrt(x)
t_4 = sqrt((1.0d0 + y))
t_5 = (t_3 + (t_4 - sqrt(y))) + (t_1 - sqrt(z))
if (t_5 <= 0.02d0) then
tmp = (1.0d0 / (sqrt(x) + t_2)) + ((0.5d0 * sqrt((1.0d0 / y))) + (((0.5d0 * sqrt((1.0d0 / t))) + t_1) - sqrt(z)))
else if (t_5 <= 2.8d0) then
tmp = t_3 + ((1.0d0 / (sqrt(y) + t_4)) + (((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + t_1)))) / t))
else
tmp = t_4 + ((t_1 + (t_3 - sqrt(z))) - (sqrt(y) + ((-1.0d0) / (sqrt(t) + sqrt((1.0d0 + 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 + z));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = Math.sqrt((1.0 + y));
double t_5 = (t_3 + (t_4 - Math.sqrt(y))) + (t_1 - Math.sqrt(z));
double tmp;
if (t_5 <= 0.02) {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + ((0.5 * Math.sqrt((1.0 / y))) + (((0.5 * Math.sqrt((1.0 / t))) + t_1) - Math.sqrt(z)));
} else if (t_5 <= 2.8) {
tmp = t_3 + ((1.0 / (Math.sqrt(y) + t_4)) + (((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + t_1)))) / t));
} else {
tmp = t_4 + ((t_1 + (t_3 - Math.sqrt(z))) - (Math.sqrt(y) + (-1.0 / (Math.sqrt(t) + Math.sqrt((1.0 + t))))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + z)) t_2 = math.sqrt((x + 1.0)) t_3 = t_2 - math.sqrt(x) t_4 = math.sqrt((1.0 + y)) t_5 = (t_3 + (t_4 - math.sqrt(y))) + (t_1 - math.sqrt(z)) tmp = 0 if t_5 <= 0.02: tmp = (1.0 / (math.sqrt(x) + t_2)) + ((0.5 * math.sqrt((1.0 / y))) + (((0.5 * math.sqrt((1.0 / t))) + t_1) - math.sqrt(z))) elif t_5 <= 2.8: tmp = t_3 + ((1.0 / (math.sqrt(y) + t_4)) + (((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + t_1)))) / t)) else: tmp = t_4 + ((t_1 + (t_3 - math.sqrt(z))) - (math.sqrt(y) + (-1.0 / (math.sqrt(t) + math.sqrt((1.0 + t)))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 + z)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(t_2 - sqrt(x)) t_4 = sqrt(Float64(1.0 + y)) t_5 = Float64(Float64(t_3 + Float64(t_4 - sqrt(y))) + Float64(t_1 - sqrt(z))) tmp = 0.0 if (t_5 <= 0.02) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_1) - sqrt(z)))); elseif (t_5 <= 2.8) tmp = Float64(t_3 + Float64(Float64(1.0 / Float64(sqrt(y) + t_4)) + Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + t_1)))) / t))); else tmp = Float64(t_4 + Float64(Float64(t_1 + Float64(t_3 - sqrt(z))) - Float64(sqrt(y) + Float64(-1.0 / Float64(sqrt(t) + sqrt(Float64(1.0 + 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 + z));
t_2 = sqrt((x + 1.0));
t_3 = t_2 - sqrt(x);
t_4 = sqrt((1.0 + y));
t_5 = (t_3 + (t_4 - sqrt(y))) + (t_1 - sqrt(z));
tmp = 0.0;
if (t_5 <= 0.02)
tmp = (1.0 / (sqrt(x) + t_2)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_1) - sqrt(z)));
elseif (t_5 <= 2.8)
tmp = t_3 + ((1.0 / (sqrt(y) + t_4)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t));
else
tmp = t_4 + ((t_1 + (t_3 - sqrt(z))) - (sqrt(y) + (-1.0 / (sqrt(t) + sqrt((1.0 + 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 + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$3 + N[(t$95$4 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 0.02], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.8], N[(t$95$3 + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$4 + N[(N[(t$95$1 + N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[y], $MachinePrecision] + N[(-1.0 / N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]), $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}\\
t_2 := \sqrt{x + 1}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := \sqrt{1 + y}\\
t_5 := \left(t\_3 + \left(t\_4 - \sqrt{y}\right)\right) + \left(t\_1 - \sqrt{z}\right)\\
\mathbf{if}\;t\_5 \leq 0.02:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right) - \sqrt{z}\right)\right)\\
\mathbf{elif}\;t\_5 \leq 2.8:\\
\;\;\;\;t\_3 + \left(\frac{1}{\sqrt{y} + t\_4} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_1}}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4 + \left(\left(t\_1 + \left(t\_3 - \sqrt{z}\right)\right) - \left(\sqrt{y} + \frac{-1}{\sqrt{t} + \sqrt{1 + t}}\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.0200000000000000004Initial program 57.7%
associate-+l+57.7%
associate-+l+57.7%
+-commutative57.7%
+-commutative57.7%
associate-+l-57.7%
+-commutative57.7%
+-commutative57.7%
Simplified57.7%
Taylor expanded in t around inf 5.5%
+-commutative5.5%
Simplified5.5%
flip--5.5%
add-sqr-sqrt4.8%
+-commutative4.8%
add-sqr-sqrt5.5%
+-commutative5.5%
Applied egg-rr5.5%
associate--l+10.3%
+-inverses10.3%
metadata-eval10.3%
Simplified10.3%
Taylor expanded in y around inf 21.1%
if 0.0200000000000000004 < (+.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.7999999999999998Initial program 96.3%
associate-+l+96.3%
associate-+l+96.3%
+-commutative96.3%
+-commutative96.3%
associate-+l-79.2%
+-commutative79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in t around inf 50.0%
+-commutative50.0%
Simplified50.0%
Taylor expanded in t around 0 49.4%
flip--49.4%
add-sqr-sqrt38.8%
add-sqr-sqrt49.4%
Applied egg-rr49.4%
associate--l+50.1%
+-inverses50.1%
metadata-eval50.1%
+-commutative50.1%
Simplified50.1%
flip--50.1%
add-sqr-sqrt39.1%
add-sqr-sqrt50.4%
Applied egg-rr50.4%
associate--l+50.6%
+-inverses50.6%
metadata-eval50.6%
+-commutative50.6%
Simplified50.6%
if 2.7999999999999998 < (+.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.0%
+-commutative99.0%
associate-+r+99.0%
associate-+r-98.8%
associate-+l-98.8%
associate-+r-98.9%
Simplified99.0%
flip--99.0%
add-sqr-sqrt87.0%
add-sqr-sqrt100.0%
+-commutative100.0%
+-commutative100.0%
Applied egg-rr100.0%
associate--r+99.9%
+-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification51.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 (sqrt (+ x 1.0)))
(t_4 (- t_3 (sqrt x)))
(t_5 (sqrt (+ 1.0 t)))
(t_6
(+ (+ (+ t_4 (- t_1 (sqrt y))) (- t_2 (sqrt z))) (- t_5 (sqrt t)))))
(if (<= t_6 0.02)
(+
(/ 1.0 (+ (sqrt x) t_3))
(+
(* 0.5 (sqrt (/ 1.0 y)))
(- (+ (* 0.5 (sqrt (/ 1.0 t))) t_2) (sqrt z))))
(if (<= t_6 3.01)
(+
t_4
(+
(/ 1.0 (+ (sqrt y) t_1))
(/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) t_2)))) t)))
(+
1.0
(-
(+ t_3 (+ t_2 t_5))
(+ (sqrt t) (+ (sqrt z) (+ (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 = sqrt((x + 1.0));
double t_4 = t_3 - sqrt(x);
double t_5 = sqrt((1.0 + t));
double t_6 = ((t_4 + (t_1 - sqrt(y))) + (t_2 - sqrt(z))) + (t_5 - sqrt(t));
double tmp;
if (t_6 <= 0.02) {
tmp = (1.0 / (sqrt(x) + t_3)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_2) - sqrt(z)));
} else if (t_6 <= 3.01) {
tmp = t_4 + ((1.0 / (sqrt(y) + t_1)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_2)))) / t));
} else {
tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (sqrt(t) + (sqrt(z) + (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 = sqrt((x + 1.0d0))
t_4 = t_3 - sqrt(x)
t_5 = sqrt((1.0d0 + t))
t_6 = ((t_4 + (t_1 - sqrt(y))) + (t_2 - sqrt(z))) + (t_5 - sqrt(t))
if (t_6 <= 0.02d0) then
tmp = (1.0d0 / (sqrt(x) + t_3)) + ((0.5d0 * sqrt((1.0d0 / y))) + (((0.5d0 * sqrt((1.0d0 / t))) + t_2) - sqrt(z)))
else if (t_6 <= 3.01d0) then
tmp = t_4 + ((1.0d0 / (sqrt(y) + t_1)) + (((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + t_2)))) / t))
else
tmp = 1.0d0 + ((t_3 + (t_2 + t_5)) - (sqrt(t) + (sqrt(z) + (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 = Math.sqrt((x + 1.0));
double t_4 = t_3 - Math.sqrt(x);
double t_5 = Math.sqrt((1.0 + t));
double t_6 = ((t_4 + (t_1 - Math.sqrt(y))) + (t_2 - Math.sqrt(z))) + (t_5 - Math.sqrt(t));
double tmp;
if (t_6 <= 0.02) {
tmp = (1.0 / (Math.sqrt(x) + t_3)) + ((0.5 * Math.sqrt((1.0 / y))) + (((0.5 * Math.sqrt((1.0 / t))) + t_2) - Math.sqrt(z)));
} else if (t_6 <= 3.01) {
tmp = t_4 + ((1.0 / (Math.sqrt(y) + t_1)) + (((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + t_2)))) / t));
} else {
tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (Math.sqrt(t) + (Math.sqrt(z) + (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 = math.sqrt((x + 1.0)) t_4 = t_3 - math.sqrt(x) t_5 = math.sqrt((1.0 + t)) t_6 = ((t_4 + (t_1 - math.sqrt(y))) + (t_2 - math.sqrt(z))) + (t_5 - math.sqrt(t)) tmp = 0 if t_6 <= 0.02: tmp = (1.0 / (math.sqrt(x) + t_3)) + ((0.5 * math.sqrt((1.0 / y))) + (((0.5 * math.sqrt((1.0 / t))) + t_2) - math.sqrt(z))) elif t_6 <= 3.01: tmp = t_4 + ((1.0 / (math.sqrt(y) + t_1)) + (((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + t_2)))) / t)) else: tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (math.sqrt(t) + (math.sqrt(z) + (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 = sqrt(Float64(x + 1.0)) t_4 = Float64(t_3 - sqrt(x)) t_5 = sqrt(Float64(1.0 + t)) t_6 = Float64(Float64(Float64(t_4 + Float64(t_1 - sqrt(y))) + Float64(t_2 - sqrt(z))) + Float64(t_5 - sqrt(t))) tmp = 0.0 if (t_6 <= 0.02) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_2) - sqrt(z)))); elseif (t_6 <= 3.01) tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(sqrt(y) + t_1)) + Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + t_2)))) / t))); else tmp = Float64(1.0 + Float64(Float64(t_3 + Float64(t_2 + t_5)) - Float64(sqrt(t) + Float64(sqrt(z) + 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 = sqrt((x + 1.0));
t_4 = t_3 - sqrt(x);
t_5 = sqrt((1.0 + t));
t_6 = ((t_4 + (t_1 - sqrt(y))) + (t_2 - sqrt(z))) + (t_5 - sqrt(t));
tmp = 0.0;
if (t_6 <= 0.02)
tmp = (1.0 / (sqrt(x) + t_3)) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + t_2) - sqrt(z)));
elseif (t_6 <= 3.01)
tmp = t_4 + ((1.0 / (sqrt(y) + t_1)) + (((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_2)))) / t));
else
tmp = 1.0 + ((t_3 + (t_2 + t_5)) - (sqrt(t) + (sqrt(z) + (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[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(1.0 + t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$4 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$6, 0.02], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 3.01], N[(t$95$4 + N[(N[(1.0 / N[(N[Sqrt[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$3 + N[(t$95$2 + t$95$5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $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 := \sqrt{x + 1}\\
t_4 := t\_3 - \sqrt{x}\\
t_5 := \sqrt{1 + t}\\
t_6 := \left(\left(t\_4 + \left(t\_1 - \sqrt{y}\right)\right) + \left(t\_2 - \sqrt{z}\right)\right) + \left(t\_5 - \sqrt{t}\right)\\
\mathbf{if}\;t\_6 \leq 0.02:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_2\right) - \sqrt{z}\right)\right)\\
\mathbf{elif}\;t\_6 \leq 3.01:\\
\;\;\;\;t\_4 + \left(\frac{1}{\sqrt{y} + t\_1} + \frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_2}}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_3 + \left(t\_2 + t\_5\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 0.0200000000000000004Initial program 17.2%
associate-+l+17.2%
associate-+l+17.2%
+-commutative17.2%
+-commutative17.2%
associate-+l-17.2%
+-commutative17.2%
+-commutative17.2%
Simplified17.2%
Taylor expanded in t around inf 4.8%
+-commutative4.8%
Simplified4.8%
flip--4.8%
add-sqr-sqrt4.4%
+-commutative4.4%
add-sqr-sqrt4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate--l+13.7%
+-inverses13.7%
metadata-eval13.7%
Simplified13.7%
Taylor expanded in y around inf 35.9%
if 0.0200000000000000004 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) < 3.0099999999999998Initial program 96.3%
associate-+l+96.3%
associate-+l+96.3%
+-commutative96.3%
+-commutative96.3%
associate-+l-77.3%
+-commutative77.3%
+-commutative77.3%
Simplified77.3%
Taylor expanded in t around inf 49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in t around 0 49.4%
flip--49.4%
add-sqr-sqrt40.0%
add-sqr-sqrt49.4%
Applied egg-rr49.4%
associate--l+50.0%
+-inverses50.0%
metadata-eval50.0%
+-commutative50.0%
Simplified50.0%
flip--49.9%
add-sqr-sqrt40.3%
add-sqr-sqrt50.2%
Applied egg-rr50.2%
associate--l+50.4%
+-inverses50.4%
metadata-eval50.4%
+-commutative50.4%
Simplified50.4%
if 3.0099999999999998 < (+.f64 (+.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))) (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t))) Initial program 99.7%
+-commutative99.7%
associate-+r+99.7%
associate-+r-99.7%
associate-+l-99.7%
associate-+r-99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
associate--l+99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+r+99.7%
Simplified99.7%
Final simplification51.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 t))) (t_3 (sqrt (+ 1.0 z))))
(if (<= (- t_2 (sqrt t)) 5e-6)
(+
(/ 1.0 (+ (sqrt x) t_1))
(+
(- (+ (* 0.5 (sqrt (/ 1.0 t))) t_3) (sqrt z))
(- (sqrt (+ 1.0 y)) (sqrt y))))
(+
1.0
(-
(+ t_1 (+ t_3 t_2))
(+ (sqrt t) (+ (sqrt z) (+ (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((x + 1.0));
double t_2 = sqrt((1.0 + t));
double t_3 = sqrt((1.0 + z));
double tmp;
if ((t_2 - sqrt(t)) <= 5e-6) {
tmp = (1.0 / (sqrt(x) + t_1)) + ((((0.5 * sqrt((1.0 / t))) + t_3) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
} else {
tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (sqrt(t) + (sqrt(z) + (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) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + t))
t_3 = sqrt((1.0d0 + z))
if ((t_2 - sqrt(t)) <= 5d-6) then
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((((0.5d0 * sqrt((1.0d0 / t))) + t_3) - sqrt(z)) + (sqrt((1.0d0 + y)) - sqrt(y)))
else
tmp = 1.0d0 + ((t_1 + (t_3 + t_2)) - (sqrt(t) + (sqrt(z) + (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((x + 1.0));
double t_2 = Math.sqrt((1.0 + t));
double t_3 = Math.sqrt((1.0 + z));
double tmp;
if ((t_2 - Math.sqrt(t)) <= 5e-6) {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((((0.5 * Math.sqrt((1.0 / t))) + t_3) - Math.sqrt(z)) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
} else {
tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (Math.sqrt(t) + (Math.sqrt(z) + (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((x + 1.0)) t_2 = math.sqrt((1.0 + t)) t_3 = math.sqrt((1.0 + z)) tmp = 0 if (t_2 - math.sqrt(t)) <= 5e-6: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((((0.5 * math.sqrt((1.0 / t))) + t_3) - math.sqrt(z)) + (math.sqrt((1.0 + y)) - math.sqrt(y))) else: tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (math.sqrt(t) + (math.sqrt(z) + (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(x + 1.0)) t_2 = sqrt(Float64(1.0 + t)) t_3 = sqrt(Float64(1.0 + z)) tmp = 0.0 if (Float64(t_2 - sqrt(t)) <= 5e-6) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_3) - sqrt(z)) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(1.0 + Float64(Float64(t_1 + Float64(t_3 + t_2)) - Float64(sqrt(t) + Float64(sqrt(z) + 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((x + 1.0));
t_2 = sqrt((1.0 + t));
t_3 = sqrt((1.0 + z));
tmp = 0.0;
if ((t_2 - sqrt(t)) <= 5e-6)
tmp = (1.0 / (sqrt(x) + t_1)) + ((((0.5 * sqrt((1.0 / t))) + t_3) - sqrt(z)) + (sqrt((1.0 + y)) - sqrt(y)));
else
tmp = 1.0 + ((t_1 + (t_3 + t_2)) - (sqrt(t) + (sqrt(z) + (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[(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]}, If[LessEqual[N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision], 5e-6], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t$95$1 + N[(t$95$3 + t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + t}\\
t_3 := \sqrt{1 + z}\\
\mathbf{if}\;t\_2 - \sqrt{t} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(\left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_3\right) - \sqrt{z}\right) + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(t\_1 + \left(t\_3 + t\_2\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t)) < 5.00000000000000041e-6Initial program 86.1%
associate-+l+86.1%
associate-+l+86.1%
+-commutative86.1%
+-commutative86.1%
associate-+l-48.9%
+-commutative48.9%
+-commutative48.9%
Simplified48.9%
Taylor expanded in t around inf 86.3%
+-commutative86.3%
Simplified86.3%
flip--86.3%
add-sqr-sqrt74.3%
+-commutative74.3%
add-sqr-sqrt86.7%
+-commutative86.7%
Applied egg-rr86.7%
associate--l+87.9%
+-inverses87.9%
metadata-eval87.9%
Simplified87.9%
if 5.00000000000000041e-6 < (-.f64 (sqrt.f64 (+.f64 t #s(literal 1 binary64))) (sqrt.f64 t)) Initial program 96.2%
+-commutative96.2%
associate-+r+96.2%
associate-+r-78.9%
associate-+l-55.1%
associate-+r-51.3%
Simplified40.9%
Taylor expanded in y around 0 13.0%
associate--l+26.2%
+-commutative26.2%
associate-+r+26.2%
+-commutative26.2%
associate-+r+26.2%
Simplified26.2%
Final simplification54.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (sqrt (/ 1.0 t))))
(t_2 (- (sqrt (+ 1.0 y)) (sqrt y)))
(t_3 (sqrt (+ x 1.0))))
(if (<= (- t_3 (sqrt x)) 0.98)
(+ (/ 1.0 (+ (sqrt x) t_3)) (+ t_1 t_2))
(+
(+ (- (+ t_1 (sqrt (+ 1.0 z))) (sqrt z)) t_2)
(+ 1.0 (- (* x 0.5) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * sqrt((1.0 / t));
double t_2 = sqrt((1.0 + y)) - sqrt(y);
double t_3 = sqrt((x + 1.0));
double tmp;
if ((t_3 - sqrt(x)) <= 0.98) {
tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + t_2);
} else {
tmp = (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - 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 = 0.5d0 * sqrt((1.0d0 / t))
t_2 = sqrt((1.0d0 + y)) - sqrt(y)
t_3 = sqrt((x + 1.0d0))
if ((t_3 - sqrt(x)) <= 0.98d0) then
tmp = (1.0d0 / (sqrt(x) + t_3)) + (t_1 + t_2)
else
tmp = (((t_1 + sqrt((1.0d0 + z))) - sqrt(z)) + t_2) + (1.0d0 + ((x * 0.5d0) - 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 = 0.5 * Math.sqrt((1.0 / t));
double t_2 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double t_3 = Math.sqrt((x + 1.0));
double tmp;
if ((t_3 - Math.sqrt(x)) <= 0.98) {
tmp = (1.0 / (Math.sqrt(x) + t_3)) + (t_1 + t_2);
} else {
tmp = (((t_1 + Math.sqrt((1.0 + z))) - Math.sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - Math.sqrt(x)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 0.5 * math.sqrt((1.0 / t)) t_2 = math.sqrt((1.0 + y)) - math.sqrt(y) t_3 = math.sqrt((x + 1.0)) tmp = 0 if (t_3 - math.sqrt(x)) <= 0.98: tmp = (1.0 / (math.sqrt(x) + t_3)) + (t_1 + t_2) else: tmp = (((t_1 + math.sqrt((1.0 + z))) - math.sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - math.sqrt(x))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(0.5 * sqrt(Float64(1.0 / t))) t_2 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) t_3 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_3 - sqrt(x)) <= 0.98) tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_3)) + Float64(t_1 + t_2)); else tmp = Float64(Float64(Float64(Float64(t_1 + sqrt(Float64(1.0 + z))) - sqrt(z)) + t_2) + Float64(1.0 + Float64(Float64(x * 0.5) - 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 = 0.5 * sqrt((1.0 / t));
t_2 = sqrt((1.0 + y)) - sqrt(y);
t_3 = sqrt((x + 1.0));
tmp = 0.0;
if ((t_3 - sqrt(x)) <= 0.98)
tmp = (1.0 / (sqrt(x) + t_3)) + (t_1 + t_2);
else
tmp = (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + t_2) + (1.0 + ((x * 0.5) - 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[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.98], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \sqrt{\frac{1}{t}}\\
t_2 := \sqrt{1 + y} - \sqrt{y}\\
t_3 := \sqrt{x + 1}\\
\mathbf{if}\;t\_3 - \sqrt{x} \leq 0.98:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_3} + \left(t\_1 + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t\_1 + \sqrt{1 + z}\right) - \sqrt{z}\right) + t\_2\right) + \left(1 + \left(x \cdot 0.5 - \sqrt{x}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.97999999999999998Initial program 86.5%
associate-+l+86.5%
associate-+l+86.5%
+-commutative86.5%
+-commutative86.5%
associate-+l-68.7%
+-commutative68.7%
+-commutative68.7%
Simplified68.7%
Taylor expanded in t around inf 36.8%
+-commutative36.8%
Simplified36.8%
flip--36.8%
add-sqr-sqrt24.3%
+-commutative24.3%
add-sqr-sqrt37.1%
+-commutative37.1%
Applied egg-rr37.1%
associate--l+38.4%
+-inverses38.4%
metadata-eval38.4%
Simplified38.4%
Taylor expanded in t around 0 20.0%
if 0.97999999999999998 < (-.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-80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in t around inf 53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in x around 0 53.4%
associate--l+53.4%
Simplified53.4%
Final simplification36.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (/ 1.0 t)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (- t_2 (sqrt x)))
(t_4 (* 0.5 t_1))
(t_5 (- (sqrt (+ 1.0 y)) (sqrt y))))
(if (<= z 2250000.0)
(+ t_3 (+ (- (+ t_4 (sqrt (+ 1.0 z))) (sqrt z)) (- 1.0 (sqrt y))))
(if (<= z 4.8e+31)
(+ t_3 (+ t_5 (* 0.5 (+ t_1 (sqrt (/ 1.0 z))))))
(+ (/ 1.0 (+ (sqrt x) t_2)) (+ t_4 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));
double t_2 = sqrt((x + 1.0));
double t_3 = t_2 - sqrt(x);
double t_4 = 0.5 * t_1;
double t_5 = sqrt((1.0 + y)) - sqrt(y);
double tmp;
if (z <= 2250000.0) {
tmp = t_3 + (((t_4 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
} else if (z <= 4.8e+31) {
tmp = t_3 + (t_5 + (0.5 * (t_1 + sqrt((1.0 / z)))));
} else {
tmp = (1.0 / (sqrt(x) + t_2)) + (t_4 + 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))
t_2 = sqrt((x + 1.0d0))
t_3 = t_2 - sqrt(x)
t_4 = 0.5d0 * t_1
t_5 = sqrt((1.0d0 + y)) - sqrt(y)
if (z <= 2250000.0d0) then
tmp = t_3 + (((t_4 + sqrt((1.0d0 + z))) - sqrt(z)) + (1.0d0 - sqrt(y)))
else if (z <= 4.8d+31) then
tmp = t_3 + (t_5 + (0.5d0 * (t_1 + sqrt((1.0d0 / z)))))
else
tmp = (1.0d0 / (sqrt(x) + t_2)) + (t_4 + 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));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = 0.5 * t_1;
double t_5 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double tmp;
if (z <= 2250000.0) {
tmp = t_3 + (((t_4 + Math.sqrt((1.0 + z))) - Math.sqrt(z)) + (1.0 - Math.sqrt(y)));
} else if (z <= 4.8e+31) {
tmp = t_3 + (t_5 + (0.5 * (t_1 + Math.sqrt((1.0 / z)))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (t_4 + 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)) t_2 = math.sqrt((x + 1.0)) t_3 = t_2 - math.sqrt(x) t_4 = 0.5 * t_1 t_5 = math.sqrt((1.0 + y)) - math.sqrt(y) tmp = 0 if z <= 2250000.0: tmp = t_3 + (((t_4 + math.sqrt((1.0 + z))) - math.sqrt(z)) + (1.0 - math.sqrt(y))) elif z <= 4.8e+31: tmp = t_3 + (t_5 + (0.5 * (t_1 + math.sqrt((1.0 / z))))) else: tmp = (1.0 / (math.sqrt(x) + t_2)) + (t_4 + t_5) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(1.0 / t)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(t_2 - sqrt(x)) t_4 = Float64(0.5 * t_1) t_5 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) tmp = 0.0 if (z <= 2250000.0) tmp = Float64(t_3 + Float64(Float64(Float64(t_4 + sqrt(Float64(1.0 + z))) - sqrt(z)) + Float64(1.0 - sqrt(y)))); elseif (z <= 4.8e+31) tmp = Float64(t_3 + Float64(t_5 + Float64(0.5 * Float64(t_1 + sqrt(Float64(1.0 / z)))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(t_4 + 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));
t_2 = sqrt((x + 1.0));
t_3 = t_2 - sqrt(x);
t_4 = 0.5 * t_1;
t_5 = sqrt((1.0 + y)) - sqrt(y);
tmp = 0.0;
if (z <= 2250000.0)
tmp = t_3 + (((t_4 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
elseif (z <= 4.8e+31)
tmp = t_3 + (t_5 + (0.5 * (t_1 + sqrt((1.0 / z)))));
else
tmp = (1.0 / (sqrt(x) + t_2)) + (t_4 + 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[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * t$95$1), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2250000.0], N[(t$95$3 + N[(N[(N[(t$95$4 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e+31], N[(t$95$3 + N[(t$95$5 + N[(0.5 * N[(t$95$1 + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + t$95$5), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{1}{t}}\\
t_2 := \sqrt{x + 1}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := 0.5 \cdot t\_1\\
t_5 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;z \leq 2250000:\\
\;\;\;\;t\_3 + \left(\left(\left(t\_4 + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+31}:\\
\;\;\;\;t\_3 + \left(t\_5 + 0.5 \cdot \left(t\_1 + \sqrt{\frac{1}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_4 + t\_5\right)\\
\end{array}
\end{array}
if z < 2.25e6Initial program 98.2%
associate-+l+98.2%
associate-+l+98.2%
+-commutative98.2%
+-commutative98.2%
associate-+l-62.5%
+-commutative62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in t around inf 50.2%
+-commutative50.2%
Simplified50.2%
Taylor expanded in y around 0 26.9%
if 2.25e6 < z < 4.79999999999999965e31Initial program 73.6%
associate-+l+73.6%
associate-+l+73.6%
+-commutative73.6%
+-commutative73.6%
associate-+l-73.6%
+-commutative73.6%
+-commutative73.6%
Simplified73.6%
Taylor expanded in t around inf 38.0%
+-commutative38.0%
Simplified38.0%
Taylor expanded in z around inf 55.8%
distribute-lft-out55.8%
Simplified55.8%
if 4.79999999999999965e31 < z Initial program 87.1%
associate-+l+87.1%
associate-+l+87.1%
+-commutative87.1%
+-commutative87.1%
associate-+l-87.1%
+-commutative87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in t around inf 40.8%
+-commutative40.8%
Simplified40.8%
flip--40.8%
add-sqr-sqrt37.3%
+-commutative37.3%
add-sqr-sqrt40.9%
+-commutative40.9%
Applied egg-rr40.9%
associate--l+42.2%
+-inverses42.2%
metadata-eval42.2%
Simplified42.2%
Taylor expanded in t around 0 43.3%
Final simplification36.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))))
(if (<= y 16200000.0)
(+
(- 1.0 (sqrt x))
(+
(/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) t_1)))) t)
(- (sqrt (+ 1.0 y)) (sqrt y))))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))
(+
(* 0.5 (sqrt (/ 1.0 y)))
(- (+ (* 0.5 (sqrt (/ 1.0 t))) 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 tmp;
if (y <= 16200000.0) {
tmp = (1.0 - sqrt(x)) + ((((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t) + (sqrt((1.0 + y)) - sqrt(y)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + 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) :: tmp
t_1 = sqrt((1.0d0 + z))
if (y <= 16200000.0d0) then
tmp = (1.0d0 - sqrt(x)) + ((((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + t_1)))) / t) + (sqrt((1.0d0 + y)) - sqrt(y)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))) + ((0.5d0 * sqrt((1.0d0 / y))) + (((0.5d0 * sqrt((1.0d0 / t))) + 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 tmp;
if (y <= 16200000.0) {
tmp = (1.0 - Math.sqrt(x)) + ((((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + t_1)))) / t) + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) + ((0.5 * Math.sqrt((1.0 / y))) + (((0.5 * Math.sqrt((1.0 / t))) + 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)) tmp = 0 if y <= 16200000.0: tmp = (1.0 - math.sqrt(x)) + ((((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + t_1)))) / t) + (math.sqrt((1.0 + y)) - math.sqrt(y))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))) + ((0.5 * math.sqrt((1.0 / y))) + (((0.5 * math.sqrt((1.0 / t))) + 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)) tmp = 0.0 if (y <= 16200000.0) tmp = Float64(Float64(1.0 - sqrt(x)) + Float64(Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + t_1)))) / t) + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + 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));
tmp = 0.0;
if (y <= 16200000.0)
tmp = (1.0 - sqrt(x)) + ((((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + t_1)))) / t) + (sqrt((1.0 + y)) - sqrt(y)));
else
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / y))) + (((0.5 * sqrt((1.0 / t))) + 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]}, If[LessEqual[y, 16200000.0], N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + z}\\
\mathbf{if}\;y \leq 16200000:\\
\;\;\;\;\left(1 - \sqrt{x}\right) + \left(\frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + t\_1}}{t} + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(\left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right) - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if y < 1.62e7Initial program 96.0%
associate-+l+96.0%
associate-+l+96.0%
+-commutative96.0%
+-commutative96.0%
associate-+l-78.5%
+-commutative78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in t around inf 50.4%
+-commutative50.4%
Simplified50.4%
Taylor expanded in t around 0 49.2%
flip--49.2%
add-sqr-sqrt39.6%
add-sqr-sqrt49.2%
Applied egg-rr49.2%
associate--l+50.3%
+-inverses50.3%
metadata-eval50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in x around 0 26.8%
if 1.62e7 < y Initial program 87.4%
associate-+l+87.4%
associate-+l+87.4%
+-commutative87.4%
+-commutative87.4%
associate-+l-70.8%
+-commutative70.8%
+-commutative70.8%
Simplified70.8%
Taylor expanded in t around inf 40.2%
+-commutative40.2%
Simplified40.2%
flip--40.2%
add-sqr-sqrt36.1%
+-commutative36.1%
add-sqr-sqrt40.2%
+-commutative40.2%
Applied egg-rr40.2%
associate--l+41.4%
+-inverses41.4%
metadata-eval41.4%
Simplified41.4%
Taylor expanded in y around inf 44.6%
Final simplification36.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)) (sqrt y))))
(if (<= z 4.5e+73)
(+
(- 1.0 (sqrt x))
(+
(/ (+ (* 0.5 (sqrt t)) (* t (/ 1.0 (+ (sqrt z) (sqrt (+ 1.0 z)))))) t)
t_1))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))
(+ (* 0.5 (sqrt (/ 1.0 t))) t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((1.0 + y)) - sqrt(y);
double tmp;
if (z <= 4.5e+73) {
tmp = (1.0 - sqrt(x)) + ((((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + sqrt((1.0 + z)))))) / t) + t_1);
} else {
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / t))) + t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y)) - sqrt(y)
if (z <= 4.5d+73) then
tmp = (1.0d0 - sqrt(x)) + ((((0.5d0 * sqrt(t)) + (t * (1.0d0 / (sqrt(z) + sqrt((1.0d0 + z)))))) / t) + t_1)
else
tmp = (1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))) + ((0.5d0 * sqrt((1.0d0 / t))) + t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((1.0 + y)) - Math.sqrt(y);
double tmp;
if (z <= 4.5e+73) {
tmp = (1.0 - Math.sqrt(x)) + ((((0.5 * Math.sqrt(t)) + (t * (1.0 / (Math.sqrt(z) + Math.sqrt((1.0 + z)))))) / t) + t_1);
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) + ((0.5 * Math.sqrt((1.0 / t))) + t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((1.0 + y)) - math.sqrt(y) tmp = 0 if z <= 4.5e+73: tmp = (1.0 - math.sqrt(x)) + ((((0.5 * math.sqrt(t)) + (t * (1.0 / (math.sqrt(z) + math.sqrt((1.0 + z)))))) / t) + t_1) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))) + ((0.5 * math.sqrt((1.0 / t))) + t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(1.0 + y)) - sqrt(y)) tmp = 0.0 if (z <= 4.5e+73) tmp = Float64(Float64(1.0 - sqrt(x)) + Float64(Float64(Float64(Float64(0.5 * sqrt(t)) + Float64(t * Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(1.0 + z)))))) / t) + t_1)); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((1.0 + y)) - sqrt(y);
tmp = 0.0;
if (z <= 4.5e+73)
tmp = (1.0 - sqrt(x)) + ((((0.5 * sqrt(t)) + (t * (1.0 / (sqrt(z) + sqrt((1.0 + z)))))) / t) + t_1);
else
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / t))) + t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 4.5e+73], N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(0.5 * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(t * N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{1 + y} - \sqrt{y}\\
\mathbf{if}\;z \leq 4.5 \cdot 10^{+73}:\\
\;\;\;\;\left(1 - \sqrt{x}\right) + \left(\frac{0.5 \cdot \sqrt{t} + t \cdot \frac{1}{\sqrt{z} + \sqrt{1 + z}}}{t} + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + t\_1\right)\\
\end{array}
\end{array}
if z < 4.49999999999999985e73Initial program 93.4%
associate-+l+93.4%
associate-+l+93.4%
+-commutative93.4%
+-commutative93.4%
associate-+l-65.3%
+-commutative65.3%
+-commutative65.3%
Simplified65.3%
Taylor expanded in t around inf 45.9%
+-commutative45.9%
Simplified45.9%
Taylor expanded in t around 0 46.7%
flip--46.7%
add-sqr-sqrt45.4%
add-sqr-sqrt46.7%
Applied egg-rr46.7%
associate--l+49.8%
+-inverses49.8%
metadata-eval49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in x around 0 24.7%
if 4.49999999999999985e73 < z Initial program 88.7%
associate-+l+88.7%
associate-+l+88.7%
+-commutative88.7%
+-commutative88.7%
associate-+l-88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
Taylor expanded in t around inf 44.0%
+-commutative44.0%
Simplified44.0%
flip--44.0%
add-sqr-sqrt40.8%
+-commutative40.8%
add-sqr-sqrt44.0%
+-commutative44.0%
Applied egg-rr44.0%
associate--l+45.3%
+-inverses45.3%
metadata-eval45.3%
Simplified45.3%
Taylor expanded in t around 0 46.2%
Final simplification33.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 (* 0.5 (sqrt (/ 1.0 t)))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 6.6e-15)
(+
(- t_2 (sqrt x))
(+ (- (+ t_1 (sqrt (+ 1.0 z))) (sqrt z)) (- 1.0 (sqrt y))))
(+ (/ 1.0 (+ (sqrt x) t_2)) (+ t_1 (- (sqrt (+ 1.0 y)) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * sqrt((1.0 / t));
double t_2 = sqrt((x + 1.0));
double tmp;
if (y <= 6.6e-15) {
tmp = (t_2 - sqrt(x)) + (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
} else {
tmp = (1.0 / (sqrt(x) + t_2)) + (t_1 + (sqrt((1.0 + y)) - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 0.5d0 * sqrt((1.0d0 / t))
t_2 = sqrt((x + 1.0d0))
if (y <= 6.6d-15) then
tmp = (t_2 - sqrt(x)) + (((t_1 + sqrt((1.0d0 + z))) - sqrt(z)) + (1.0d0 - sqrt(y)))
else
tmp = (1.0d0 / (sqrt(x) + t_2)) + (t_1 + (sqrt((1.0d0 + y)) - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * Math.sqrt((1.0 / t));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 6.6e-15) {
tmp = (t_2 - Math.sqrt(x)) + (((t_1 + Math.sqrt((1.0 + z))) - Math.sqrt(z)) + (1.0 - Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_2)) + (t_1 + (Math.sqrt((1.0 + y)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 0.5 * math.sqrt((1.0 / t)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if y <= 6.6e-15: tmp = (t_2 - math.sqrt(x)) + (((t_1 + math.sqrt((1.0 + z))) - math.sqrt(z)) + (1.0 - math.sqrt(y))) else: tmp = (1.0 / (math.sqrt(x) + t_2)) + (t_1 + (math.sqrt((1.0 + y)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(0.5 * sqrt(Float64(1.0 / t))) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 6.6e-15) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(Float64(Float64(t_1 + sqrt(Float64(1.0 + z))) - sqrt(z)) + Float64(1.0 - sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_2)) + Float64(t_1 + Float64(sqrt(Float64(1.0 + y)) - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 0.5 * sqrt((1.0 / t));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 6.6e-15)
tmp = (t_2 - sqrt(x)) + (((t_1 + sqrt((1.0 + z))) - sqrt(z)) + (1.0 - sqrt(y)));
else
tmp = (1.0 / (sqrt(x) + t_2)) + (t_1 + (sqrt((1.0 + y)) - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6.6e-15], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 + N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := 0.5 \cdot \sqrt{\frac{1}{t}}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 6.6 \cdot 10^{-15}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(\left(\left(t\_1 + \sqrt{1 + z}\right) - \sqrt{z}\right) + \left(1 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_2} + \left(t\_1 + \left(\sqrt{1 + y} - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if y < 6.6e-15Initial program 96.2%
associate-+l+96.2%
associate-+l+96.2%
+-commutative96.2%
+-commutative96.2%
associate-+l-78.4%
+-commutative78.4%
+-commutative78.4%
Simplified78.4%
Taylor expanded in t around inf 49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around 0 49.9%
if 6.6e-15 < y Initial program 88.1%
associate-+l+88.1%
associate-+l+88.1%
+-commutative88.1%
+-commutative88.1%
associate-+l-71.8%
+-commutative71.8%
+-commutative71.8%
Simplified71.8%
Taylor expanded in t around inf 41.7%
+-commutative41.7%
Simplified41.7%
flip--41.7%
add-sqr-sqrt36.7%
+-commutative36.7%
add-sqr-sqrt41.7%
+-commutative41.7%
Applied egg-rr41.7%
associate--l+42.8%
+-inverses42.8%
metadata-eval42.8%
Simplified42.8%
Taylor expanded in t around 0 28.0%
Final simplification37.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 (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 2.4e+16)
(+ t_1 (+ t_2 (- (sqrt (+ 1.0 z)) (+ (sqrt z) (+ (sqrt x) (sqrt y))))))
(+
(/ 1.0 (+ (sqrt x) t_1))
(+ (* 0.5 (sqrt (/ 1.0 t))) (- t_2 (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 2.4e+16) {
tmp = t_1 + (t_2 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y)))));
} else {
tmp = (1.0 / (sqrt(x) + t_1)) + ((0.5 * sqrt((1.0 / t))) + (t_2 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if (z <= 2.4d+16) then
tmp = t_1 + (t_2 + (sqrt((1.0d0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y)))))
else
tmp = (1.0d0 / (sqrt(x) + t_1)) + ((0.5d0 * sqrt((1.0d0 / t))) + (t_2 - sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 2.4e+16) {
tmp = t_1 + (t_2 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + (Math.sqrt(x) + Math.sqrt(y)))));
} else {
tmp = (1.0 / (Math.sqrt(x) + t_1)) + ((0.5 * Math.sqrt((1.0 / t))) + (t_2 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 2.4e+16: tmp = t_1 + (t_2 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + (math.sqrt(x) + math.sqrt(y))))) else: tmp = (1.0 / (math.sqrt(x) + t_1)) + ((0.5 * math.sqrt((1.0 / t))) + (t_2 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 2.4e+16) tmp = Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + Float64(sqrt(x) + sqrt(y)))))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + t_1)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(t_2 - sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 2.4e+16)
tmp = t_1 + (t_2 + (sqrt((1.0 + z)) - (sqrt(z) + (sqrt(x) + sqrt(y)))));
else
tmp = (1.0 / (sqrt(x) + t_1)) + ((0.5 * sqrt((1.0 / t))) + (t_2 - sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.4e+16], N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - 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{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{1 + z} - \left(\sqrt{z} + \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + t\_1} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_2 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 2.4e16Initial program 98.0%
+-commutative98.0%
associate-+r+98.0%
associate-+r-78.4%
associate-+l-65.5%
associate-+r-51.2%
Simplified51.2%
Taylor expanded in t around inf 17.0%
associate--l+21.3%
associate--l+21.3%
associate-+r+21.3%
Simplified21.3%
if 2.4e16 < z Initial program 85.6%
associate-+l+85.6%
associate-+l+85.6%
+-commutative85.6%
+-commutative85.6%
associate-+l-85.6%
+-commutative85.6%
+-commutative85.6%
Simplified85.6%
Taylor expanded in t around inf 40.3%
+-commutative40.3%
Simplified40.3%
flip--40.3%
add-sqr-sqrt37.0%
+-commutative37.0%
add-sqr-sqrt40.3%
+-commutative40.3%
Applied egg-rr40.3%
associate--l+41.5%
+-inverses41.5%
metadata-eval41.5%
Simplified41.5%
Taylor expanded in t around 0 42.9%
Final simplification32.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 y))))
(if (<= z 9.6e+15)
(- (+ 1.0 (+ (sqrt (+ 1.0 z)) t_1)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(/ 1.0 (+ (sqrt x) (sqrt (+ x 1.0))))
(+ (* 0.5 (sqrt (/ 1.0 t))) (- t_1 (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 tmp;
if (z <= 9.6e+15) {
tmp = (1.0 + (sqrt((1.0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / t))) + (t_1 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 9.6d+15) then
tmp = (1.0d0 + (sqrt((1.0d0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = (1.0d0 / (sqrt(x) + sqrt((x + 1.0d0)))) + ((0.5d0 * sqrt((1.0d0 / t))) + (t_1 - 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 tmp;
if (z <= 9.6e+15) {
tmp = (1.0 + (Math.sqrt((1.0 + z)) + t_1)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = (1.0 / (Math.sqrt(x) + Math.sqrt((x + 1.0)))) + ((0.5 * Math.sqrt((1.0 / t))) + (t_1 - 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)) tmp = 0 if z <= 9.6e+15: tmp = (1.0 + (math.sqrt((1.0 + z)) + t_1)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = (1.0 / (math.sqrt(x) + math.sqrt((x + 1.0)))) + ((0.5 * math.sqrt((1.0 / t))) + (t_1 - 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)) tmp = 0.0 if (z <= 9.6e+15) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + t_1)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(x) + sqrt(Float64(x + 1.0)))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(t_1 - 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));
tmp = 0.0;
if (z <= 9.6e+15)
tmp = (1.0 + (sqrt((1.0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = (1.0 / (sqrt(x) + sqrt((x + 1.0)))) + ((0.5 * sqrt((1.0 / t))) + (t_1 - 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]}, If[LessEqual[z, 9.6e+15], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - 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}\\
\mathbf{if}\;z \leq 9.6 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + z} + t\_1\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x} + \sqrt{x + 1}} + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_1 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 9.6e15Initial program 98.0%
+-commutative98.0%
associate-+r+98.0%
associate-+r-78.4%
associate-+l-65.5%
associate-+r-51.2%
Simplified51.2%
Taylor expanded in t around inf 17.0%
associate--l+21.3%
associate--l+21.3%
associate-+r+21.3%
Simplified21.3%
Taylor expanded in x around 0 14.8%
if 9.6e15 < z Initial program 85.6%
associate-+l+85.6%
associate-+l+85.6%
+-commutative85.6%
+-commutative85.6%
associate-+l-85.6%
+-commutative85.6%
+-commutative85.6%
Simplified85.6%
Taylor expanded in t around inf 40.3%
+-commutative40.3%
Simplified40.3%
flip--40.3%
add-sqr-sqrt37.0%
+-commutative37.0%
add-sqr-sqrt40.3%
+-commutative40.3%
Applied egg-rr40.3%
associate--l+41.5%
+-inverses41.5%
metadata-eval41.5%
Simplified41.5%
Taylor expanded in t around 0 42.9%
Final simplification29.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))))
(if (<= z 9e+16)
(- (+ 1.0 (+ (sqrt (+ 1.0 z)) t_1)) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (* 0.5 (sqrt (/ 1.0 t))) (- t_1 (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 tmp;
if (z <= 9e+16) {
tmp = (1.0 + (sqrt((1.0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((0.5 * sqrt((1.0 / t))) + (t_1 - sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((1.0d0 + y))
if (z <= 9d+16) then
tmp = (1.0d0 + (sqrt((1.0d0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((0.5d0 * sqrt((1.0d0 / t))) + (t_1 - 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 tmp;
if (z <= 9e+16) {
tmp = (1.0 + (Math.sqrt((1.0 + z)) + t_1)) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((0.5 * Math.sqrt((1.0 / t))) + (t_1 - 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)) tmp = 0 if z <= 9e+16: tmp = (1.0 + (math.sqrt((1.0 + z)) + t_1)) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((0.5 * math.sqrt((1.0 / t))) + (t_1 - 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)) tmp = 0.0 if (z <= 9e+16) tmp = Float64(Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) + t_1)) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / t))) + Float64(t_1 - 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));
tmp = 0.0;
if (z <= 9e+16)
tmp = (1.0 + (sqrt((1.0 + z)) + t_1)) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((0.5 * sqrt((1.0 / t))) + (t_1 - 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]}, If[LessEqual[z, 9e+16], N[(N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - 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}\\
\mathbf{if}\;z \leq 9 \cdot 10^{+16}:\\
\;\;\;\;\left(1 + \left(\sqrt{1 + z} + t\_1\right)\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(0.5 \cdot \sqrt{\frac{1}{t}} + \left(t\_1 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 9e16Initial program 97.0%
+-commutative97.0%
associate-+r+97.0%
associate-+r-77.6%
associate-+l-65.0%
associate-+r-50.9%
Simplified50.9%
Taylor expanded in t around inf 17.2%
associate--l+21.5%
associate--l+21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in x around 0 15.1%
if 9e16 < z Initial program 86.4%
associate-+l+86.4%
associate-+l+86.4%
+-commutative86.4%
+-commutative86.4%
associate-+l-86.4%
+-commutative86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in t around inf 40.3%
+-commutative40.3%
Simplified40.3%
Taylor expanded in t around 0 42.2%
Final simplification29.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 x) (sqrt y))))
(if (<= z 3000000.0)
(+ (sqrt (+ x 1.0)) (+ 1.0 (- (sqrt (+ 1.0 z)) (+ (sqrt z) t_1))))
(+ 1.0 (+ (* 0.5 (sqrt (/ 1.0 z))) (- (sqrt (+ 1.0 y)) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double tmp;
if (z <= 3000000.0) {
tmp = sqrt((x + 1.0)) + (1.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1)));
} else {
tmp = 1.0 + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + y)) - t_1));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
if (z <= 3000000.0d0) then
tmp = sqrt((x + 1.0d0)) + (1.0d0 + (sqrt((1.0d0 + z)) - (sqrt(z) + t_1)))
else
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / z))) + (sqrt((1.0d0 + y)) - t_1))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double tmp;
if (z <= 3000000.0) {
tmp = Math.sqrt((x + 1.0)) + (1.0 + (Math.sqrt((1.0 + z)) - (Math.sqrt(z) + t_1)));
} else {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / z))) + (Math.sqrt((1.0 + y)) - t_1));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) tmp = 0 if z <= 3000000.0: tmp = math.sqrt((x + 1.0)) + (1.0 + (math.sqrt((1.0 + z)) - (math.sqrt(z) + t_1))) else: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / z))) + (math.sqrt((1.0 + y)) - t_1)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) tmp = 0.0 if (z <= 3000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(1.0 + Float64(sqrt(Float64(1.0 + z)) - Float64(sqrt(z) + t_1)))); else tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(sqrt(Float64(1.0 + y)) - t_1))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
tmp = 0.0;
if (z <= 3000000.0)
tmp = sqrt((x + 1.0)) + (1.0 + (sqrt((1.0 + z)) - (sqrt(z) + t_1)));
else
tmp = 1.0 + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + y)) - t_1));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
\mathbf{if}\;z \leq 3000000:\\
\;\;\;\;\sqrt{x + 1} + \left(1 + \left(\sqrt{1 + z} - \left(\sqrt{z} + t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - t\_1\right)\right)\\
\end{array}
\end{array}
if z < 3e6Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-78.4%
associate-+l-65.4%
associate-+r-51.0%
Simplified51.0%
Taylor expanded in t around inf 17.1%
associate--l+21.4%
associate--l+21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in y around 0 14.8%
associate--l+14.8%
associate-+r+14.8%
+-commutative14.8%
Simplified14.8%
if 3e6 < z Initial program 85.5%
+-commutative85.5%
associate-+r+85.5%
associate-+r-63.8%
associate-+l-50.7%
associate-+r-50.7%
Simplified30.0%
Taylor expanded in t around inf 5.2%
associate--l+26.6%
associate--l+26.0%
associate-+r+26.0%
Simplified26.0%
Taylor expanded in x around 0 4.8%
Taylor expanded in z around inf 18.5%
associate--l+37.0%
+-commutative37.0%
associate--l+37.1%
Simplified37.1%
Final simplification26.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 (<= z 3000000.0)
(- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z))))
(+
1.0
(+ (* 0.5 (sqrt (/ 1.0 z))) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3000000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = 1.0 + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 3000000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = 1.0d0 + ((0.5d0 * sqrt((1.0d0 / z))) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3000000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = 1.0 + ((0.5 * Math.sqrt((1.0 / z))) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 3000000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = 1.0 + ((0.5 * math.sqrt((1.0 / z))) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 3000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(1.0 + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 3000000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = 1.0 + ((0.5 * sqrt((1.0 / z))) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 3000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if z < 3e6Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-78.4%
associate-+l-65.4%
associate-+r-51.0%
Simplified51.0%
Taylor expanded in t around inf 17.1%
associate--l+21.4%
associate--l+21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in x around 0 14.9%
Taylor expanded in y around 0 12.7%
+-commutative12.7%
Simplified12.7%
if 3e6 < z Initial program 85.5%
+-commutative85.5%
associate-+r+85.5%
associate-+r-63.8%
associate-+l-50.7%
associate-+r-50.7%
Simplified30.0%
Taylor expanded in t around inf 5.2%
associate--l+26.6%
associate--l+26.0%
associate-+r+26.0%
Simplified26.0%
Taylor expanded in x around 0 4.8%
Taylor expanded in z around inf 18.5%
associate--l+37.0%
+-commutative37.0%
associate--l+37.1%
Simplified37.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 (<= z 75000000000.0) (- (+ (sqrt (+ 1.0 z)) 2.0) (+ (sqrt x) (+ (sqrt y) (sqrt z)))) (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 75000000000.0) {
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
} else {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 75000000000.0d0) then
tmp = (sqrt((1.0d0 + z)) + 2.0d0) - (sqrt(x) + (sqrt(y) + sqrt(z)))
else
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 75000000000.0) {
tmp = (Math.sqrt((1.0 + z)) + 2.0) - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z)));
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 75000000000.0: tmp = (math.sqrt((1.0 + z)) + 2.0) - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z))) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 75000000000.0) tmp = Float64(Float64(sqrt(Float64(1.0 + z)) + 2.0) - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z)))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 75000000000.0)
tmp = (sqrt((1.0 + z)) + 2.0) - (sqrt(x) + (sqrt(y) + sqrt(z)));
else
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 75000000000.0], N[(N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + 2.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 75000000000:\\
\;\;\;\;\left(\sqrt{1 + z} + 2\right) - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 7.5e10Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-78.4%
associate-+l-65.4%
associate-+r-51.0%
Simplified51.0%
Taylor expanded in t around inf 17.1%
associate--l+21.4%
associate--l+21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in x around 0 14.9%
Taylor expanded in y around 0 12.7%
+-commutative12.7%
Simplified12.7%
if 7.5e10 < z Initial program 85.5%
+-commutative85.5%
associate-+r+85.5%
associate-+r-63.8%
associate-+l-50.7%
associate-+r-50.7%
Simplified30.0%
Taylor expanded in t around inf 5.2%
associate--l+26.6%
associate--l+26.0%
associate-+r+26.0%
Simplified26.0%
Taylor expanded in z around inf 34.9%
Final simplification24.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z 66000000000.0) (+ (sqrt (+ 1.0 z)) (- 2.0 (+ (sqrt x) (+ (sqrt y) (sqrt z))))) (+ (sqrt (+ x 1.0)) (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 66000000000.0) {
tmp = sqrt((1.0 + z)) + (2.0 - (sqrt(x) + (sqrt(y) + sqrt(z))));
} else {
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 66000000000.0d0) then
tmp = sqrt((1.0d0 + z)) + (2.0d0 - (sqrt(x) + (sqrt(y) + sqrt(z))))
else
tmp = sqrt((x + 1.0d0)) + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 66000000000.0) {
tmp = Math.sqrt((1.0 + z)) + (2.0 - (Math.sqrt(x) + (Math.sqrt(y) + Math.sqrt(z))));
} else {
tmp = Math.sqrt((x + 1.0)) + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= 66000000000.0: tmp = math.sqrt((1.0 + z)) + (2.0 - (math.sqrt(x) + (math.sqrt(y) + math.sqrt(z)))) else: tmp = math.sqrt((x + 1.0)) + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= 66000000000.0) tmp = Float64(sqrt(Float64(1.0 + z)) + Float64(2.0 - Float64(sqrt(x) + Float64(sqrt(y) + sqrt(z))))); else tmp = Float64(sqrt(Float64(x + 1.0)) + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= 66000000000.0)
tmp = sqrt((1.0 + z)) + (2.0 - (sqrt(x) + (sqrt(y) + sqrt(z))));
else
tmp = sqrt((x + 1.0)) + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, 66000000000.0], N[(N[Sqrt[N[(1.0 + z), $MachinePrecision]], $MachinePrecision] + N[(2.0 - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[y], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 66000000000:\\
\;\;\;\;\sqrt{1 + z} + \left(2 - \left(\sqrt{x} + \left(\sqrt{y} + \sqrt{z}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 6.6e10Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-78.4%
associate-+l-65.4%
associate-+r-51.0%
Simplified51.0%
Taylor expanded in t around inf 17.1%
associate--l+21.4%
associate--l+21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in x around 0 14.9%
Taylor expanded in y around 0 12.7%
+-commutative12.7%
associate--l+12.7%
Simplified12.7%
if 6.6e10 < z Initial program 85.5%
+-commutative85.5%
associate-+r+85.5%
associate-+r-63.8%
associate-+l-50.7%
associate-+r-50.7%
Simplified30.0%
Taylor expanded in t around inf 5.2%
associate--l+26.6%
associate--l+26.0%
associate-+r+26.0%
Simplified26.0%
Taylor expanded in z around inf 34.9%
Final simplification24.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 (+ x 1.0))) (t_2 (sqrt (+ 1.0 y))))
(if (<= z 0.66)
(+ t_1 (- (+ 1.0 t_2) (sqrt y)))
(+ t_1 (- t_2 (+ (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((x + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 0.66) {
tmp = t_1 + ((1.0 + t_2) - sqrt(y));
} else {
tmp = t_1 + (t_2 - (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) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if (z <= 0.66d0) then
tmp = t_1 + ((1.0d0 + t_2) - sqrt(y))
else
tmp = t_1 + (t_2 - (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((x + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 0.66) {
tmp = t_1 + ((1.0 + t_2) - Math.sqrt(y));
} else {
tmp = t_1 + (t_2 - (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((x + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 0.66: tmp = t_1 + ((1.0 + t_2) - math.sqrt(y)) else: tmp = t_1 + (t_2 - (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(x + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 0.66) tmp = Float64(t_1 + Float64(Float64(1.0 + t_2) - sqrt(y))); else tmp = Float64(t_1 + Float64(t_2 - 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((x + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 0.66)
tmp = t_1 + ((1.0 + t_2) - sqrt(y));
else
tmp = t_1 + (t_2 - (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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.66], N[(t$95$1 + N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 - 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{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.66:\\
\;\;\;\;t\_1 + \left(\left(1 + t\_2\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 0.660000000000000031Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-79.1%
associate-+l-66.4%
associate-+r-51.8%
Simplified51.8%
Taylor expanded in t around inf 17.4%
associate--l+21.6%
associate--l+21.6%
associate-+r+21.6%
Simplified21.6%
Taylor expanded in y around inf 21.1%
Taylor expanded in z around 0 21.1%
if 0.660000000000000031 < z Initial program 85.9%
+-commutative85.9%
associate-+r+85.9%
associate-+r-63.6%
associate-+l-50.3%
associate-+r-50.0%
Simplified29.9%
Taylor expanded in t around inf 5.3%
associate--l+26.3%
associate--l+25.7%
associate-+r+25.7%
Simplified25.7%
Taylor expanded in z around inf 34.3%
Final simplification28.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ x 1.0))) (t_2 (sqrt (+ 1.0 y)))) (if (<= z 0.56) (+ t_1 (- (+ 1.0 t_2) (sqrt y))) (+ t_1 (- t_2 (sqrt y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((1.0 + y));
double tmp;
if (z <= 0.56) {
tmp = t_1 + ((1.0 + t_2) - sqrt(y));
} else {
tmp = t_1 + (t_2 - sqrt(y));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((1.0d0 + y))
if (z <= 0.56d0) then
tmp = t_1 + ((1.0d0 + t_2) - sqrt(y))
else
tmp = t_1 + (t_2 - sqrt(y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((1.0 + y));
double tmp;
if (z <= 0.56) {
tmp = t_1 + ((1.0 + t_2) - Math.sqrt(y));
} else {
tmp = t_1 + (t_2 - Math.sqrt(y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((1.0 + y)) tmp = 0 if z <= 0.56: tmp = t_1 + ((1.0 + t_2) - math.sqrt(y)) else: tmp = t_1 + (t_2 - math.sqrt(y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(1.0 + y)) tmp = 0.0 if (z <= 0.56) tmp = Float64(t_1 + Float64(Float64(1.0 + t_2) - sqrt(y))); else tmp = Float64(t_1 + Float64(t_2 - sqrt(y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((1.0 + y));
tmp = 0.0;
if (z <= 0.56)
tmp = t_1 + ((1.0 + t_2) - sqrt(y));
else
tmp = t_1 + (t_2 - sqrt(y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.56], N[(t$95$1 + N[(N[(1.0 + t$95$2), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{1 + y}\\
\mathbf{if}\;z \leq 0.56:\\
\;\;\;\;t\_1 + \left(\left(1 + t\_2\right) - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(t\_2 - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 0.56000000000000005Initial program 98.2%
+-commutative98.2%
associate-+r+98.2%
associate-+r-79.1%
associate-+l-66.4%
associate-+r-51.8%
Simplified51.8%
Taylor expanded in t around inf 17.4%
associate--l+21.6%
associate--l+21.6%
associate-+r+21.6%
Simplified21.6%
Taylor expanded in y around inf 21.1%
Taylor expanded in z around 0 21.1%
if 0.56000000000000005 < z Initial program 85.9%
+-commutative85.9%
associate-+r+85.9%
associate-+r-63.6%
associate-+l-50.3%
associate-+r-50.0%
Simplified29.9%
Taylor expanded in t around inf 5.3%
associate--l+26.3%
associate--l+25.7%
associate-+r+25.7%
Simplified25.7%
Taylor expanded in y around inf 34.4%
mul-1-neg34.4%
Simplified34.4%
Final simplification28.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 3e+17) (+ 1.0 (- (sqrt (+ 1.0 y)) (+ (sqrt x) (sqrt y)))) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3e+17) {
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
} else {
tmp = sqrt((x + 1.0)) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3d+17) then
tmp = 1.0d0 + (sqrt((1.0d0 + y)) - (sqrt(x) + sqrt(y)))
else
tmp = sqrt((x + 1.0d0)) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3e+17) {
tmp = 1.0 + (Math.sqrt((1.0 + y)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3e+17: tmp = 1.0 + (math.sqrt((1.0 + y)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3e+17) tmp = Float64(1.0 + Float64(sqrt(Float64(1.0 + y)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3e+17)
tmp = 1.0 + (sqrt((1.0 + y)) - (sqrt(x) + sqrt(y)));
else
tmp = sqrt((x + 1.0)) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3e+17], N[(1.0 + N[(N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(\sqrt{1 + y} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if y < 3e17Initial program 95.0%
+-commutative95.0%
associate-+r+95.0%
associate-+r-95.0%
associate-+l-95.0%
associate-+r-95.0%
Simplified75.3%
Taylor expanded in t around inf 17.7%
associate--l+22.9%
associate--l+29.0%
associate-+r+29.0%
Simplified29.0%
Taylor expanded in x around 0 15.7%
add-cube-cbrt15.7%
pow315.7%
Applied egg-rr15.7%
Taylor expanded in z around inf 20.6%
associate--l+20.6%
+-commutative20.6%
Simplified20.6%
if 3e17 < y Initial program 88.0%
+-commutative88.0%
associate-+r+88.0%
associate-+r-46.1%
associate-+l-19.9%
associate-+r-6.0%
Simplified4.2%
Taylor expanded in t around inf 3.9%
associate--l+25.4%
associate--l+18.6%
associate-+r+18.6%
Simplified18.6%
Taylor expanded in x around inf 5.8%
neg-mul-15.8%
Simplified5.8%
Taylor expanded in x around inf 23.7%
neg-mul-123.7%
Simplified23.7%
Final simplification22.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x)))) (if (<= y 3.8) (+ 1.0 t_1) t_1)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (y <= 3.8) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (y <= 3.8d0) then
tmp = 1.0d0 + t_1
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (y <= 3.8) {
tmp = 1.0 + t_1;
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if y <= 3.8: tmp = 1.0 + t_1 else: tmp = t_1 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (y <= 3.8) tmp = Float64(1.0 + t_1); else tmp = t_1; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (y <= 3.8)
tmp = 1.0 + t_1;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.8], N[(1.0 + t$95$1), $MachinePrecision], t$95$1]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;y \leq 3.8:\\
\;\;\;\;1 + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < 3.7999999999999998Initial program 96.2%
+-commutative96.2%
associate-+r+96.2%
associate-+r-96.1%
associate-+l-96.1%
associate-+r-96.1%
Simplified77.6%
Taylor expanded in t around inf 18.4%
associate--l+22.5%
associate--l+30.0%
associate-+r+30.0%
Simplified30.0%
Taylor expanded in x around inf 21.1%
neg-mul-121.1%
Simplified21.1%
Taylor expanded in y around 0 21.1%
associate--l+33.1%
Simplified33.1%
if 3.7999999999999998 < y Initial program 87.3%
+-commutative87.3%
associate-+r+87.3%
associate-+r-47.6%
associate-+l-22.7%
associate-+r-9.6%
Simplified5.8%
Taylor expanded in t around inf 4.0%
associate--l+25.7%
associate--l+18.2%
associate-+r+18.2%
Simplified18.2%
Taylor expanded in x around inf 6.1%
neg-mul-16.1%
Simplified6.1%
Taylor expanded in x around inf 24.1%
neg-mul-124.1%
Simplified24.1%
Final simplification28.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((x + 1.0)) - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((x + 1.0)) - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((x + 1.0)) - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Initial program 91.6%
+-commutative91.6%
associate-+r+91.6%
associate-+r-70.7%
associate-+l-57.7%
associate-+r-50.8%
Simplified40.0%
Taylor expanded in t around inf 10.9%
associate--l+24.2%
associate--l+23.8%
associate-+r+23.8%
Simplified23.8%
Taylor expanded in x around inf 13.2%
neg-mul-113.2%
Simplified13.2%
Taylor expanded in x around inf 17.7%
neg-mul-117.7%
Simplified17.7%
Final simplification17.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt (+ 1.0 y)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt((1.0 + y));
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((1.0d0 + y))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt((1.0 + y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt((1.0 + y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(Float64(1.0 + y)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt((1.0 + y));
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[N[(1.0 + y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{1 + y}
\end{array}
Initial program 91.6%
+-commutative91.6%
associate-+r+91.6%
associate-+r-70.7%
associate-+l-57.7%
associate-+r-50.8%
Simplified40.0%
Taylor expanded in t around inf 10.9%
associate--l+24.2%
associate--l+23.8%
associate-+r+23.8%
Simplified23.8%
Taylor expanded in x around inf 13.2%
neg-mul-113.2%
Simplified13.2%
Taylor expanded in x around inf 14.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (sqrt y))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return sqrt(y);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(y)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return Math.sqrt(y);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return math.sqrt(y)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return sqrt(y) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = sqrt(y);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[Sqrt[y], $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\sqrt{y}
\end{array}
Initial program 91.6%
+-commutative91.6%
associate-+r+91.6%
associate-+r-70.7%
associate-+l-57.7%
associate-+r-50.8%
Simplified40.0%
Taylor expanded in t around inf 10.9%
associate--l+24.2%
associate--l+23.8%
associate-+r+23.8%
Simplified23.8%
Taylor expanded in x around inf 13.2%
neg-mul-113.2%
Simplified13.2%
Taylor expanded in y around inf 6.9%
(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 2024108
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(+ (+ (+ (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))) (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y)))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))