
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0)))
(t_2 (sqrt (+ z 1.0)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (- t_3 (sqrt x)))
(t_5 (+ (- t_2 (sqrt z)) (+ t_4 (- t_1 (sqrt y)))))
(t_6 (sqrt (+ t 1.0))))
(if (<= t_5 0.004)
(+
(/ 1.0 (+ t_3 (sqrt x)))
(- (* 0.5 (sqrt (/ 1.0 y))) (- (+ (sqrt t) (- (sqrt z) t_2)) t_6)))
(if (<= t_5 2.6)
(+ t_4 (+ (/ 1.0 (+ t_1 (sqrt y))) (/ 1.0 (+ t_2 (sqrt z)))))
(+ t_1 (+ (+ t_2 (- t_4 (sqrt z))) (- (- t_6 (sqrt t)) (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y + 1.0));
double t_2 = sqrt((z + 1.0));
double t_3 = sqrt((x + 1.0));
double t_4 = t_3 - sqrt(x);
double t_5 = (t_2 - sqrt(z)) + (t_4 + (t_1 - sqrt(y)));
double t_6 = sqrt((t + 1.0));
double tmp;
if (t_5 <= 0.004) {
tmp = (1.0 / (t_3 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) - ((sqrt(t) + (sqrt(z) - t_2)) - t_6));
} else if (t_5 <= 2.6) {
tmp = t_4 + ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_2 + sqrt(z))));
} else {
tmp = t_1 + ((t_2 + (t_4 - sqrt(z))) + ((t_6 - sqrt(t)) - 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((y + 1.0d0))
t_2 = sqrt((z + 1.0d0))
t_3 = sqrt((x + 1.0d0))
t_4 = t_3 - sqrt(x)
t_5 = (t_2 - sqrt(z)) + (t_4 + (t_1 - sqrt(y)))
t_6 = sqrt((t + 1.0d0))
if (t_5 <= 0.004d0) then
tmp = (1.0d0 / (t_3 + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) - ((sqrt(t) + (sqrt(z) - t_2)) - t_6))
else if (t_5 <= 2.6d0) then
tmp = t_4 + ((1.0d0 / (t_1 + sqrt(y))) + (1.0d0 / (t_2 + sqrt(z))))
else
tmp = t_1 + ((t_2 + (t_4 - sqrt(z))) + ((t_6 - sqrt(t)) - 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((y + 1.0));
double t_2 = Math.sqrt((z + 1.0));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = t_3 - Math.sqrt(x);
double t_5 = (t_2 - Math.sqrt(z)) + (t_4 + (t_1 - Math.sqrt(y)));
double t_6 = Math.sqrt((t + 1.0));
double tmp;
if (t_5 <= 0.004) {
tmp = (1.0 / (t_3 + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) - ((Math.sqrt(t) + (Math.sqrt(z) - t_2)) - t_6));
} else if (t_5 <= 2.6) {
tmp = t_4 + ((1.0 / (t_1 + Math.sqrt(y))) + (1.0 / (t_2 + Math.sqrt(z))));
} else {
tmp = t_1 + ((t_2 + (t_4 - Math.sqrt(z))) + ((t_6 - Math.sqrt(t)) - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((y + 1.0)) t_2 = math.sqrt((z + 1.0)) t_3 = math.sqrt((x + 1.0)) t_4 = t_3 - math.sqrt(x) t_5 = (t_2 - math.sqrt(z)) + (t_4 + (t_1 - math.sqrt(y))) t_6 = math.sqrt((t + 1.0)) tmp = 0 if t_5 <= 0.004: tmp = (1.0 / (t_3 + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) - ((math.sqrt(t) + (math.sqrt(z) - t_2)) - t_6)) elif t_5 <= 2.6: tmp = t_4 + ((1.0 / (t_1 + math.sqrt(y))) + (1.0 / (t_2 + math.sqrt(z)))) else: tmp = t_1 + ((t_2 + (t_4 - math.sqrt(z))) + ((t_6 - math.sqrt(t)) - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(y + 1.0)) t_2 = sqrt(Float64(z + 1.0)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(t_3 - sqrt(x)) t_5 = Float64(Float64(t_2 - sqrt(z)) + Float64(t_4 + Float64(t_1 - sqrt(y)))) t_6 = sqrt(Float64(t + 1.0)) tmp = 0.0 if (t_5 <= 0.004) tmp = Float64(Float64(1.0 / Float64(t_3 + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - Float64(Float64(sqrt(t) + Float64(sqrt(z) - t_2)) - t_6))); elseif (t_5 <= 2.6) tmp = Float64(t_4 + Float64(Float64(1.0 / Float64(t_1 + sqrt(y))) + Float64(1.0 / Float64(t_2 + sqrt(z))))); else tmp = Float64(t_1 + Float64(Float64(t_2 + Float64(t_4 - sqrt(z))) + Float64(Float64(t_6 - sqrt(t)) - 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((y + 1.0));
t_2 = sqrt((z + 1.0));
t_3 = sqrt((x + 1.0));
t_4 = t_3 - sqrt(x);
t_5 = (t_2 - sqrt(z)) + (t_4 + (t_1 - sqrt(y)));
t_6 = sqrt((t + 1.0));
tmp = 0.0;
if (t_5 <= 0.004)
tmp = (1.0 / (t_3 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) - ((sqrt(t) + (sqrt(z) - t_2)) - t_6));
elseif (t_5 <= 2.6)
tmp = t_4 + ((1.0 / (t_1 + sqrt(y))) + (1.0 / (t_2 + sqrt(z))));
else
tmp = t_1 + ((t_2 + (t_4 - sqrt(z))) + ((t_6 - sqrt(t)) - 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z + 1.0), $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[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$5, 0.004], N[(N[(1.0 / N[(t$95$3 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] - t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2.6], N[(t$95$4 + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(t$95$2 + N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$6 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{z + 1}\\
t_3 := \sqrt{x + 1}\\
t_4 := t\_3 - \sqrt{x}\\
t_5 := \left(t\_2 - \sqrt{z}\right) + \left(t\_4 + \left(t\_1 - \sqrt{y}\right)\right)\\
t_6 := \sqrt{t + 1}\\
\mathbf{if}\;t\_5 \leq 0.004:\\
\;\;\;\;\frac{1}{t\_3 + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \left(\left(\sqrt{t} + \left(\sqrt{z} - t\_2\right)\right) - t\_6\right)\right)\\
\mathbf{elif}\;t\_5 \leq 2.6:\\
\;\;\;\;t\_4 + \left(\frac{1}{t\_1 + \sqrt{y}} + \frac{1}{t\_2 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(t\_2 + \left(t\_4 - \sqrt{z}\right)\right) + \left(\left(t\_6 - \sqrt{t}\right) - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 0.0040000000000000001Initial program 56.3%
associate-+l+56.3%
associate-+l+56.3%
+-commutative56.3%
+-commutative56.3%
associate-+l-52.1%
+-commutative52.1%
+-commutative52.1%
Simplified52.1%
flip--52.1%
add-sqr-sqrt25.3%
+-commutative25.3%
add-sqr-sqrt52.1%
+-commutative52.1%
Applied egg-rr52.1%
associate--l+57.6%
+-inverses57.6%
metadata-eval57.6%
Simplified57.6%
Taylor expanded in y around inf 66.6%
if 0.0040000000000000001 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) < 2.60000000000000009Initial program 96.3%
associate-+l+96.3%
associate-+l+96.3%
+-commutative96.3%
+-commutative96.3%
associate-+l-79.1%
+-commutative79.1%
+-commutative79.1%
Simplified79.1%
add-log-exp79.1%
associate--r-96.3%
+-commutative96.3%
Applied egg-rr96.3%
flip--96.5%
add-sqr-sqrt78.6%
add-sqr-sqrt96.8%
Applied egg-rr96.8%
associate--l+97.2%
+-inverses97.2%
metadata-eval97.2%
+-commutative97.2%
Simplified97.2%
flip--97.6%
add-sqr-sqrt73.8%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate--l+98.2%
+-inverses98.2%
metadata-eval98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in t around inf 51.3%
if 2.60000000000000009 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y 1)) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z))) Initial program 100.0%
+-commutative100.0%
associate-+r+100.0%
associate-+r-100.0%
associate-+l-100.0%
associate-+r-100.0%
Simplified100.0%
Final simplification59.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 (/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(t_2 (sqrt (+ x 1.0)))
(t_3 (- t_2 (sqrt x)))
(t_4 (sqrt (+ t 1.0)))
(t_5 (sqrt (+ z 1.0))))
(if (<= t_3 0.004)
(+ (/ 1.0 (+ t_2 (sqrt x))) (+ t_1 (+ t_4 (- (- t_5 (sqrt z)) (sqrt t)))))
(+
t_3
(+ t_1 (log (exp (+ (- t_4 (sqrt t)) (/ 1.0 (+ t_5 (sqrt z)))))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (sqrt((y + 1.0)) + sqrt(y));
double t_2 = sqrt((x + 1.0));
double t_3 = t_2 - sqrt(x);
double t_4 = sqrt((t + 1.0));
double t_5 = sqrt((z + 1.0));
double tmp;
if (t_3 <= 0.004) {
tmp = (1.0 / (t_2 + sqrt(x))) + (t_1 + (t_4 + ((t_5 - sqrt(z)) - sqrt(t))));
} else {
tmp = t_3 + (t_1 + log(exp(((t_4 - sqrt(t)) + (1.0 / (t_5 + sqrt(z)))))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_1 = 1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y))
t_2 = sqrt((x + 1.0d0))
t_3 = t_2 - sqrt(x)
t_4 = sqrt((t + 1.0d0))
t_5 = sqrt((z + 1.0d0))
if (t_3 <= 0.004d0) then
tmp = (1.0d0 / (t_2 + sqrt(x))) + (t_1 + (t_4 + ((t_5 - sqrt(z)) - sqrt(t))))
else
tmp = t_3 + (t_1 + log(exp(((t_4 - sqrt(t)) + (1.0d0 / (t_5 + sqrt(z)))))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = t_2 - Math.sqrt(x);
double t_4 = Math.sqrt((t + 1.0));
double t_5 = Math.sqrt((z + 1.0));
double tmp;
if (t_3 <= 0.004) {
tmp = (1.0 / (t_2 + Math.sqrt(x))) + (t_1 + (t_4 + ((t_5 - Math.sqrt(z)) - Math.sqrt(t))));
} else {
tmp = t_3 + (t_1 + Math.log(Math.exp(((t_4 - Math.sqrt(t)) + (1.0 / (t_5 + Math.sqrt(z)))))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = 1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)) t_2 = math.sqrt((x + 1.0)) t_3 = t_2 - math.sqrt(x) t_4 = math.sqrt((t + 1.0)) t_5 = math.sqrt((z + 1.0)) tmp = 0 if t_3 <= 0.004: tmp = (1.0 / (t_2 + math.sqrt(x))) + (t_1 + (t_4 + ((t_5 - math.sqrt(z)) - math.sqrt(t)))) else: tmp = t_3 + (t_1 + math.log(math.exp(((t_4 - math.sqrt(t)) + (1.0 / (t_5 + math.sqrt(z))))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y))) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(t_2 - sqrt(x)) t_4 = sqrt(Float64(t + 1.0)) t_5 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t_3 <= 0.004) tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(t_1 + Float64(t_4 + Float64(Float64(t_5 - sqrt(z)) - sqrt(t))))); else tmp = Float64(t_3 + Float64(t_1 + log(exp(Float64(Float64(t_4 - sqrt(t)) + Float64(1.0 / Float64(t_5 + sqrt(z)))))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = 1.0 / (sqrt((y + 1.0)) + sqrt(y));
t_2 = sqrt((x + 1.0));
t_3 = t_2 - sqrt(x);
t_4 = sqrt((t + 1.0));
t_5 = sqrt((z + 1.0));
tmp = 0.0;
if (t_3 <= 0.004)
tmp = (1.0 / (t_2 + sqrt(x))) + (t_1 + (t_4 + ((t_5 - sqrt(z)) - sqrt(t))));
else
tmp = t_3 + (t_1 + log(exp(((t_4 - sqrt(t)) + (1.0 / (t_5 + sqrt(z)))))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $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[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, 0.004], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(t$95$4 + N[(N[(t$95$5 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(t$95$1 + N[Log[N[Exp[N[(N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$5 + N[Sqrt[z], $MachinePrecision]), $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 := \frac{1}{\sqrt{y + 1} + \sqrt{y}}\\
t_2 := \sqrt{x + 1}\\
t_3 := t\_2 - \sqrt{x}\\
t_4 := \sqrt{t + 1}\\
t_5 := \sqrt{z + 1}\\
\mathbf{if}\;t\_3 \leq 0.004:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}} + \left(t\_1 + \left(t\_4 + \left(\left(t\_5 - \sqrt{z}\right) - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 + \left(t\_1 + \log \left(e^{\left(t\_4 - \sqrt{t}\right) + \frac{1}{t\_5 + \sqrt{z}}}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 0.0040000000000000001Initial program 88.2%
associate-+l+88.2%
associate-+l+88.2%
+-commutative88.2%
+-commutative88.2%
associate-+l-68.8%
+-commutative68.8%
+-commutative68.8%
Simplified68.8%
flip--68.9%
add-sqr-sqrt37.6%
+-commutative37.6%
add-sqr-sqrt69.3%
+-commutative69.3%
Applied egg-rr69.3%
associate--l+71.7%
+-inverses71.7%
metadata-eval71.7%
Simplified71.7%
flip--89.7%
add-sqr-sqrt69.8%
add-sqr-sqrt89.8%
Applied egg-rr71.7%
associate--l+91.8%
+-inverses91.8%
metadata-eval91.8%
+-commutative91.8%
Simplified73.6%
if 0.0040000000000000001 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 97.7%
associate-+l+97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
associate-+l-81.2%
+-commutative81.2%
+-commutative81.2%
Simplified81.2%
add-log-exp81.2%
associate--r-97.7%
+-commutative97.7%
Applied egg-rr97.7%
flip--97.8%
add-sqr-sqrt78.1%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
+-commutative98.4%
Simplified98.4%
flip--99.0%
add-sqr-sqrt74.8%
add-sqr-sqrt99.2%
Applied egg-rr99.2%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Final simplification86.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (sqrt (+ t 1.0)))
(t_3 (sqrt (+ z 1.0)))
(t_4 (- t_3 (sqrt z)))
(t_5 (sqrt (+ y 1.0))))
(if (<= t_4 2e-8)
(+
(/ 1.0 (+ t_1 (sqrt x)))
(+ (/ 1.0 (+ t_5 (sqrt y))) (+ t_2 (- t_4 (sqrt t)))))
(+
t_5
(+
(+ t_3 (- (- t_1 (sqrt x)) (sqrt z)))
(- (- t_2 (sqrt t)) (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((t + 1.0));
double t_3 = sqrt((z + 1.0));
double t_4 = t_3 - sqrt(z);
double t_5 = sqrt((y + 1.0));
double tmp;
if (t_4 <= 2e-8) {
tmp = (1.0 / (t_1 + sqrt(x))) + ((1.0 / (t_5 + sqrt(y))) + (t_2 + (t_4 - sqrt(t))));
} else {
tmp = t_5 + ((t_3 + ((t_1 - sqrt(x)) - sqrt(z))) + ((t_2 - sqrt(t)) - 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) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((t + 1.0d0))
t_3 = sqrt((z + 1.0d0))
t_4 = t_3 - sqrt(z)
t_5 = sqrt((y + 1.0d0))
if (t_4 <= 2d-8) then
tmp = (1.0d0 / (t_1 + sqrt(x))) + ((1.0d0 / (t_5 + sqrt(y))) + (t_2 + (t_4 - sqrt(t))))
else
tmp = t_5 + ((t_3 + ((t_1 - sqrt(x)) - sqrt(z))) + ((t_2 - sqrt(t)) - 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((t + 1.0));
double t_3 = Math.sqrt((z + 1.0));
double t_4 = t_3 - Math.sqrt(z);
double t_5 = Math.sqrt((y + 1.0));
double tmp;
if (t_4 <= 2e-8) {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + ((1.0 / (t_5 + Math.sqrt(y))) + (t_2 + (t_4 - Math.sqrt(t))));
} else {
tmp = t_5 + ((t_3 + ((t_1 - Math.sqrt(x)) - Math.sqrt(z))) + ((t_2 - Math.sqrt(t)) - 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((t + 1.0)) t_3 = math.sqrt((z + 1.0)) t_4 = t_3 - math.sqrt(z) t_5 = math.sqrt((y + 1.0)) tmp = 0 if t_4 <= 2e-8: tmp = (1.0 / (t_1 + math.sqrt(x))) + ((1.0 / (t_5 + math.sqrt(y))) + (t_2 + (t_4 - math.sqrt(t)))) else: tmp = t_5 + ((t_3 + ((t_1 - math.sqrt(x)) - math.sqrt(z))) + ((t_2 - math.sqrt(t)) - 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(t + 1.0)) t_3 = sqrt(Float64(z + 1.0)) t_4 = Float64(t_3 - sqrt(z)) t_5 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (t_4 <= 2e-8) tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(Float64(1.0 / Float64(t_5 + sqrt(y))) + Float64(t_2 + Float64(t_4 - sqrt(t))))); else tmp = Float64(t_5 + Float64(Float64(t_3 + Float64(Float64(t_1 - sqrt(x)) - sqrt(z))) + Float64(Float64(t_2 - sqrt(t)) - 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((t + 1.0));
t_3 = sqrt((z + 1.0));
t_4 = t_3 - sqrt(z);
t_5 = sqrt((y + 1.0));
tmp = 0.0;
if (t_4 <= 2e-8)
tmp = (1.0 / (t_1 + sqrt(x))) + ((1.0 / (t_5 + sqrt(y))) + (t_2 + (t_4 - sqrt(t))));
else
tmp = t_5 + ((t_3 + ((t_1 - sqrt(x)) - sqrt(z))) + ((t_2 - sqrt(t)) - 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[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, 2e-8], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$5 + N[(N[(t$95$3 + N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{t + 1}\\
t_3 := \sqrt{z + 1}\\
t_4 := t\_3 - \sqrt{z}\\
t_5 := \sqrt{y + 1}\\
\mathbf{if}\;t\_4 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(\frac{1}{t\_5 + \sqrt{y}} + \left(t\_2 + \left(t\_4 - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5 + \left(\left(t\_3 + \left(\left(t\_1 - \sqrt{x}\right) - \sqrt{z}\right)\right) + \left(\left(t\_2 - \sqrt{t}\right) - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) < 2e-8Initial program 88.9%
associate-+l+88.9%
associate-+l+88.9%
+-commutative88.9%
+-commutative88.9%
associate-+l-88.9%
+-commutative88.9%
+-commutative88.9%
Simplified88.9%
flip--88.9%
add-sqr-sqrt67.0%
+-commutative67.0%
add-sqr-sqrt88.9%
+-commutative88.9%
Applied egg-rr88.9%
associate--l+90.4%
+-inverses90.4%
metadata-eval90.4%
Simplified90.4%
flip--90.7%
add-sqr-sqrt67.1%
add-sqr-sqrt91.0%
Applied egg-rr90.8%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
Simplified92.9%
if 2e-8 < (-.f64 (sqrt.f64 (+.f64 z 1)) (sqrt.f64 z)) Initial program 96.0%
+-commutative96.0%
associate-+r+96.0%
associate-+r-79.0%
associate-+l-68.7%
associate-+r-54.1%
Simplified54.1%
Final simplification71.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 (+ t 1.0))) (t_2 (sqrt (+ z 1.0))) (t_3 (sqrt (+ y 1.0))))
(if (<= z 3.2e+27)
(+
(- 1.0 (sqrt x))
(+
(log (exp (+ (- t_1 (sqrt t)) (/ 1.0 (+ t_2 (sqrt z))))))
(- t_3 (sqrt y))))
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(+ (/ 1.0 (+ t_3 (sqrt y))) (+ t_1 (- (- t_2 (sqrt z)) (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((t + 1.0));
double t_2 = sqrt((z + 1.0));
double t_3 = sqrt((y + 1.0));
double tmp;
if (z <= 3.2e+27) {
tmp = (1.0 - sqrt(x)) + (log(exp(((t_1 - sqrt(t)) + (1.0 / (t_2 + sqrt(z)))))) + (t_3 - sqrt(y)));
} else {
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((1.0 / (t_3 + sqrt(y))) + (t_1 + ((t_2 - sqrt(z)) - sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((t + 1.0d0))
t_2 = sqrt((z + 1.0d0))
t_3 = sqrt((y + 1.0d0))
if (z <= 3.2d+27) then
tmp = (1.0d0 - sqrt(x)) + (log(exp(((t_1 - sqrt(t)) + (1.0d0 / (t_2 + sqrt(z)))))) + (t_3 - sqrt(y)))
else
tmp = (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + ((1.0d0 / (t_3 + sqrt(y))) + (t_1 + ((t_2 - sqrt(z)) - sqrt(t))))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((t + 1.0));
double t_2 = Math.sqrt((z + 1.0));
double t_3 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 3.2e+27) {
tmp = (1.0 - Math.sqrt(x)) + (Math.log(Math.exp(((t_1 - Math.sqrt(t)) + (1.0 / (t_2 + Math.sqrt(z)))))) + (t_3 - Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + ((1.0 / (t_3 + Math.sqrt(y))) + (t_1 + ((t_2 - Math.sqrt(z)) - Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((t + 1.0)) t_2 = math.sqrt((z + 1.0)) t_3 = math.sqrt((y + 1.0)) tmp = 0 if z <= 3.2e+27: tmp = (1.0 - math.sqrt(x)) + (math.log(math.exp(((t_1 - math.sqrt(t)) + (1.0 / (t_2 + math.sqrt(z)))))) + (t_3 - math.sqrt(y))) else: tmp = (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + ((1.0 / (t_3 + math.sqrt(y))) + (t_1 + ((t_2 - math.sqrt(z)) - math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(t + 1.0)) t_2 = sqrt(Float64(z + 1.0)) t_3 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 3.2e+27) tmp = Float64(Float64(1.0 - sqrt(x)) + Float64(log(exp(Float64(Float64(t_1 - sqrt(t)) + Float64(1.0 / Float64(t_2 + sqrt(z)))))) + Float64(t_3 - sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(Float64(1.0 / Float64(t_3 + sqrt(y))) + Float64(t_1 + Float64(Float64(t_2 - sqrt(z)) - sqrt(t))))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((t + 1.0));
t_2 = sqrt((z + 1.0));
t_3 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 3.2e+27)
tmp = (1.0 - sqrt(x)) + (log(exp(((t_1 - sqrt(t)) + (1.0 / (t_2 + sqrt(z)))))) + (t_3 - sqrt(y)));
else
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((1.0 / (t_3 + sqrt(y))) + (t_1 + ((t_2 - sqrt(z)) - sqrt(t))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 3.2e+27], N[(N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Log[N[Exp[N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$2 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(N[(t$95$2 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{t + 1}\\
t_2 := \sqrt{z + 1}\\
t_3 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 3.2 \cdot 10^{+27}:\\
\;\;\;\;\left(1 - \sqrt{x}\right) + \left(\log \left(e^{\left(t\_1 - \sqrt{t}\right) + \frac{1}{t\_2 + \sqrt{z}}}\right) + \left(t\_3 - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \left(\frac{1}{t\_3 + \sqrt{y}} + \left(t\_1 + \left(\left(t\_2 - \sqrt{z}\right) - \sqrt{t}\right)\right)\right)\\
\end{array}
\end{array}
if z < 3.20000000000000015e27Initial program 94.1%
associate-+l+94.1%
associate-+l+94.1%
+-commutative94.1%
+-commutative94.1%
associate-+l-63.2%
+-commutative63.2%
+-commutative63.2%
Simplified63.2%
add-log-exp63.2%
associate--r-94.1%
+-commutative94.1%
Applied egg-rr94.1%
flip--94.5%
add-sqr-sqrt94.2%
add-sqr-sqrt95.1%
Applied egg-rr95.1%
associate--l+96.0%
+-inverses96.0%
metadata-eval96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in x around 0 46.2%
if 3.20000000000000015e27 < z Initial program 91.3%
associate-+l+91.3%
associate-+l+91.3%
+-commutative91.3%
+-commutative91.3%
associate-+l-91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
flip--91.2%
add-sqr-sqrt68.7%
+-commutative68.7%
add-sqr-sqrt91.2%
+-commutative91.2%
Applied egg-rr91.2%
associate--l+92.7%
+-inverses92.7%
metadata-eval92.7%
Simplified92.7%
flip--91.5%
add-sqr-sqrt68.1%
add-sqr-sqrt91.8%
Applied egg-rr93.2%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
+-commutative94.2%
Simplified95.3%
Final simplification66.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 (+ z 1.0))) (t_2 (sqrt (+ t 1.0))))
(if (<= (- t_2 (sqrt t)) 0.0)
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (/ 1.0 (+ t_1 (sqrt z))) (- (sqrt (+ y 1.0)) (sqrt y))))
(+ 2.0 (- (+ t_2 t_1) (+ (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((z + 1.0));
double t_2 = sqrt((t + 1.0));
double tmp;
if ((t_2 - sqrt(t)) <= 0.0) {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((1.0 / (t_1 + sqrt(z))) + (sqrt((y + 1.0)) - sqrt(y)));
} else {
tmp = 2.0 + ((t_2 + t_1) - (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) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((t + 1.0d0))
if ((t_2 - sqrt(t)) <= 0.0d0) then
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((1.0d0 / (t_1 + sqrt(z))) + (sqrt((y + 1.0d0)) - sqrt(y)))
else
tmp = 2.0d0 + ((t_2 + t_1) - (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((z + 1.0));
double t_2 = Math.sqrt((t + 1.0));
double tmp;
if ((t_2 - Math.sqrt(t)) <= 0.0) {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((1.0 / (t_1 + Math.sqrt(z))) + (Math.sqrt((y + 1.0)) - Math.sqrt(y)));
} else {
tmp = 2.0 + ((t_2 + t_1) - (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((z + 1.0)) t_2 = math.sqrt((t + 1.0)) tmp = 0 if (t_2 - math.sqrt(t)) <= 0.0: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((1.0 / (t_1 + math.sqrt(z))) + (math.sqrt((y + 1.0)) - math.sqrt(y))) else: tmp = 2.0 + ((t_2 + t_1) - (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(z + 1.0)) t_2 = sqrt(Float64(t + 1.0)) tmp = 0.0 if (Float64(t_2 - sqrt(t)) <= 0.0) tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(1.0 / Float64(t_1 + sqrt(z))) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y)))); else tmp = Float64(2.0 + Float64(Float64(t_2 + t_1) - Float64(sqrt(t) + Float64(Float64(sqrt(z) + 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((z + 1.0));
t_2 = sqrt((t + 1.0));
tmp = 0.0;
if ((t_2 - sqrt(t)) <= 0.0)
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((1.0 / (t_1 + sqrt(z))) + (sqrt((y + 1.0)) - sqrt(y)));
else
tmp = 2.0 + ((t_2 + t_1) - (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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(t$95$2 + t$95$1), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $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}
t_1 := \sqrt{z + 1}\\
t_2 := \sqrt{t + 1}\\
\mathbf{if}\;t\_2 - \sqrt{t} \leq 0:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\frac{1}{t\_1 + \sqrt{z}} + \left(\sqrt{y + 1} - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 + \left(\left(t\_2 + t\_1\right) - \left(\sqrt{t} + \left(\left(\sqrt{z} + \sqrt{x}\right) + \sqrt{y}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 t 1)) (sqrt.f64 t)) < 0.0Initial program 86.8%
associate-+l+86.8%
associate-+l+86.8%
+-commutative86.8%
+-commutative86.8%
associate-+l-42.9%
+-commutative42.9%
+-commutative42.9%
Simplified42.9%
add-log-exp42.9%
associate--r-86.8%
+-commutative86.8%
Applied egg-rr86.8%
flip--87.1%
add-sqr-sqrt72.1%
add-sqr-sqrt87.5%
Applied egg-rr87.5%
associate--l+88.4%
+-inverses88.4%
metadata-eval88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in t around inf 91.0%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 t 1)) (sqrt.f64 t)) Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-76.3%
associate-+l-56.9%
associate-+r-52.9%
Simplified44.5%
Taylor expanded in x around 0 23.8%
Taylor expanded in y around 0 14.2%
associate--l+27.0%
+-commutative27.0%
+-commutative27.0%
associate-+r+27.0%
+-commutative27.0%
associate-+r+27.0%
Simplified27.0%
Final simplification53.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 (+ t 1.0))) (t_2 (sqrt (+ z 1.0))))
(if (<= y 5600000000.0)
(+
(sqrt (+ y 1.0))
(+ (+ (- t_2 (+ (sqrt z) (sqrt x))) 1.0) (- (- t_1 (sqrt t)) (sqrt y))))
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(- (* 0.5 (sqrt (/ 1.0 y))) (- (+ (sqrt t) (- (sqrt z) t_2)) t_1))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((t + 1.0));
double t_2 = sqrt((z + 1.0));
double tmp;
if (y <= 5600000000.0) {
tmp = sqrt((y + 1.0)) + (((t_2 - (sqrt(z) + sqrt(x))) + 1.0) + ((t_1 - sqrt(t)) - sqrt(y)));
} else {
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) - ((sqrt(t) + (sqrt(z) - t_2)) - t_1));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((t + 1.0d0))
t_2 = sqrt((z + 1.0d0))
if (y <= 5600000000.0d0) then
tmp = sqrt((y + 1.0d0)) + (((t_2 - (sqrt(z) + sqrt(x))) + 1.0d0) + ((t_1 - sqrt(t)) - sqrt(y)))
else
tmp = (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) - ((sqrt(t) + (sqrt(z) - t_2)) - t_1))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((t + 1.0));
double t_2 = Math.sqrt((z + 1.0));
double tmp;
if (y <= 5600000000.0) {
tmp = Math.sqrt((y + 1.0)) + (((t_2 - (Math.sqrt(z) + Math.sqrt(x))) + 1.0) + ((t_1 - Math.sqrt(t)) - Math.sqrt(y)));
} else {
tmp = (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) - ((Math.sqrt(t) + (Math.sqrt(z) - t_2)) - t_1));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((t + 1.0)) t_2 = math.sqrt((z + 1.0)) tmp = 0 if y <= 5600000000.0: tmp = math.sqrt((y + 1.0)) + (((t_2 - (math.sqrt(z) + math.sqrt(x))) + 1.0) + ((t_1 - math.sqrt(t)) - math.sqrt(y))) else: tmp = (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) - ((math.sqrt(t) + (math.sqrt(z) - t_2)) - t_1)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(t + 1.0)) t_2 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (y <= 5600000000.0) tmp = Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(Float64(t_2 - Float64(sqrt(z) + sqrt(x))) + 1.0) + Float64(Float64(t_1 - sqrt(t)) - sqrt(y)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) - Float64(Float64(sqrt(t) + Float64(sqrt(z) - t_2)) - t_1))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((t + 1.0));
t_2 = sqrt((z + 1.0));
tmp = 0.0;
if (y <= 5600000000.0)
tmp = sqrt((y + 1.0)) + (((t_2 - (sqrt(z) + sqrt(x))) + 1.0) + ((t_1 - sqrt(t)) - sqrt(y)));
else
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) - ((sqrt(t) + (sqrt(z) - t_2)) - t_1));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 5600000000.0], N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(t$95$2 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] - t$95$2), $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{t + 1}\\
t_2 := \sqrt{z + 1}\\
\mathbf{if}\;y \leq 5600000000:\\
\;\;\;\;\sqrt{y + 1} + \left(\left(\left(t\_2 - \left(\sqrt{z} + \sqrt{x}\right)\right) + 1\right) + \left(\left(t\_1 - \sqrt{t}\right) - \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} - \left(\left(\sqrt{t} + \left(\sqrt{z} - t\_2\right)\right) - t\_1\right)\right)\\
\end{array}
\end{array}
if y < 5.6e9Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-97.1%
associate-+l-97.1%
associate-+r-97.1%
Simplified81.9%
Taylor expanded in x around 0 41.6%
associate--l+47.8%
Simplified47.8%
if 5.6e9 < y Initial program 88.4%
associate-+l+88.4%
associate-+l+88.4%
+-commutative88.4%
+-commutative88.4%
associate-+l-70.8%
+-commutative70.8%
+-commutative70.8%
Simplified70.8%
flip--70.8%
add-sqr-sqrt60.7%
+-commutative60.7%
add-sqr-sqrt71.2%
+-commutative71.2%
Applied egg-rr71.2%
associate--l+72.7%
+-inverses72.7%
metadata-eval72.7%
Simplified72.7%
Taylor expanded in y around inf 75.2%
Final simplification61.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 (+ z 1.0)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (- (sqrt (+ t 1.0)) (sqrt t)))
(t_4 (sqrt (+ y 1.0))))
(if (<= z 0.0028)
(+ t_4 (+ (+ (- t_1 (+ (sqrt z) (sqrt x))) 1.0) (- t_3 (sqrt y))))
(if (<= z 8.4e+108)
(+
(- t_2 (sqrt x))
(+ (/ 1.0 (+ t_4 (sqrt y))) (/ 1.0 (+ t_1 (sqrt z)))))
(+ (/ 1.0 (+ t_2 (sqrt x))) (+ t_3 (- t_4 (sqrt y))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt((t + 1.0)) - sqrt(t);
double t_4 = sqrt((y + 1.0));
double tmp;
if (z <= 0.0028) {
tmp = t_4 + (((t_1 - (sqrt(z) + sqrt(x))) + 1.0) + (t_3 - sqrt(y)));
} else if (z <= 8.4e+108) {
tmp = (t_2 - sqrt(x)) + ((1.0 / (t_4 + sqrt(y))) + (1.0 / (t_1 + sqrt(z))));
} else {
tmp = (1.0 / (t_2 + sqrt(x))) + (t_3 + (t_4 - 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) :: tmp
t_1 = sqrt((z + 1.0d0))
t_2 = sqrt((x + 1.0d0))
t_3 = sqrt((t + 1.0d0)) - sqrt(t)
t_4 = sqrt((y + 1.0d0))
if (z <= 0.0028d0) then
tmp = t_4 + (((t_1 - (sqrt(z) + sqrt(x))) + 1.0d0) + (t_3 - sqrt(y)))
else if (z <= 8.4d+108) then
tmp = (t_2 - sqrt(x)) + ((1.0d0 / (t_4 + sqrt(y))) + (1.0d0 / (t_1 + sqrt(z))))
else
tmp = (1.0d0 / (t_2 + sqrt(x))) + (t_3 + (t_4 - 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((z + 1.0));
double t_2 = Math.sqrt((x + 1.0));
double t_3 = Math.sqrt((t + 1.0)) - Math.sqrt(t);
double t_4 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 0.0028) {
tmp = t_4 + (((t_1 - (Math.sqrt(z) + Math.sqrt(x))) + 1.0) + (t_3 - Math.sqrt(y)));
} else if (z <= 8.4e+108) {
tmp = (t_2 - Math.sqrt(x)) + ((1.0 / (t_4 + Math.sqrt(y))) + (1.0 / (t_1 + Math.sqrt(z))));
} else {
tmp = (1.0 / (t_2 + Math.sqrt(x))) + (t_3 + (t_4 - Math.sqrt(y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) t_2 = math.sqrt((x + 1.0)) t_3 = math.sqrt((t + 1.0)) - math.sqrt(t) t_4 = math.sqrt((y + 1.0)) tmp = 0 if z <= 0.0028: tmp = t_4 + (((t_1 - (math.sqrt(z) + math.sqrt(x))) + 1.0) + (t_3 - math.sqrt(y))) elif z <= 8.4e+108: tmp = (t_2 - math.sqrt(x)) + ((1.0 / (t_4 + math.sqrt(y))) + (1.0 / (t_1 + math.sqrt(z)))) else: tmp = (1.0 / (t_2 + math.sqrt(x))) + (t_3 + (t_4 - math.sqrt(y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) t_2 = sqrt(Float64(x + 1.0)) t_3 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) t_4 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 0.0028) tmp = Float64(t_4 + Float64(Float64(Float64(t_1 - Float64(sqrt(z) + sqrt(x))) + 1.0) + Float64(t_3 - sqrt(y)))); elseif (z <= 8.4e+108) tmp = Float64(Float64(t_2 - sqrt(x)) + Float64(Float64(1.0 / Float64(t_4 + sqrt(y))) + Float64(1.0 / Float64(t_1 + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(t_2 + sqrt(x))) + Float64(t_3 + Float64(t_4 - 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((z + 1.0));
t_2 = sqrt((x + 1.0));
t_3 = sqrt((t + 1.0)) - sqrt(t);
t_4 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 0.0028)
tmp = t_4 + (((t_1 - (sqrt(z) + sqrt(x))) + 1.0) + (t_3 - sqrt(y)));
elseif (z <= 8.4e+108)
tmp = (t_2 - sqrt(x)) + ((1.0 / (t_4 + sqrt(y))) + (1.0 / (t_1 + sqrt(z))));
else
tmp = (1.0 / (t_2 + sqrt(x))) + (t_3 + (t_4 - 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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 0.0028], N[(t$95$4 + N[(N[(N[(t$95$1 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.4e+108], N[(N[(t$95$2 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$4 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(t$95$1 + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$2 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(t$95$4 - 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{z + 1}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{t + 1} - \sqrt{t}\\
t_4 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 0.0028:\\
\;\;\;\;t\_4 + \left(\left(\left(t\_1 - \left(\sqrt{z} + \sqrt{x}\right)\right) + 1\right) + \left(t\_3 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+108}:\\
\;\;\;\;\left(t\_2 - \sqrt{x}\right) + \left(\frac{1}{t\_4 + \sqrt{y}} + \frac{1}{t\_1 + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}} + \left(t\_3 + \left(t\_4 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 0.00279999999999999997Initial program 97.2%
+-commutative97.2%
associate-+r+97.2%
associate-+r-79.6%
associate-+l-69.5%
associate-+r-54.6%
Simplified54.6%
Taylor expanded in x around 0 27.8%
associate--l+27.8%
Simplified27.8%
if 0.00279999999999999997 < z < 8.40000000000000039e108Initial program 84.7%
associate-+l+84.7%
associate-+l+84.7%
+-commutative84.7%
+-commutative84.7%
associate-+l-78.2%
+-commutative78.2%
+-commutative78.2%
Simplified78.2%
add-log-exp78.2%
associate--r-84.7%
+-commutative84.7%
Applied egg-rr84.7%
flip--86.1%
add-sqr-sqrt61.1%
add-sqr-sqrt87.9%
Applied egg-rr87.9%
associate--l+90.9%
+-inverses90.9%
metadata-eval90.9%
+-commutative90.9%
Simplified90.9%
flip--90.9%
add-sqr-sqrt58.9%
add-sqr-sqrt91.0%
Applied egg-rr91.0%
associate--l+92.2%
+-inverses92.2%
metadata-eval92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in t around inf 49.1%
if 8.40000000000000039e108 < z Initial program 90.7%
associate-+l+90.7%
associate-+l+90.7%
+-commutative90.7%
+-commutative90.7%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
flip--90.7%
add-sqr-sqrt67.4%
+-commutative67.4%
add-sqr-sqrt90.7%
+-commutative90.7%
Applied egg-rr90.7%
associate--l+92.6%
+-inverses92.6%
metadata-eval92.6%
Simplified92.6%
Taylor expanded in z around inf 92.6%
+-commutative90.7%
Simplified92.6%
Final simplification51.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (- (sqrt (+ t 1.0)) (sqrt t)))
(t_3 (sqrt (+ y 1.0))))
(if (<= z 2.8e-20)
(+ t_3 (+ (- 2.0 (+ (sqrt z) (sqrt x))) (- t_2 (sqrt y))))
(if (<= z 3.2e+108)
(+
(- t_1 (sqrt x))
(+ (/ 1.0 (+ t_3 (sqrt y))) (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z)))))
(+ (/ 1.0 (+ t_1 (sqrt x))) (+ t_2 (- t_3 (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((t + 1.0)) - sqrt(t);
double t_3 = sqrt((y + 1.0));
double tmp;
if (z <= 2.8e-20) {
tmp = t_3 + ((2.0 - (sqrt(z) + sqrt(x))) + (t_2 - sqrt(y)));
} else if (z <= 3.2e+108) {
tmp = (t_1 - sqrt(x)) + ((1.0 / (t_3 + sqrt(y))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z))));
} else {
tmp = (1.0 / (t_1 + sqrt(x))) + (t_2 + (t_3 - 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((t + 1.0d0)) - sqrt(t)
t_3 = sqrt((y + 1.0d0))
if (z <= 2.8d-20) then
tmp = t_3 + ((2.0d0 - (sqrt(z) + sqrt(x))) + (t_2 - sqrt(y)))
else if (z <= 3.2d+108) then
tmp = (t_1 - sqrt(x)) + ((1.0d0 / (t_3 + sqrt(y))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))))
else
tmp = (1.0d0 / (t_1 + sqrt(x))) + (t_2 + (t_3 - 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((t + 1.0)) - Math.sqrt(t);
double t_3 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 2.8e-20) {
tmp = t_3 + ((2.0 - (Math.sqrt(z) + Math.sqrt(x))) + (t_2 - Math.sqrt(y)));
} else if (z <= 3.2e+108) {
tmp = (t_1 - Math.sqrt(x)) + ((1.0 / (t_3 + Math.sqrt(y))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))));
} else {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + (t_2 + (t_3 - 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((t + 1.0)) - math.sqrt(t) t_3 = math.sqrt((y + 1.0)) tmp = 0 if z <= 2.8e-20: tmp = t_3 + ((2.0 - (math.sqrt(z) + math.sqrt(x))) + (t_2 - math.sqrt(y))) elif z <= 3.2e+108: tmp = (t_1 - math.sqrt(x)) + ((1.0 / (t_3 + math.sqrt(y))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) else: tmp = (1.0 / (t_1 + math.sqrt(x))) + (t_2 + (t_3 - 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 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) t_3 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 2.8e-20) tmp = Float64(t_3 + Float64(Float64(2.0 - Float64(sqrt(z) + sqrt(x))) + Float64(t_2 - sqrt(y)))); elseif (z <= 3.2e+108) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 / Float64(t_3 + sqrt(y))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))))); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(t_2 + Float64(t_3 - 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((t + 1.0)) - sqrt(t);
t_3 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 2.8e-20)
tmp = t_3 + ((2.0 - (sqrt(z) + sqrt(x))) + (t_2 - sqrt(y)));
elseif (z <= 3.2e+108)
tmp = (t_1 - sqrt(x)) + ((1.0 / (t_3 + sqrt(y))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z))));
else
tmp = (1.0 / (t_1 + sqrt(x))) + (t_2 + (t_3 - 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[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 2.8e-20], N[(t$95$3 + N[(N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+108], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(t$95$3 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(t$95$3 - 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{t + 1} - \sqrt{t}\\
t_3 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 2.8 \cdot 10^{-20}:\\
\;\;\;\;t\_3 + \left(\left(2 - \left(\sqrt{z} + \sqrt{x}\right)\right) + \left(t\_2 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+108}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\frac{1}{t\_3 + \sqrt{y}} + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(t\_2 + \left(t\_3 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 2.8000000000000003e-20Initial program 97.2%
+-commutative97.2%
associate-+r+97.2%
associate-+r-80.1%
associate-+l-69.5%
associate-+r-55.7%
Simplified55.7%
Taylor expanded in x around 0 29.0%
Taylor expanded in z around 0 29.0%
+-commutative29.0%
Simplified29.0%
if 2.8000000000000003e-20 < z < 3.1999999999999999e108Initial program 86.1%
associate-+l+86.1%
associate-+l+86.1%
+-commutative86.1%
+-commutative86.1%
associate-+l-73.6%
+-commutative73.6%
+-commutative73.6%
Simplified73.6%
add-log-exp73.6%
associate--r-86.1%
+-commutative86.1%
Applied egg-rr86.1%
flip--87.3%
add-sqr-sqrt65.2%
add-sqr-sqrt88.9%
Applied egg-rr88.9%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
+-commutative91.6%
Simplified91.6%
flip--91.6%
add-sqr-sqrt58.0%
add-sqr-sqrt91.7%
Applied egg-rr91.7%
associate--l+92.8%
+-inverses92.8%
metadata-eval92.8%
+-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 51.8%
if 3.1999999999999999e108 < z Initial program 90.7%
associate-+l+90.7%
associate-+l+90.7%
+-commutative90.7%
+-commutative90.7%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
flip--90.7%
add-sqr-sqrt67.4%
+-commutative67.4%
add-sqr-sqrt90.7%
+-commutative90.7%
Applied egg-rr90.7%
associate--l+92.6%
+-inverses92.6%
metadata-eval92.6%
Simplified92.6%
Taylor expanded in z around inf 92.6%
+-commutative90.7%
Simplified92.6%
Final simplification53.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 (+ t 1.0)) (sqrt t)))
(t_3 (sqrt (+ y 1.0)))
(t_4 (- t_3 (sqrt y))))
(if (<= z 3.4e-20)
(+ t_3 (+ (- 2.0 (+ (sqrt z) (sqrt x))) (- t_2 (sqrt y))))
(if (<= z 5.6e+28)
(+ (- t_1 (sqrt x)) (+ (/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))) t_4))
(+ (/ 1.0 (+ t_1 (sqrt x))) (+ t_2 t_4))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((t + 1.0)) - sqrt(t);
double t_3 = sqrt((y + 1.0));
double t_4 = t_3 - sqrt(y);
double tmp;
if (z <= 3.4e-20) {
tmp = t_3 + ((2.0 - (sqrt(z) + sqrt(x))) + (t_2 - sqrt(y)));
} else if (z <= 5.6e+28) {
tmp = (t_1 - sqrt(x)) + ((1.0 / (sqrt((z + 1.0)) + sqrt(z))) + t_4);
} else {
tmp = (1.0 / (t_1 + sqrt(x))) + (t_2 + t_4);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((t + 1.0d0)) - sqrt(t)
t_3 = sqrt((y + 1.0d0))
t_4 = t_3 - sqrt(y)
if (z <= 3.4d-20) then
tmp = t_3 + ((2.0d0 - (sqrt(z) + sqrt(x))) + (t_2 - sqrt(y)))
else if (z <= 5.6d+28) then
tmp = (t_1 - sqrt(x)) + ((1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z))) + t_4)
else
tmp = (1.0d0 / (t_1 + sqrt(x))) + (t_2 + t_4)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((t + 1.0)) - Math.sqrt(t);
double t_3 = Math.sqrt((y + 1.0));
double t_4 = t_3 - Math.sqrt(y);
double tmp;
if (z <= 3.4e-20) {
tmp = t_3 + ((2.0 - (Math.sqrt(z) + Math.sqrt(x))) + (t_2 - Math.sqrt(y)));
} else if (z <= 5.6e+28) {
tmp = (t_1 - Math.sqrt(x)) + ((1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z))) + t_4);
} else {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + (t_2 + t_4);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((t + 1.0)) - math.sqrt(t) t_3 = math.sqrt((y + 1.0)) t_4 = t_3 - math.sqrt(y) tmp = 0 if z <= 3.4e-20: tmp = t_3 + ((2.0 - (math.sqrt(z) + math.sqrt(x))) + (t_2 - math.sqrt(y))) elif z <= 5.6e+28: tmp = (t_1 - math.sqrt(x)) + ((1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z))) + t_4) else: tmp = (1.0 / (t_1 + math.sqrt(x))) + (t_2 + t_4) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) t_3 = sqrt(Float64(y + 1.0)) t_4 = Float64(t_3 - sqrt(y)) tmp = 0.0 if (z <= 3.4e-20) tmp = Float64(t_3 + Float64(Float64(2.0 - Float64(sqrt(z) + sqrt(x))) + Float64(t_2 - sqrt(y)))); elseif (z <= 5.6e+28) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z))) + t_4)); else tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(t_2 + t_4)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((t + 1.0)) - sqrt(t);
t_3 = sqrt((y + 1.0));
t_4 = t_3 - sqrt(y);
tmp = 0.0;
if (z <= 3.4e-20)
tmp = t_3 + ((2.0 - (sqrt(z) + sqrt(x))) + (t_2 - sqrt(y)));
elseif (z <= 5.6e+28)
tmp = (t_1 - sqrt(x)) + ((1.0 / (sqrt((z + 1.0)) + sqrt(z))) + t_4);
else
tmp = (1.0 / (t_1 + sqrt(x))) + (t_2 + t_4);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3.4e-20], N[(t$95$3 + N[(N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+28], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + t$95$4), $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{t + 1} - \sqrt{t}\\
t_3 := \sqrt{y + 1}\\
t_4 := t\_3 - \sqrt{y}\\
\mathbf{if}\;z \leq 3.4 \cdot 10^{-20}:\\
\;\;\;\;t\_3 + \left(\left(2 - \left(\sqrt{z} + \sqrt{x}\right)\right) + \left(t\_2 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+28}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\frac{1}{\sqrt{z + 1} + \sqrt{z}} + t\_4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(t\_2 + t\_4\right)\\
\end{array}
\end{array}
if z < 3.3999999999999997e-20Initial program 97.2%
+-commutative97.2%
associate-+r+97.2%
associate-+r-80.1%
associate-+l-69.5%
associate-+r-55.7%
Simplified55.7%
Taylor expanded in x around 0 29.0%
Taylor expanded in z around 0 29.0%
+-commutative29.0%
Simplified29.0%
if 3.3999999999999997e-20 < z < 5.6000000000000003e28Initial program 78.6%
associate-+l+78.6%
associate-+l+78.6%
+-commutative78.6%
+-commutative78.6%
associate-+l-52.2%
+-commutative52.2%
+-commutative52.2%
Simplified52.2%
add-log-exp52.2%
associate--r-78.6%
+-commutative78.6%
Applied egg-rr78.6%
flip--81.2%
add-sqr-sqrt79.1%
add-sqr-sqrt84.6%
Applied egg-rr84.6%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in t around inf 56.8%
if 5.6000000000000003e28 < z Initial program 91.3%
associate-+l+91.3%
associate-+l+91.3%
+-commutative91.3%
+-commutative91.3%
associate-+l-91.3%
+-commutative91.3%
+-commutative91.3%
Simplified91.3%
flip--91.2%
add-sqr-sqrt68.7%
+-commutative68.7%
add-sqr-sqrt91.2%
+-commutative91.2%
Applied egg-rr91.2%
associate--l+92.7%
+-inverses92.7%
metadata-eval92.7%
Simplified92.7%
Taylor expanded in z around inf 92.7%
+-commutative91.3%
Simplified92.7%
Final simplification58.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 (+ t 1.0)) (sqrt t))) (t_2 (sqrt (+ y 1.0))))
(if (<= z 4e-16)
(+ t_2 (+ (- 2.0 (+ (sqrt z) (sqrt x))) (- t_1 (sqrt y))))
(if (<= z 1e+120)
(+ (+ t_2 (- (- (sqrt (+ z 1.0)) (sqrt z)) (+ (sqrt x) (sqrt y)))) 1.0)
(+ (- (sqrt (+ x 1.0)) (sqrt x)) (+ 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((t + 1.0)) - sqrt(t);
double t_2 = sqrt((y + 1.0));
double tmp;
if (z <= 4e-16) {
tmp = t_2 + ((2.0 - (sqrt(z) + sqrt(x))) + (t_1 - sqrt(y)));
} else if (z <= 1e+120) {
tmp = (t_2 + ((sqrt((z + 1.0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
} else {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (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((t + 1.0d0)) - sqrt(t)
t_2 = sqrt((y + 1.0d0))
if (z <= 4d-16) then
tmp = t_2 + ((2.0d0 - (sqrt(z) + sqrt(x))) + (t_1 - sqrt(y)))
else if (z <= 1d+120) then
tmp = (t_2 + ((sqrt((z + 1.0d0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0d0
else
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + (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((t + 1.0)) - Math.sqrt(t);
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 4e-16) {
tmp = t_2 + ((2.0 - (Math.sqrt(z) + Math.sqrt(x))) + (t_1 - Math.sqrt(y)));
} else if (z <= 1e+120) {
tmp = (t_2 + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) - (Math.sqrt(x) + Math.sqrt(y)))) + 1.0;
} else {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (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((t + 1.0)) - math.sqrt(t) t_2 = math.sqrt((y + 1.0)) tmp = 0 if z <= 4e-16: tmp = t_2 + ((2.0 - (math.sqrt(z) + math.sqrt(x))) + (t_1 - math.sqrt(y))) elif z <= 1e+120: tmp = (t_2 + ((math.sqrt((z + 1.0)) - math.sqrt(z)) - (math.sqrt(x) + math.sqrt(y)))) + 1.0 else: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + (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 = Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 4e-16) tmp = Float64(t_2 + Float64(Float64(2.0 - Float64(sqrt(z) + sqrt(x))) + Float64(t_1 - sqrt(y)))); elseif (z <= 1e+120) tmp = Float64(Float64(t_2 + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) - Float64(sqrt(x) + sqrt(y)))) + 1.0); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + 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((t + 1.0)) - sqrt(t);
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 4e-16)
tmp = t_2 + ((2.0 - (sqrt(z) + sqrt(x))) + (t_1 - sqrt(y)));
elseif (z <= 1e+120)
tmp = (t_2 + ((sqrt((z + 1.0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
else
tmp = (sqrt((x + 1.0)) - sqrt(x)) + (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[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 4e-16], N[(t$95$2 + N[(N[(2.0 - N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+120], N[(N[(t$95$2 + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + 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{t + 1} - \sqrt{t}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 4 \cdot 10^{-16}:\\
\;\;\;\;t\_2 + \left(\left(2 - \left(\sqrt{z} + \sqrt{x}\right)\right) + \left(t\_1 - \sqrt{y}\right)\right)\\
\mathbf{elif}\;z \leq 10^{+120}:\\
\;\;\;\;\left(t\_2 + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(t\_1 + \left(t\_2 - \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if z < 3.9999999999999999e-16Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-79.6%
associate-+l-69.2%
associate-+r-55.5%
Simplified55.5%
Taylor expanded in x around 0 28.6%
Taylor expanded in z around 0 28.6%
+-commutative28.6%
Simplified28.6%
if 3.9999999999999999e-16 < z < 9.9999999999999998e119Initial program 86.5%
+-commutative86.5%
associate-+r+86.5%
associate-+r-66.8%
associate-+l-53.6%
associate-+r-46.9%
Simplified34.1%
Taylor expanded in t around inf 7.7%
associate--l+23.0%
associate--l+25.1%
associate-+r+25.1%
Simplified25.1%
Taylor expanded in x around 0 7.0%
associate--l+27.2%
associate-+r+27.2%
+-commutative27.2%
associate--l+29.4%
associate--r+31.0%
Simplified31.0%
if 9.9999999999999998e119 < z Initial program 90.5%
associate-+l+90.5%
associate-+l+90.5%
+-commutative90.5%
+-commutative90.5%
associate-+l-90.5%
+-commutative90.5%
+-commutative90.5%
Simplified90.5%
Taylor expanded in z around inf 90.5%
+-commutative90.5%
Simplified90.5%
Final simplification47.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 (+ z 1.0))))
(if (<= t 3.7e+15)
(+
2.0
(-
(+ (sqrt (+ t 1.0)) t_1)
(+ (sqrt t) (+ (+ (sqrt z) (sqrt x)) (sqrt y)))))
(+ (+ (sqrt (+ y 1.0)) (- (- t_1 (sqrt z)) (+ (sqrt x) (sqrt y)))) 1.0))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0));
double tmp;
if (t <= 3.7e+15) {
tmp = 2.0 + ((sqrt((t + 1.0)) + t_1) - (sqrt(t) + ((sqrt(z) + sqrt(x)) + sqrt(y))));
} else {
tmp = (sqrt((y + 1.0)) + ((t_1 - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
}
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((z + 1.0d0))
if (t <= 3.7d+15) then
tmp = 2.0d0 + ((sqrt((t + 1.0d0)) + t_1) - (sqrt(t) + ((sqrt(z) + sqrt(x)) + sqrt(y))))
else
tmp = (sqrt((y + 1.0d0)) + ((t_1 - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + 1.0));
double tmp;
if (t <= 3.7e+15) {
tmp = 2.0 + ((Math.sqrt((t + 1.0)) + t_1) - (Math.sqrt(t) + ((Math.sqrt(z) + Math.sqrt(x)) + Math.sqrt(y))));
} else {
tmp = (Math.sqrt((y + 1.0)) + ((t_1 - Math.sqrt(z)) - (Math.sqrt(x) + Math.sqrt(y)))) + 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) tmp = 0 if t <= 3.7e+15: tmp = 2.0 + ((math.sqrt((t + 1.0)) + t_1) - (math.sqrt(t) + ((math.sqrt(z) + math.sqrt(x)) + math.sqrt(y)))) else: tmp = (math.sqrt((y + 1.0)) + ((t_1 - math.sqrt(z)) - (math.sqrt(x) + math.sqrt(y)))) + 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t <= 3.7e+15) tmp = Float64(2.0 + Float64(Float64(sqrt(Float64(t + 1.0)) + t_1) - Float64(sqrt(t) + Float64(Float64(sqrt(z) + sqrt(x)) + sqrt(y))))); else tmp = Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(t_1 - sqrt(z)) - Float64(sqrt(x) + sqrt(y)))) + 1.0); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((z + 1.0));
tmp = 0.0;
if (t <= 3.7e+15)
tmp = 2.0 + ((sqrt((t + 1.0)) + t_1) - (sqrt(t) + ((sqrt(z) + sqrt(x)) + sqrt(y))));
else
tmp = (sqrt((y + 1.0)) + ((t_1 - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
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[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3.7e+15], N[(2.0 + N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(t$95$1 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{z + 1}\\
\mathbf{if}\;t \leq 3.7 \cdot 10^{+15}:\\
\;\;\;\;2 + \left(\left(\sqrt{t + 1} + t\_1\right) - \left(\sqrt{t} + \left(\left(\sqrt{z} + \sqrt{x}\right) + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{y + 1} + \left(\left(t\_1 - \sqrt{z}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + 1\\
\end{array}
\end{array}
if t < 3.7e15Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-76.3%
associate-+l-56.9%
associate-+r-52.9%
Simplified44.5%
Taylor expanded in x around 0 23.8%
Taylor expanded in y around 0 14.2%
associate--l+27.0%
+-commutative27.0%
+-commutative27.0%
associate-+r+27.0%
+-commutative27.0%
associate-+r+27.0%
Simplified27.0%
if 3.7e15 < t Initial program 86.8%
+-commutative86.8%
associate-+r+86.8%
associate-+r-70.0%
associate-+l-70.0%
associate-+r-55.7%
Simplified47.5%
Taylor expanded in t around inf 20.9%
associate--l+34.6%
associate--l+35.8%
associate-+r+35.8%
Simplified35.8%
Taylor expanded in x around 0 18.4%
associate--l+43.1%
associate-+r+43.1%
+-commutative43.1%
associate--l+40.0%
associate--r+45.3%
Simplified45.3%
Final simplification34.5%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 7400000.0)
(+
(+
(sqrt (+ y 1.0))
(- (- (sqrt (+ z 1.0)) (sqrt z)) (+ (sqrt x) (sqrt y))))
1.0)
(-
(+
(sqrt (+ x 1.0))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* -0.125 (sqrt (/ 1.0 (pow y 3.0))))))
(sqrt x))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7400000.0) {
tmp = (sqrt((y + 1.0)) + ((sqrt((z + 1.0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
} else {
tmp = (sqrt((x + 1.0)) + ((0.5 * sqrt((1.0 / y))) + (-0.125 * sqrt((1.0 / pow(y, 3.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 <= 7400000.0d0) then
tmp = (sqrt((y + 1.0d0)) + ((sqrt((z + 1.0d0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0d0
else
tmp = (sqrt((x + 1.0d0)) + ((0.5d0 * sqrt((1.0d0 / y))) + ((-0.125d0) * sqrt((1.0d0 / (y ** 3.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 <= 7400000.0) {
tmp = (Math.sqrt((y + 1.0)) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) - (Math.sqrt(x) + Math.sqrt(y)))) + 1.0;
} else {
tmp = (Math.sqrt((x + 1.0)) + ((0.5 * Math.sqrt((1.0 / y))) + (-0.125 * Math.sqrt((1.0 / Math.pow(y, 3.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 <= 7400000.0: tmp = (math.sqrt((y + 1.0)) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) - (math.sqrt(x) + math.sqrt(y)))) + 1.0 else: tmp = (math.sqrt((x + 1.0)) + ((0.5 * math.sqrt((1.0 / y))) + (-0.125 * math.sqrt((1.0 / math.pow(y, 3.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 <= 7400000.0) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) - Float64(sqrt(x) + sqrt(y)))) + 1.0); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(-0.125 * sqrt(Float64(1.0 / (y ^ 3.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 <= 7400000.0)
tmp = (sqrt((y + 1.0)) + ((sqrt((z + 1.0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
else
tmp = (sqrt((x + 1.0)) + ((0.5 * sqrt((1.0 / y))) + (-0.125 * sqrt((1.0 / (y ^ 3.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, 7400000.0], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(-0.125 * N[Sqrt[N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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 7400000:\\
\;\;\;\;\left(\sqrt{y + 1} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + -0.125 \cdot \sqrt{\frac{1}{{y}^{3}}}\right)\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 7.4e6Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-97.1%
associate-+l-97.1%
associate-+r-97.1%
Simplified81.9%
Taylor expanded in t around inf 19.0%
associate--l+22.3%
associate--l+27.8%
associate-+r+27.8%
Simplified27.8%
Taylor expanded in x around 0 16.1%
associate--l+24.3%
associate-+r+24.3%
+-commutative24.3%
associate--l+30.9%
associate--r+24.6%
Simplified24.6%
if 7.4e6 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.5%
associate-+r-48.9%
associate-+l-25.2%
associate-+r-8.3%
Simplified7.3%
Taylor expanded in t around inf 5.0%
associate--l+20.8%
associate--l+15.3%
associate-+r+15.3%
Simplified15.3%
Taylor expanded in z around inf 5.1%
Taylor expanded in y around inf 19.7%
Final simplification22.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 3700000000.0)
(+
(+
(sqrt (+ y 1.0))
(- (- (sqrt (+ z 1.0)) (sqrt z)) (+ (sqrt x) (sqrt y))))
1.0)
(- (+ (sqrt (+ x 1.0)) (* 0.5 (sqrt (/ 1.0 y)))) (sqrt x))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3700000000.0) {
tmp = (sqrt((y + 1.0)) + ((sqrt((z + 1.0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
} else {
tmp = (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3700000000.0d0) then
tmp = (sqrt((y + 1.0d0)) + ((sqrt((z + 1.0d0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0d0
else
tmp = (sqrt((x + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / y)))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3700000000.0) {
tmp = (Math.sqrt((y + 1.0)) + ((Math.sqrt((z + 1.0)) - Math.sqrt(z)) - (Math.sqrt(x) + Math.sqrt(y)))) + 1.0;
} else {
tmp = (Math.sqrt((x + 1.0)) + (0.5 * Math.sqrt((1.0 / y)))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3700000000.0: tmp = (math.sqrt((y + 1.0)) + ((math.sqrt((z + 1.0)) - math.sqrt(z)) - (math.sqrt(x) + math.sqrt(y)))) + 1.0 else: tmp = (math.sqrt((x + 1.0)) + (0.5 * math.sqrt((1.0 / y)))) - 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 <= 3700000000.0) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) - Float64(sqrt(x) + sqrt(y)))) + 1.0); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / y)))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3700000000.0)
tmp = (sqrt((y + 1.0)) + ((sqrt((z + 1.0)) - sqrt(z)) - (sqrt(x) + sqrt(y)))) + 1.0;
else
tmp = (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3700000000.0], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $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 3700000000:\\
\;\;\;\;\left(\sqrt{y + 1} + \left(\left(\sqrt{z + 1} - \sqrt{z}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 3.7e9Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-97.1%
associate-+l-97.1%
associate-+r-97.1%
Simplified81.9%
Taylor expanded in t around inf 19.0%
associate--l+22.3%
associate--l+27.8%
associate-+r+27.8%
Simplified27.8%
Taylor expanded in x around 0 16.1%
associate--l+24.3%
associate-+r+24.3%
+-commutative24.3%
associate--l+30.9%
associate--r+24.6%
Simplified24.6%
if 3.7e9 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.5%
associate-+r-48.9%
associate-+l-25.2%
associate-+r-8.3%
Simplified7.3%
Taylor expanded in t around inf 5.0%
associate--l+20.8%
associate--l+15.3%
associate-+r+15.3%
Simplified15.3%
Taylor expanded in z around inf 5.1%
Taylor expanded in y around inf 19.7%
Final simplification22.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 (+ y 1.0))))
(if (<= y 1.4e-25)
(+ t_1 (+ t_2 (- (sqrt (+ z 1.0)) (sqrt z))))
(if (<= y 3200000.0)
(+ (- t_2 (+ (sqrt x) (sqrt y))) 1.0)
(+ t_1 (- (* 0.5 (+ (sqrt (/ 1.0 y)) (sqrt (/ 1.0 z)))) (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((y + 1.0));
double tmp;
if (y <= 1.4e-25) {
tmp = t_1 + (t_2 + (sqrt((z + 1.0)) - sqrt(z)));
} else if (y <= 3200000.0) {
tmp = (t_2 - (sqrt(x) + sqrt(y))) + 1.0;
} else {
tmp = t_1 + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (y <= 1.4d-25) then
tmp = t_1 + (t_2 + (sqrt((z + 1.0d0)) - sqrt(z)))
else if (y <= 3200000.0d0) then
tmp = (t_2 - (sqrt(x) + sqrt(y))) + 1.0d0
else
tmp = t_1 + ((0.5d0 * (sqrt((1.0d0 / y)) + sqrt((1.0d0 / z)))) - sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (y <= 1.4e-25) {
tmp = t_1 + (t_2 + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
} else if (y <= 3200000.0) {
tmp = (t_2 - (Math.sqrt(x) + Math.sqrt(y))) + 1.0;
} else {
tmp = t_1 + ((0.5 * (Math.sqrt((1.0 / y)) + Math.sqrt((1.0 / z)))) - Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((y + 1.0)) tmp = 0 if y <= 1.4e-25: tmp = t_1 + (t_2 + (math.sqrt((z + 1.0)) - math.sqrt(z))) elif y <= 3200000.0: tmp = (t_2 - (math.sqrt(x) + math.sqrt(y))) + 1.0 else: tmp = t_1 + ((0.5 * (math.sqrt((1.0 / y)) + math.sqrt((1.0 / z)))) - math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (y <= 1.4e-25) tmp = Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); elseif (y <= 3200000.0) tmp = Float64(Float64(t_2 - Float64(sqrt(x) + sqrt(y))) + 1.0); else tmp = Float64(t_1 + Float64(Float64(0.5 * Float64(sqrt(Float64(1.0 / y)) + sqrt(Float64(1.0 / z)))) - sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (y <= 1.4e-25)
tmp = t_1 + (t_2 + (sqrt((z + 1.0)) - sqrt(z)));
elseif (y <= 3200000.0)
tmp = (t_2 - (sqrt(x) + sqrt(y))) + 1.0;
else
tmp = t_1 + ((0.5 * (sqrt((1.0 / y)) + sqrt((1.0 / z)))) - sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.4e-25], N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3200000.0], N[(N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(t$95$1 + N[(N[(0.5 * N[(N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] + N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;y \leq 1.4 \cdot 10^{-25}:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 3200000:\\
\;\;\;\;\left(t\_2 - \left(\sqrt{x} + \sqrt{y}\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(0.5 \cdot \left(\sqrt{\frac{1}{y}} + \sqrt{\frac{1}{z}}\right) - \sqrt{x}\right)\\
\end{array}
\end{array}
if y < 1.39999999999999994e-25Initial program 97.4%
+-commutative97.4%
associate-+r+97.4%
associate-+r-97.4%
associate-+l-97.4%
associate-+r-97.4%
Simplified83.5%
Taylor expanded in t around inf 19.9%
associate--l+23.0%
associate--l+28.9%
associate-+r+28.9%
Simplified28.9%
Taylor expanded in z around inf 28.1%
if 1.39999999999999994e-25 < y < 3.2e6Initial program 95.1%
+-commutative95.1%
associate-+r+95.1%
associate-+r-95.0%
associate-+l-94.9%
associate-+r-94.9%
Simplified70.2%
Taylor expanded in t around inf 12.4%
associate--l+17.6%
associate--l+20.0%
associate-+r+20.0%
Simplified20.0%
Taylor expanded in z around inf 17.2%
Taylor expanded in x around 0 15.4%
associate--l+15.5%
Simplified15.5%
if 3.2e6 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.5%
associate-+r-48.9%
associate-+l-25.2%
associate-+r-8.3%
Simplified7.3%
Taylor expanded in t around inf 5.0%
associate--l+20.8%
associate--l+15.3%
associate-+r+15.3%
Simplified15.3%
Taylor expanded in z around inf 18.3%
Taylor expanded in y around inf 17.7%
distribute-lft-out17.7%
Simplified17.7%
Final simplification22.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 (+ y 1.0))))
(if (<= z 480000.0)
(+ t_1 (+ t_2 (- (sqrt (+ z 1.0)) (sqrt z))))
(+ t_1 (- (+ t_2 (* 0.5 (sqrt (/ 1.0 z)))) (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((y + 1.0));
double tmp;
if (z <= 480000.0) {
tmp = t_1 + (t_2 + (sqrt((z + 1.0)) - sqrt(z)));
} else {
tmp = t_1 + ((t_2 + (0.5 * sqrt((1.0 / z)))) - 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((y + 1.0d0))
if (z <= 480000.0d0) then
tmp = t_1 + (t_2 + (sqrt((z + 1.0d0)) - sqrt(z)))
else
tmp = t_1 + ((t_2 + (0.5d0 * sqrt((1.0d0 / z)))) - 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((y + 1.0));
double tmp;
if (z <= 480000.0) {
tmp = t_1 + (t_2 + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
} else {
tmp = t_1 + ((t_2 + (0.5 * Math.sqrt((1.0 / z)))) - 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((y + 1.0)) tmp = 0 if z <= 480000.0: tmp = t_1 + (t_2 + (math.sqrt((z + 1.0)) - math.sqrt(z))) else: tmp = t_1 + ((t_2 + (0.5 * math.sqrt((1.0 / z)))) - 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(y + 1.0)) tmp = 0.0 if (z <= 480000.0) tmp = Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); else tmp = Float64(t_1 + Float64(Float64(t_2 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - 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((y + 1.0));
tmp = 0.0;
if (z <= 480000.0)
tmp = t_1 + (t_2 + (sqrt((z + 1.0)) - sqrt(z)));
else
tmp = t_1 + ((t_2 + (0.5 * sqrt((1.0 / z)))) - 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 480000.0], N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(t$95$2 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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{y + 1}\\
\mathbf{if}\;z \leq 480000:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(t\_2 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 4.8e5Initial program 96.8%
+-commutative96.8%
associate-+r+96.8%
associate-+r-80.3%
associate-+l-69.7%
associate-+r-55.0%
Simplified55.0%
Taylor expanded in t around inf 19.2%
associate--l+22.8%
associate--l+22.9%
associate-+r+22.9%
Simplified22.9%
Taylor expanded in z around inf 17.8%
if 4.8e5 < z Initial program 88.3%
+-commutative88.3%
associate-+r+88.3%
associate-+r-65.8%
associate-+l-53.4%
associate-+r-52.9%
Simplified34.7%
Taylor expanded in t around inf 3.9%
associate--l+20.2%
associate--l+20.4%
associate-+r+20.4%
Simplified20.4%
Taylor expanded in z around inf 27.4%
Taylor expanded in y around inf 28.0%
Final simplification22.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 (+ x 1.0))) (t_2 (sqrt (+ y 1.0))))
(if (<= y 3e-25)
(+ t_1 (+ t_2 (- (sqrt (+ z 1.0)) (sqrt z))))
(if (<= y 45000000.0)
(+ (- t_2 (+ (sqrt x) (sqrt y))) 1.0)
(- (+ t_1 (* 0.5 (sqrt (/ 1.0 y)))) (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((y + 1.0));
double tmp;
if (y <= 3e-25) {
tmp = t_1 + (t_2 + (sqrt((z + 1.0)) - sqrt(z)));
} else if (y <= 45000000.0) {
tmp = (t_2 - (sqrt(x) + sqrt(y))) + 1.0;
} else {
tmp = (t_1 + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((y + 1.0d0))
if (y <= 3d-25) then
tmp = t_1 + (t_2 + (sqrt((z + 1.0d0)) - sqrt(z)))
else if (y <= 45000000.0d0) then
tmp = (t_2 - (sqrt(x) + sqrt(y))) + 1.0d0
else
tmp = (t_1 + (0.5d0 * sqrt((1.0d0 / y)))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((y + 1.0));
double tmp;
if (y <= 3e-25) {
tmp = t_1 + (t_2 + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
} else if (y <= 45000000.0) {
tmp = (t_2 - (Math.sqrt(x) + Math.sqrt(y))) + 1.0;
} else {
tmp = (t_1 + (0.5 * Math.sqrt((1.0 / y)))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((y + 1.0)) tmp = 0 if y <= 3e-25: tmp = t_1 + (t_2 + (math.sqrt((z + 1.0)) - math.sqrt(z))) elif y <= 45000000.0: tmp = (t_2 - (math.sqrt(x) + math.sqrt(y))) + 1.0 else: tmp = (t_1 + (0.5 * math.sqrt((1.0 / y)))) - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (y <= 3e-25) tmp = Float64(t_1 + Float64(t_2 + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); elseif (y <= 45000000.0) tmp = Float64(Float64(t_2 - Float64(sqrt(x) + sqrt(y))) + 1.0); else tmp = Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / y)))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((y + 1.0));
tmp = 0.0;
if (y <= 3e-25)
tmp = t_1 + (t_2 + (sqrt((z + 1.0)) - sqrt(z)));
elseif (y <= 45000000.0)
tmp = (t_2 - (sqrt(x) + sqrt(y))) + 1.0;
else
tmp = (t_1 + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3e-25], N[(t$95$1 + N[(t$95$2 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 45000000.0], N[(N[(t$95$2 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
t_2 := \sqrt{y + 1}\\
\mathbf{if}\;y \leq 3 \cdot 10^{-25}:\\
\;\;\;\;t\_1 + \left(t\_2 + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 45000000:\\
\;\;\;\;\left(t\_2 - \left(\sqrt{x} + \sqrt{y}\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 2.9999999999999998e-25Initial program 97.4%
+-commutative97.4%
associate-+r+97.4%
associate-+r-97.4%
associate-+l-97.4%
associate-+r-97.4%
Simplified83.5%
Taylor expanded in t around inf 19.9%
associate--l+23.0%
associate--l+28.9%
associate-+r+28.9%
Simplified28.9%
Taylor expanded in z around inf 28.1%
if 2.9999999999999998e-25 < y < 4.5e7Initial program 95.1%
+-commutative95.1%
associate-+r+95.1%
associate-+r-95.0%
associate-+l-94.9%
associate-+r-94.9%
Simplified70.2%
Taylor expanded in t around inf 12.4%
associate--l+17.6%
associate--l+20.0%
associate-+r+20.0%
Simplified20.0%
Taylor expanded in z around inf 17.2%
Taylor expanded in x around 0 15.4%
associate--l+15.5%
Simplified15.5%
if 4.5e7 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.5%
associate-+r-48.9%
associate-+l-25.2%
associate-+r-8.3%
Simplified7.3%
Taylor expanded in t around inf 5.0%
associate--l+20.8%
associate--l+15.3%
associate-+r+15.3%
Simplified15.3%
Taylor expanded in z around inf 5.1%
Taylor expanded in y around inf 19.7%
Final simplification23.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 (+ y 1.0))) (t_2 (sqrt (+ x 1.0))))
(if (<= z 1.76)
(- (+ (+ t_2 1.0) (+ t_1 (* z 0.5))) (sqrt z))
(+ t_2 (- 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((y + 1.0));
double t_2 = sqrt((x + 1.0));
double tmp;
if (z <= 1.76) {
tmp = ((t_2 + 1.0) + (t_1 + (z * 0.5))) - sqrt(z);
} else {
tmp = t_2 + (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) :: t_2
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((x + 1.0d0))
if (z <= 1.76d0) then
tmp = ((t_2 + 1.0d0) + (t_1 + (z * 0.5d0))) - sqrt(z)
else
tmp = t_2 + (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((y + 1.0));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (z <= 1.76) {
tmp = ((t_2 + 1.0) + (t_1 + (z * 0.5))) - Math.sqrt(z);
} else {
tmp = t_2 + (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((y + 1.0)) t_2 = math.sqrt((x + 1.0)) tmp = 0 if z <= 1.76: tmp = ((t_2 + 1.0) + (t_1 + (z * 0.5))) - math.sqrt(z) else: tmp = t_2 + (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(y + 1.0)) t_2 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (z <= 1.76) tmp = Float64(Float64(Float64(t_2 + 1.0) + Float64(t_1 + Float64(z * 0.5))) - sqrt(z)); else tmp = Float64(t_2 + 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((y + 1.0));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (z <= 1.76)
tmp = ((t_2 + 1.0) + (t_1 + (z * 0.5))) - sqrt(z);
else
tmp = t_2 + (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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.76], N[(N[(N[(t$95$2 + 1.0), $MachinePrecision] + N[(t$95$1 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t$95$1 - 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{y + 1}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;z \leq 1.76:\\
\;\;\;\;\left(\left(t\_2 + 1\right) + \left(t\_1 + z \cdot 0.5\right)\right) - \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(t\_1 - \sqrt{y}\right)\\
\end{array}
\end{array}
if z < 1.76000000000000001Initial program 97.3%
+-commutative97.3%
associate-+r+97.3%
associate-+r-80.1%
associate-+l-69.0%
associate-+r-54.2%
Simplified54.2%
Taylor expanded in t around inf 18.8%
associate--l+22.6%
associate--l+22.6%
associate-+r+22.6%
Simplified22.6%
Taylor expanded in z around 0 18.8%
associate-+r+18.8%
+-commutative18.8%
associate-+r+18.8%
+-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 17.6%
if 1.76000000000000001 < z Initial program 88.2%
+-commutative88.2%
associate-+r+88.2%
associate-+r-66.8%
associate-+l-55.0%
associate-+r-53.9%
Simplified36.6%
Taylor expanded in t around inf 5.1%
associate--l+20.6%
associate--l+20.8%
associate-+r+20.8%
Simplified20.8%
Taylor expanded in y around inf 27.2%
mul-1-neg27.2%
Simplified27.2%
Final simplification22.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y 110000000.0) (+ (- (sqrt (+ y 1.0)) (+ (sqrt x) (sqrt y))) 1.0) (- (+ (sqrt (+ x 1.0)) (* 0.5 (sqrt (/ 1.0 y)))) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 110000000.0) {
tmp = (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y))) + 1.0;
} else {
tmp = (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 110000000.0d0) then
tmp = (sqrt((y + 1.0d0)) - (sqrt(x) + sqrt(y))) + 1.0d0
else
tmp = (sqrt((x + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / y)))) - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 110000000.0) {
tmp = (Math.sqrt((y + 1.0)) - (Math.sqrt(x) + Math.sqrt(y))) + 1.0;
} else {
tmp = (Math.sqrt((x + 1.0)) + (0.5 * Math.sqrt((1.0 / y)))) - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 110000000.0: tmp = (math.sqrt((y + 1.0)) - (math.sqrt(x) + math.sqrt(y))) + 1.0 else: tmp = (math.sqrt((x + 1.0)) + (0.5 * math.sqrt((1.0 / y)))) - 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 <= 110000000.0) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(x) + sqrt(y))) + 1.0); else tmp = Float64(Float64(sqrt(Float64(x + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / y)))) - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 110000000.0)
tmp = (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y))) + 1.0;
else
tmp = (sqrt((x + 1.0)) + (0.5 * sqrt((1.0 / y)))) - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 110000000.0], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $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 110000000:\\
\;\;\;\;\left(\sqrt{y + 1} - \left(\sqrt{x} + \sqrt{y}\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{x + 1} + 0.5 \cdot \sqrt{\frac{1}{y}}\right) - \sqrt{x}\\
\end{array}
\end{array}
if y < 1.1e8Initial program 97.1%
+-commutative97.1%
associate-+r+97.1%
associate-+r-97.1%
associate-+l-97.1%
associate-+r-97.1%
Simplified81.9%
Taylor expanded in t around inf 19.0%
associate--l+22.3%
associate--l+27.8%
associate-+r+27.8%
Simplified27.8%
Taylor expanded in z around inf 18.0%
Taylor expanded in x around 0 15.8%
associate--l+15.8%
Simplified15.8%
if 1.1e8 < y Initial program 88.4%
+-commutative88.4%
associate-+r+88.5%
associate-+r-48.9%
associate-+l-25.2%
associate-+r-8.3%
Simplified7.3%
Taylor expanded in t around inf 5.0%
associate--l+20.8%
associate--l+15.3%
associate-+r+15.3%
Simplified15.3%
Taylor expanded in z around inf 5.1%
Taylor expanded in y around inf 19.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 (if (<= x 1.06e-10) (+ (- (sqrt (+ y 1.0)) (+ (sqrt x) (sqrt y))) 1.0) (- (sqrt (+ x 1.0)) (sqrt x))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.06e-10) {
tmp = (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y))) + 1.0;
} 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 (x <= 1.06d-10) then
tmp = (sqrt((y + 1.0d0)) - (sqrt(x) + sqrt(y))) + 1.0d0
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 (x <= 1.06e-10) {
tmp = (Math.sqrt((y + 1.0)) - (Math.sqrt(x) + Math.sqrt(y))) + 1.0;
} 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 x <= 1.06e-10: tmp = (math.sqrt((y + 1.0)) - (math.sqrt(x) + math.sqrt(y))) + 1.0 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 (x <= 1.06e-10) tmp = Float64(Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(x) + sqrt(y))) + 1.0); 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 (x <= 1.06e-10)
tmp = (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y))) + 1.0;
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[x, 1.06e-10], N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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}\;x \leq 1.06 \cdot 10^{-10}:\\
\;\;\;\;\left(\sqrt{y + 1} - \left(\sqrt{x} + \sqrt{y}\right)\right) + 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\end{array}
\end{array}
if x < 1.06e-10Initial program 97.5%
+-commutative97.5%
associate-+r+97.5%
associate-+r-60.4%
associate-+l-57.8%
associate-+r-54.5%
Simplified36.7%
Taylor expanded in t around inf 19.6%
associate--l+37.5%
associate--l+37.9%
associate-+r+37.9%
Simplified37.9%
Taylor expanded in z around inf 19.8%
Taylor expanded in x around 0 19.8%
associate--l+33.8%
Simplified33.8%
if 1.06e-10 < x Initial program 88.8%
+-commutative88.8%
associate-+r+88.8%
associate-+r-85.5%
associate-+l-66.2%
associate-+r-53.7%
Simplified53.7%
Taylor expanded in t around inf 5.7%
associate--l+7.6%
associate--l+7.5%
associate-+r+7.5%
Simplified7.5%
Taylor expanded in z around inf 4.6%
Taylor expanded in y around inf 4.2%
Final simplification18.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)))) (if (<= y 6.6e+25) (+ t_1 (- (sqrt (+ y 1.0)) (sqrt y))) (- t_1 (sqrt x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 6.6e+25) {
tmp = t_1 + (sqrt((y + 1.0)) - sqrt(y));
} else {
tmp = t_1 - sqrt(x);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if (y <= 6.6d+25) then
tmp = t_1 + (sqrt((y + 1.0d0)) - sqrt(y))
else
tmp = t_1 - sqrt(x)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 6.6e+25) {
tmp = t_1 + (Math.sqrt((y + 1.0)) - Math.sqrt(y));
} else {
tmp = t_1 - Math.sqrt(x);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 6.6e+25: tmp = t_1 + (math.sqrt((y + 1.0)) - math.sqrt(y)) else: tmp = t_1 - math.sqrt(x) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 6.6e+25) tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))); else tmp = Float64(t_1 - sqrt(x)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 6.6e+25)
tmp = t_1 + (sqrt((y + 1.0)) - sqrt(y));
else
tmp = t_1 - sqrt(x);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6.6e+25], N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 6.6 \cdot 10^{+25}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \sqrt{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \sqrt{x}\\
\end{array}
\end{array}
if y < 6.6000000000000002e25Initial program 95.6%
+-commutative95.6%
associate-+r+95.6%
associate-+r-95.6%
associate-+l-95.6%
associate-+r-95.6%
Simplified80.4%
Taylor expanded in t around inf 19.7%
associate--l+23.6%
associate--l+28.2%
associate-+r+28.2%
Simplified28.2%
Taylor expanded in y around inf 19.7%
mul-1-neg19.7%
Simplified19.7%
if 6.6000000000000002e25 < y Initial program 89.6%
+-commutative89.6%
associate-+r+89.6%
associate-+r-47.3%
associate-+l-22.0%
associate-+r-4.0%
Simplified4.0%
Taylor expanded in t around inf 3.2%
associate--l+19.3%
associate--l+14.0%
associate-+r+14.0%
Simplified14.0%
Taylor expanded in z around inf 3.2%
Taylor expanded in y around inf 18.4%
Final simplification19.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (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 92.9%
+-commutative92.9%
associate-+r+92.9%
associate-+r-73.7%
associate-+l-62.2%
associate-+r-54.1%
Simplified45.7%
Taylor expanded in t around inf 12.2%
associate--l+21.6%
associate--l+21.7%
associate-+r+21.7%
Simplified21.7%
Taylor expanded in z around inf 11.7%
Taylor expanded in y around inf 14.3%
Final simplification14.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* 0.5 (pow z -0.5)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 0.5 * pow(z, -0.5);
}
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 = 0.5d0 * (z ** (-0.5d0))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 0.5 * Math.pow(z, -0.5);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 0.5 * math.pow(z, -0.5)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(0.5 * (z ^ -0.5)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 0.5 * (z ^ -0.5);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(0.5 * N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
0.5 \cdot {z}^{-0.5}
\end{array}
Initial program 92.9%
+-commutative92.9%
associate-+r+92.9%
associate-+r-73.7%
associate-+l-62.2%
associate-+r-54.1%
Simplified45.7%
Taylor expanded in z around inf 28.3%
Taylor expanded in z around 0 8.4%
*-un-lft-identity8.4%
pow1/28.4%
inv-pow8.4%
pow-pow8.4%
metadata-eval8.4%
Applied egg-rr8.4%
*-lft-identity8.4%
Simplified8.4%
Final simplification8.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (* x 0.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return x * 0.0;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * 0.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return x * 0.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return x * 0.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(x * 0.0) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = x * 0.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(x * 0.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
x \cdot 0
\end{array}
Initial program 92.9%
+-commutative92.9%
associate-+r+92.9%
associate-+r-73.7%
associate-+l-62.2%
associate-+r-54.1%
Simplified45.7%
Taylor expanded in t around inf 12.2%
associate--l+21.6%
associate--l+21.7%
associate-+r+21.7%
Simplified21.7%
Taylor expanded in y around inf 19.7%
associate-*l/18.6%
*-lft-identity18.6%
associate-+r+18.6%
associate-*r/18.6%
*-rgt-identity18.6%
associate-*l/19.7%
*-lft-identity19.7%
Simplified19.7%
Taylor expanded in x around inf 3.1%
distribute-rgt1-in3.1%
metadata-eval3.1%
mul0-lft3.1%
Simplified3.1%
Final simplification3.1%
(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 2024054
(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))))