
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((sqrt((x + 1.0d0)) - sqrt(x)) + (sqrt((y + 1.0d0)) - sqrt(y))) + (sqrt((z + 1.0d0)) - sqrt(z))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((Math.sqrt((x + 1.0)) - Math.sqrt(x)) + (Math.sqrt((y + 1.0)) - Math.sqrt(y))) + (Math.sqrt((z + 1.0)) - Math.sqrt(z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((math.sqrt((x + 1.0)) - math.sqrt(x)) + (math.sqrt((y + 1.0)) - math.sqrt(y))) + (math.sqrt((z + 1.0)) - math.sqrt(z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(sqrt(Float64(y + 1.0)) - sqrt(y))) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((sqrt((x + 1.0)) - sqrt(x)) + (sqrt((y + 1.0)) - sqrt(y))) + (sqrt((z + 1.0)) - sqrt(z))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\sqrt{y + 1} - \sqrt{y}\right)\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (+ t_1 (sqrt x)))
(t_3 (sqrt (+ t 1.0)))
(t_4 (+ t_3 (sqrt t)))
(t_5 (sqrt (+ y 1.0)))
(t_6 (+ t_5 (sqrt y)))
(t_7 (- t_5 (sqrt y)))
(t_8 (+ (sqrt z) (sqrt (+ z 1.0)))))
(if (<= t_7 0.5)
(+
(/ (+ t_6 t_2) (* t_6 t_2))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_3 (sqrt t))))
(+ (- t_1 (sqrt x)) (+ t_7 (/ (+ t_4 t_8) (* t_4 t_8)))))))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 = t_1 + sqrt(x);
double t_3 = sqrt((t + 1.0));
double t_4 = t_3 + sqrt(t);
double t_5 = sqrt((y + 1.0));
double t_6 = t_5 + sqrt(y);
double t_7 = t_5 - sqrt(y);
double t_8 = sqrt(z) + sqrt((z + 1.0));
double tmp;
if (t_7 <= 0.5) {
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * sqrt((1.0 / z))) + (t_3 - sqrt(t)));
} else {
tmp = (t_1 - sqrt(x)) + (t_7 + ((t_4 + t_8) / (t_4 * t_8)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: t_8
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = t_1 + sqrt(x)
t_3 = sqrt((t + 1.0d0))
t_4 = t_3 + sqrt(t)
t_5 = sqrt((y + 1.0d0))
t_6 = t_5 + sqrt(y)
t_7 = t_5 - sqrt(y)
t_8 = sqrt(z) + sqrt((z + 1.0d0))
if (t_7 <= 0.5d0) then
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_3 - sqrt(t)))
else
tmp = (t_1 - sqrt(x)) + (t_7 + ((t_4 + t_8) / (t_4 * t_8)))
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 = t_1 + Math.sqrt(x);
double t_3 = Math.sqrt((t + 1.0));
double t_4 = t_3 + Math.sqrt(t);
double t_5 = Math.sqrt((y + 1.0));
double t_6 = t_5 + Math.sqrt(y);
double t_7 = t_5 - Math.sqrt(y);
double t_8 = Math.sqrt(z) + Math.sqrt((z + 1.0));
double tmp;
if (t_7 <= 0.5) {
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * Math.sqrt((1.0 / z))) + (t_3 - Math.sqrt(t)));
} else {
tmp = (t_1 - Math.sqrt(x)) + (t_7 + ((t_4 + t_8) / (t_4 * t_8)));
}
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 = t_1 + math.sqrt(x) t_3 = math.sqrt((t + 1.0)) t_4 = t_3 + math.sqrt(t) t_5 = math.sqrt((y + 1.0)) t_6 = t_5 + math.sqrt(y) t_7 = t_5 - math.sqrt(y) t_8 = math.sqrt(z) + math.sqrt((z + 1.0)) tmp = 0 if t_7 <= 0.5: tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * math.sqrt((1.0 / z))) + (t_3 - math.sqrt(t))) else: tmp = (t_1 - math.sqrt(x)) + (t_7 + ((t_4 + t_8) / (t_4 * t_8))) 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(t_1 + sqrt(x)) t_3 = sqrt(Float64(t + 1.0)) t_4 = Float64(t_3 + sqrt(t)) t_5 = sqrt(Float64(y + 1.0)) t_6 = Float64(t_5 + sqrt(y)) t_7 = Float64(t_5 - sqrt(y)) t_8 = Float64(sqrt(z) + sqrt(Float64(z + 1.0))) tmp = 0.0 if (t_7 <= 0.5) tmp = Float64(Float64(Float64(t_6 + t_2) / Float64(t_6 * t_2)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_3 - sqrt(t)))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(t_7 + Float64(Float64(t_4 + t_8) / Float64(t_4 * t_8)))); 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 = t_1 + sqrt(x);
t_3 = sqrt((t + 1.0));
t_4 = t_3 + sqrt(t);
t_5 = sqrt((y + 1.0));
t_6 = t_5 + sqrt(y);
t_7 = t_5 - sqrt(y);
t_8 = sqrt(z) + sqrt((z + 1.0));
tmp = 0.0;
if (t_7 <= 0.5)
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * sqrt((1.0 / z))) + (t_3 - sqrt(t)));
else
tmp = (t_1 - sqrt(x)) + (t_7 + ((t_4 + t_8) / (t_4 * t_8)));
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[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$7, 0.5], N[(N[(N[(t$95$6 + t$95$2), $MachinePrecision] / N[(t$95$6 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$7 + N[(N[(t$95$4 + t$95$8), $MachinePrecision] / N[(t$95$4 * t$95$8), $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 := t\_1 + \sqrt{x}\\
t_3 := \sqrt{t + 1}\\
t_4 := t\_3 + \sqrt{t}\\
t_5 := \sqrt{y + 1}\\
t_6 := t\_5 + \sqrt{y}\\
t_7 := t\_5 - \sqrt{y}\\
t_8 := \sqrt{z} + \sqrt{z + 1}\\
\mathbf{if}\;t\_7 \leq 0.5:\\
\;\;\;\;\frac{t\_6 + t\_2}{t\_6 \cdot t\_2} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_3 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(t\_7 + \frac{t\_4 + t\_8}{t\_4 \cdot t\_8}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 0.5Initial program 82.0%
associate-+l+82.0%
associate-+l-81.4%
associate-+l-82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
Simplified82.0%
+-commutative82.0%
flip--82.8%
flip--82.8%
frac-add82.8%
Applied egg-rr83.6%
Simplified88.3%
Taylor expanded in z around inf 59.0%
if 0.5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 98.2%
associate-+l+98.2%
associate-+l+98.2%
+-commutative98.2%
+-commutative98.2%
associate-+l-78.8%
+-commutative78.8%
+-commutative78.8%
Simplified78.8%
associate--r-98.2%
flip--98.3%
flip--98.3%
frac-add98.3%
Applied egg-rr98.7%
Simplified99.4%
Final simplification80.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)) (sqrt z)))
(t_2 (sqrt (+ t 1.0)))
(t_3 (sqrt (+ x 1.0)))
(t_4 (+ t_3 (sqrt x)))
(t_5 (sqrt (+ y 1.0)))
(t_6 (+ (- t_3 (sqrt x)) (- t_5 (sqrt y))))
(t_7 (+ t_5 (sqrt y))))
(if (<= (+ t_6 t_1) 2.0005)
(+
(/ (+ t_7 t_4) (* t_7 t_4))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_2 (sqrt t))))
(+ t_6 (+ t_1 (/ 1.0 (+ t_2 (sqrt t))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + 1.0)) - sqrt(z);
double t_2 = sqrt((t + 1.0));
double t_3 = sqrt((x + 1.0));
double t_4 = t_3 + sqrt(x);
double t_5 = sqrt((y + 1.0));
double t_6 = (t_3 - sqrt(x)) + (t_5 - sqrt(y));
double t_7 = t_5 + sqrt(y);
double tmp;
if ((t_6 + t_1) <= 2.0005) {
tmp = ((t_7 + t_4) / (t_7 * t_4)) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
} else {
tmp = t_6 + (t_1 + (1.0 / (t_2 + sqrt(t))));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((z + 1.0d0)) - sqrt(z)
t_2 = sqrt((t + 1.0d0))
t_3 = sqrt((x + 1.0d0))
t_4 = t_3 + sqrt(x)
t_5 = sqrt((y + 1.0d0))
t_6 = (t_3 - sqrt(x)) + (t_5 - sqrt(y))
t_7 = t_5 + sqrt(y)
if ((t_6 + t_1) <= 2.0005d0) then
tmp = ((t_7 + t_4) / (t_7 * t_4)) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_2 - sqrt(t)))
else
tmp = t_6 + (t_1 + (1.0d0 / (t_2 + 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((z + 1.0)) - Math.sqrt(z);
double t_2 = Math.sqrt((t + 1.0));
double t_3 = Math.sqrt((x + 1.0));
double t_4 = t_3 + Math.sqrt(x);
double t_5 = Math.sqrt((y + 1.0));
double t_6 = (t_3 - Math.sqrt(x)) + (t_5 - Math.sqrt(y));
double t_7 = t_5 + Math.sqrt(y);
double tmp;
if ((t_6 + t_1) <= 2.0005) {
tmp = ((t_7 + t_4) / (t_7 * t_4)) + ((0.5 * Math.sqrt((1.0 / z))) + (t_2 - Math.sqrt(t)));
} else {
tmp = t_6 + (t_1 + (1.0 / (t_2 + Math.sqrt(t))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((z + 1.0)) - math.sqrt(z) t_2 = math.sqrt((t + 1.0)) t_3 = math.sqrt((x + 1.0)) t_4 = t_3 + math.sqrt(x) t_5 = math.sqrt((y + 1.0)) t_6 = (t_3 - math.sqrt(x)) + (t_5 - math.sqrt(y)) t_7 = t_5 + math.sqrt(y) tmp = 0 if (t_6 + t_1) <= 2.0005: tmp = ((t_7 + t_4) / (t_7 * t_4)) + ((0.5 * math.sqrt((1.0 / z))) + (t_2 - math.sqrt(t))) else: tmp = t_6 + (t_1 + (1.0 / (t_2 + math.sqrt(t)))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + 1.0)) - sqrt(z)) t_2 = sqrt(Float64(t + 1.0)) t_3 = sqrt(Float64(x + 1.0)) t_4 = Float64(t_3 + sqrt(x)) t_5 = sqrt(Float64(y + 1.0)) t_6 = Float64(Float64(t_3 - sqrt(x)) + Float64(t_5 - sqrt(y))) t_7 = Float64(t_5 + sqrt(y)) tmp = 0.0 if (Float64(t_6 + t_1) <= 2.0005) tmp = Float64(Float64(Float64(t_7 + t_4) / Float64(t_7 * t_4)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_2 - sqrt(t)))); else tmp = Float64(t_6 + Float64(t_1 + Float64(1.0 / Float64(t_2 + 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((z + 1.0)) - sqrt(z);
t_2 = sqrt((t + 1.0));
t_3 = sqrt((x + 1.0));
t_4 = t_3 + sqrt(x);
t_5 = sqrt((y + 1.0));
t_6 = (t_3 - sqrt(x)) + (t_5 - sqrt(y));
t_7 = t_5 + sqrt(y);
tmp = 0.0;
if ((t_6 + t_1) <= 2.0005)
tmp = ((t_7 + t_4) / (t_7 * t_4)) + ((0.5 * sqrt((1.0 / z))) + (t_2 - sqrt(t)));
else
tmp = t_6 + (t_1 + (1.0 / (t_2 + 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[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(t + 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[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$3 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$6 + t$95$1), $MachinePrecision], 2.0005], N[(N[(N[(t$95$7 + t$95$4), $MachinePrecision] / N[(t$95$7 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$6 + N[(t$95$1 + N[(1.0 / N[(t$95$2 + 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{z + 1} - \sqrt{z}\\
t_2 := \sqrt{t + 1}\\
t_3 := \sqrt{x + 1}\\
t_4 := t\_3 + \sqrt{x}\\
t_5 := \sqrt{y + 1}\\
t_6 := \left(t\_3 - \sqrt{x}\right) + \left(t\_5 - \sqrt{y}\right)\\
t_7 := t\_5 + \sqrt{y}\\
\mathbf{if}\;t\_6 + t\_1 \leq 2.0005:\\
\;\;\;\;\frac{t\_7 + t\_4}{t\_7 \cdot t\_4} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_2 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_6 + \left(t\_1 + \frac{1}{t\_2 + \sqrt{t}}\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) < 2.00050000000000017Initial program 89.3%
associate-+l+89.3%
associate-+l-65.5%
associate-+l-89.3%
+-commutative89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
+-commutative89.3%
flip--89.7%
flip--89.8%
frac-add89.8%
Applied egg-rr90.2%
Simplified92.9%
Taylor expanded in z around inf 62.0%
if 2.00050000000000017 < (+.f64 (+.f64 (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y))) (-.f64 (sqrt.f64 (+.f64 z #s(literal 1 binary64))) (sqrt.f64 z))) Initial program 98.7%
associate-+l+98.7%
associate-+l-98.7%
associate-+l-98.7%
+-commutative98.7%
+-commutative98.7%
+-commutative98.7%
Simplified98.7%
flip--98.6%
add-sqr-sqrt77.9%
add-sqr-sqrt99.2%
Applied egg-rr99.2%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Final simplification67.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (+ t_1 (sqrt x)))
(t_3 (+ (sqrt z) (sqrt (+ z 1.0))))
(t_4 (sqrt (+ t 1.0)))
(t_5 (sqrt (+ y 1.0)))
(t_6 (+ t_5 (sqrt y)))
(t_7 (+ t_4 (sqrt t))))
(if (<= (- t_5 (sqrt y)) 0.9995)
(+
(/ (+ t_6 t_2) (* t_6 t_2))
(+ (* 0.5 (sqrt (/ 1.0 z))) (- t_4 (sqrt t))))
(+
(- t_1 (sqrt x))
(+ (/ (+ t_7 t_3) (* t_7 t_3)) (+ (- (* y 0.5) (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((x + 1.0));
double t_2 = t_1 + sqrt(x);
double t_3 = sqrt(z) + sqrt((z + 1.0));
double t_4 = sqrt((t + 1.0));
double t_5 = sqrt((y + 1.0));
double t_6 = t_5 + sqrt(y);
double t_7 = t_4 + sqrt(t);
double tmp;
if ((t_5 - sqrt(y)) <= 0.9995) {
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * sqrt((1.0 / z))) + (t_4 - sqrt(t)));
} else {
tmp = (t_1 - sqrt(x)) + (((t_7 + t_3) / (t_7 * t_3)) + (((y * 0.5) - 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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = t_1 + sqrt(x)
t_3 = sqrt(z) + sqrt((z + 1.0d0))
t_4 = sqrt((t + 1.0d0))
t_5 = sqrt((y + 1.0d0))
t_6 = t_5 + sqrt(y)
t_7 = t_4 + sqrt(t)
if ((t_5 - sqrt(y)) <= 0.9995d0) then
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5d0 * sqrt((1.0d0 / z))) + (t_4 - sqrt(t)))
else
tmp = (t_1 - sqrt(x)) + (((t_7 + t_3) / (t_7 * t_3)) + (((y * 0.5d0) - 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((x + 1.0));
double t_2 = t_1 + Math.sqrt(x);
double t_3 = Math.sqrt(z) + Math.sqrt((z + 1.0));
double t_4 = Math.sqrt((t + 1.0));
double t_5 = Math.sqrt((y + 1.0));
double t_6 = t_5 + Math.sqrt(y);
double t_7 = t_4 + Math.sqrt(t);
double tmp;
if ((t_5 - Math.sqrt(y)) <= 0.9995) {
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * Math.sqrt((1.0 / z))) + (t_4 - Math.sqrt(t)));
} else {
tmp = (t_1 - Math.sqrt(x)) + (((t_7 + t_3) / (t_7 * t_3)) + (((y * 0.5) - 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((x + 1.0)) t_2 = t_1 + math.sqrt(x) t_3 = math.sqrt(z) + math.sqrt((z + 1.0)) t_4 = math.sqrt((t + 1.0)) t_5 = math.sqrt((y + 1.0)) t_6 = t_5 + math.sqrt(y) t_7 = t_4 + math.sqrt(t) tmp = 0 if (t_5 - math.sqrt(y)) <= 0.9995: tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * math.sqrt((1.0 / z))) + (t_4 - math.sqrt(t))) else: tmp = (t_1 - math.sqrt(x)) + (((t_7 + t_3) / (t_7 * t_3)) + (((y * 0.5) - 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(x + 1.0)) t_2 = Float64(t_1 + sqrt(x)) t_3 = Float64(sqrt(z) + sqrt(Float64(z + 1.0))) t_4 = sqrt(Float64(t + 1.0)) t_5 = sqrt(Float64(y + 1.0)) t_6 = Float64(t_5 + sqrt(y)) t_7 = Float64(t_4 + sqrt(t)) tmp = 0.0 if (Float64(t_5 - sqrt(y)) <= 0.9995) tmp = Float64(Float64(Float64(t_6 + t_2) / Float64(t_6 * t_2)) + Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(t_4 - sqrt(t)))); else tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(Float64(t_7 + t_3) / Float64(t_7 * t_3)) + Float64(Float64(Float64(y * 0.5) - 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((x + 1.0));
t_2 = t_1 + sqrt(x);
t_3 = sqrt(z) + sqrt((z + 1.0));
t_4 = sqrt((t + 1.0));
t_5 = sqrt((y + 1.0));
t_6 = t_5 + sqrt(y);
t_7 = t_4 + sqrt(t);
tmp = 0.0;
if ((t_5 - sqrt(y)) <= 0.9995)
tmp = ((t_6 + t_2) / (t_6 * t_2)) + ((0.5 * sqrt((1.0 / z))) + (t_4 - sqrt(t)));
else
tmp = (t_1 - sqrt(x)) + (((t_7 + t_3) / (t_7 * t_3)) + (((y * 0.5) - 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[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$4 + N[Sqrt[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$5 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 0.9995], N[(N[(N[(t$95$6 + t$95$2), $MachinePrecision] / N[(t$95$6 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$7 + t$95$3), $MachinePrecision] / N[(t$95$7 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + 1.0), $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 := t\_1 + \sqrt{x}\\
t_3 := \sqrt{z} + \sqrt{z + 1}\\
t_4 := \sqrt{t + 1}\\
t_5 := \sqrt{y + 1}\\
t_6 := t\_5 + \sqrt{y}\\
t_7 := t\_4 + \sqrt{t}\\
\mathbf{if}\;t\_5 - \sqrt{y} \leq 0.9995:\\
\;\;\;\;\frac{t\_6 + t\_2}{t\_6 \cdot t\_2} + \left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(t\_4 - \sqrt{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\frac{t\_7 + t\_3}{t\_7 \cdot t\_3} + \left(\left(y \cdot 0.5 - \sqrt{y}\right) + 1\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 0.99950000000000006Initial program 82.0%
associate-+l+82.0%
associate-+l-81.4%
associate-+l-82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
Simplified82.0%
+-commutative82.0%
flip--82.8%
flip--82.8%
frac-add82.8%
Applied egg-rr83.6%
Simplified88.3%
Taylor expanded in z around inf 59.0%
if 0.99950000000000006 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 98.2%
associate-+l+98.2%
associate-+l+98.2%
+-commutative98.2%
+-commutative98.2%
associate-+l-78.8%
+-commutative78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in y around 0 78.8%
associate--l+78.8%
Simplified78.8%
associate--r-98.2%
flip--98.3%
flip--98.3%
frac-add98.3%
Applied egg-rr98.7%
Simplified99.3%
Final simplification80.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0)))
(t_2 (- (sqrt (+ y 1.0)) (sqrt y)))
(t_3 (sqrt (+ t 1.0)))
(t_4 (sqrt (+ z 1.0))))
(if (<= t_2 2e-5)
(+
(/ 1.0 (+ t_1 (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ t_3 (- (- t_4 (sqrt z)) (sqrt t)))))
(+
(+ (- t_1 (sqrt x)) t_2)
(+ (- t_3 (sqrt t)) (/ 1.0 (+ (sqrt z) t_4)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double t_2 = sqrt((y + 1.0)) - sqrt(y);
double t_3 = sqrt((t + 1.0));
double t_4 = sqrt((z + 1.0));
double tmp;
if (t_2 <= 2e-5) {
tmp = (1.0 / (t_1 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_3 + ((t_4 - sqrt(z)) - sqrt(t))));
} else {
tmp = ((t_1 - sqrt(x)) + t_2) + ((t_3 - sqrt(t)) + (1.0 / (sqrt(z) + t_4)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
t_2 = sqrt((y + 1.0d0)) - sqrt(y)
t_3 = sqrt((t + 1.0d0))
t_4 = sqrt((z + 1.0d0))
if (t_2 <= 2d-5) then
tmp = (1.0d0 / (t_1 + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (t_3 + ((t_4 - sqrt(z)) - sqrt(t))))
else
tmp = ((t_1 - sqrt(x)) + t_2) + ((t_3 - sqrt(t)) + (1.0d0 / (sqrt(z) + t_4)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double t_2 = Math.sqrt((y + 1.0)) - Math.sqrt(y);
double t_3 = Math.sqrt((t + 1.0));
double t_4 = Math.sqrt((z + 1.0));
double tmp;
if (t_2 <= 2e-5) {
tmp = (1.0 / (t_1 + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) + (t_3 + ((t_4 - Math.sqrt(z)) - Math.sqrt(t))));
} else {
tmp = ((t_1 - Math.sqrt(x)) + t_2) + ((t_3 - Math.sqrt(t)) + (1.0 / (Math.sqrt(z) + t_4)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) t_2 = math.sqrt((y + 1.0)) - math.sqrt(y) t_3 = math.sqrt((t + 1.0)) t_4 = math.sqrt((z + 1.0)) tmp = 0 if t_2 <= 2e-5: tmp = (1.0 / (t_1 + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) + (t_3 + ((t_4 - math.sqrt(z)) - math.sqrt(t)))) else: tmp = ((t_1 - math.sqrt(x)) + t_2) + ((t_3 - math.sqrt(t)) + (1.0 / (math.sqrt(z) + t_4))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) t_2 = Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) t_3 = sqrt(Float64(t + 1.0)) t_4 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (t_2 <= 2e-5) tmp = Float64(Float64(1.0 / Float64(t_1 + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(t_3 + Float64(Float64(t_4 - sqrt(z)) - sqrt(t))))); else tmp = Float64(Float64(Float64(t_1 - sqrt(x)) + t_2) + Float64(Float64(t_3 - sqrt(t)) + Float64(1.0 / Float64(sqrt(z) + t_4)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
t_2 = sqrt((y + 1.0)) - sqrt(y);
t_3 = sqrt((t + 1.0));
t_4 = sqrt((z + 1.0));
tmp = 0.0;
if (t_2 <= 2e-5)
tmp = (1.0 / (t_1 + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_3 + ((t_4 - sqrt(z)) - sqrt(t))));
else
tmp = ((t_1 - sqrt(x)) + t_2) + ((t_3 - sqrt(t)) + (1.0 / (sqrt(z) + t_4)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 2e-5], N[(N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$3 + N[(N[(t$95$4 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] + N[(N[(t$95$3 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$4), $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{y + 1} - \sqrt{y}\\
t_3 := \sqrt{t + 1}\\
t_4 := \sqrt{z + 1}\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(t\_3 + \left(\left(t\_4 - \sqrt{z}\right) - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 - \sqrt{x}\right) + t\_2\right) + \left(\left(t\_3 - \sqrt{t}\right) + \frac{1}{\sqrt{z} + t\_4}\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2.00000000000000016e-5Initial program 81.8%
associate-+l+81.8%
associate-+l+81.8%
+-commutative81.8%
+-commutative81.8%
associate-+l-70.5%
+-commutative70.5%
+-commutative70.5%
Simplified70.5%
flip--70.5%
add-sqr-sqrt55.5%
+-commutative55.5%
add-sqr-sqrt70.5%
+-commutative70.5%
Applied egg-rr70.5%
associate--l+72.4%
+-inverses72.4%
metadata-eval72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in y around inf 76.8%
if 2.00000000000000016e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 98.0%
associate-+l+98.0%
associate-+l-61.8%
associate-+l-98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--98.0%
add-sqr-sqrt81.3%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
+-commutative98.8%
Simplified98.8%
Final simplification88.9%
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 (+ t 1.0))) (t_3 (sqrt (+ z 1.0))))
(if (<= (- t_1 (sqrt y)) 2e-5)
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (+ t_2 (- (- t_3 (sqrt z)) (sqrt t)))))
(+
(+ (- t_2 (sqrt t)) (/ 1.0 (+ (sqrt z) t_3)))
(- (+ t_1 1.0) (+ (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((y + 1.0));
double t_2 = sqrt((t + 1.0));
double t_3 = sqrt((z + 1.0));
double tmp;
if ((t_1 - sqrt(y)) <= 2e-5) {
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_2 + ((t_3 - sqrt(z)) - sqrt(t))));
} else {
tmp = ((t_2 - sqrt(t)) + (1.0 / (sqrt(z) + t_3))) + ((t_1 + 1.0) - (sqrt(x) + sqrt(y)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt((y + 1.0d0))
t_2 = sqrt((t + 1.0d0))
t_3 = sqrt((z + 1.0d0))
if ((t_1 - sqrt(y)) <= 2d-5) then
tmp = (1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + ((0.5d0 * sqrt((1.0d0 / y))) + (t_2 + ((t_3 - sqrt(z)) - sqrt(t))))
else
tmp = ((t_2 - sqrt(t)) + (1.0d0 / (sqrt(z) + t_3))) + ((t_1 + 1.0d0) - (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((y + 1.0));
double t_2 = Math.sqrt((t + 1.0));
double t_3 = Math.sqrt((z + 1.0));
double tmp;
if ((t_1 - Math.sqrt(y)) <= 2e-5) {
tmp = (1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + ((0.5 * Math.sqrt((1.0 / y))) + (t_2 + ((t_3 - Math.sqrt(z)) - Math.sqrt(t))));
} else {
tmp = ((t_2 - Math.sqrt(t)) + (1.0 / (Math.sqrt(z) + t_3))) + ((t_1 + 1.0) - (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((y + 1.0)) t_2 = math.sqrt((t + 1.0)) t_3 = math.sqrt((z + 1.0)) tmp = 0 if (t_1 - math.sqrt(y)) <= 2e-5: tmp = (1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + ((0.5 * math.sqrt((1.0 / y))) + (t_2 + ((t_3 - math.sqrt(z)) - math.sqrt(t)))) else: tmp = ((t_2 - math.sqrt(t)) + (1.0 / (math.sqrt(z) + t_3))) + ((t_1 + 1.0) - (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(y + 1.0)) t_2 = sqrt(Float64(t + 1.0)) t_3 = sqrt(Float64(z + 1.0)) tmp = 0.0 if (Float64(t_1 - sqrt(y)) <= 2e-5) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(t_2 + Float64(Float64(t_3 - sqrt(z)) - sqrt(t))))); else tmp = Float64(Float64(Float64(t_2 - sqrt(t)) + Float64(1.0 / Float64(sqrt(z) + t_3))) + Float64(Float64(t_1 + 1.0) - Float64(sqrt(x) + sqrt(y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((y + 1.0));
t_2 = sqrt((t + 1.0));
t_3 = sqrt((z + 1.0));
tmp = 0.0;
if ((t_1 - sqrt(y)) <= 2e-5)
tmp = (1.0 / (sqrt((x + 1.0)) + sqrt(x))) + ((0.5 * sqrt((1.0 / y))) + (t_2 + ((t_3 - sqrt(z)) - sqrt(t))));
else
tmp = ((t_2 - sqrt(t)) + (1.0 / (sqrt(z) + t_3))) + ((t_1 + 1.0) - (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[(y + 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]}, If[LessEqual[N[(t$95$1 - N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 2e-5], 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[(t$95$2 + N[(N[(t$95$3 - N[Sqrt[z], $MachinePrecision]), $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$2 - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + 1.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{y + 1}\\
t_2 := \sqrt{t + 1}\\
t_3 := \sqrt{z + 1}\\
\mathbf{if}\;t\_1 - \sqrt{y} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \left(0.5 \cdot \sqrt{\frac{1}{y}} + \left(t\_2 + \left(\left(t\_3 - \sqrt{z}\right) - \sqrt{t}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_2 - \sqrt{t}\right) + \frac{1}{\sqrt{z} + t\_3}\right) + \left(\left(t\_1 + 1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) < 2.00000000000000016e-5Initial program 81.8%
associate-+l+81.8%
associate-+l+81.8%
+-commutative81.8%
+-commutative81.8%
associate-+l-70.5%
+-commutative70.5%
+-commutative70.5%
Simplified70.5%
flip--70.5%
add-sqr-sqrt55.5%
+-commutative55.5%
add-sqr-sqrt70.5%
+-commutative70.5%
Applied egg-rr70.5%
associate--l+72.4%
+-inverses72.4%
metadata-eval72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in y around inf 76.8%
if 2.00000000000000016e-5 < (-.f64 (sqrt.f64 (+.f64 y #s(literal 1 binary64))) (sqrt.f64 y)) Initial program 98.0%
associate-+l+98.0%
associate-+l-61.8%
associate-+l-98.0%
+-commutative98.0%
+-commutative98.0%
+-commutative98.0%
Simplified98.0%
flip--98.0%
add-sqr-sqrt81.3%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
associate--l+98.8%
+-inverses98.8%
metadata-eval98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in x around 0 49.0%
+-commutative49.0%
Simplified49.0%
Final simplification61.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)) (sqrt x))))
(if (<= t_1 5e-8)
(+
(+ (* 0.5 (sqrt (/ 1.0 z))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (/ 1.0 (sqrt x)))))
(+ t_1 (+ (- (sqrt (+ y 1.0)) (sqrt y)) (- (sqrt (+ z 1.0)) (sqrt z)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t_1 <= 5e-8) {
tmp = ((0.5 * sqrt((1.0 / z))) + (sqrt((t + 1.0)) - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * (1.0 / sqrt(x))));
} else {
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((z + 1.0)) - sqrt(z)));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0)) - sqrt(x)
if (t_1 <= 5d-8) then
tmp = ((0.5d0 * sqrt((1.0d0 / z))) + (sqrt((t + 1.0d0)) - sqrt(t))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * (1.0d0 / sqrt(x))))
else
tmp = t_1 + ((sqrt((y + 1.0d0)) - sqrt(y)) + (sqrt((z + 1.0d0)) - sqrt(z)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t_1 <= 5e-8) {
tmp = ((0.5 * Math.sqrt((1.0 / z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * (1.0 / Math.sqrt(x))));
} else {
tmp = t_1 + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t_1 <= 5e-8: tmp = ((0.5 * math.sqrt((1.0 / z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * (1.0 / math.sqrt(x)))) else: tmp = t_1 + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (math.sqrt((z + 1.0)) - math.sqrt(z))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t_1 <= 5e-8) tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * Float64(1.0 / sqrt(x))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t_1 <= 5e-8)
tmp = ((0.5 * sqrt((1.0 / z))) + (sqrt((t + 1.0)) - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * (1.0 / sqrt(x))));
else
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (sqrt((z + 1.0)) - sqrt(z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-8], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \frac{1}{\sqrt{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 4.9999999999999998e-8Initial program 83.9%
associate-+l+83.9%
associate-+l-43.2%
associate-+l-83.9%
+-commutative83.9%
+-commutative83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in x around inf 85.6%
Taylor expanded in y around inf 40.9%
Taylor expanded in z around inf 29.7%
sqrt-div29.7%
metadata-eval29.7%
Applied egg-rr29.7%
if 4.9999999999999998e-8 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-80.6%
+-commutative80.6%
+-commutative80.6%
Simplified80.6%
Taylor expanded in t around inf 60.1%
Final simplification45.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y 3.6e+17)
(+
(+ (- (sqrt (+ t 1.0)) (sqrt t)) (/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0)))))
(- (+ (sqrt (+ y 1.0)) 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 (y <= 3.6e+17) {
tmp = ((sqrt((t + 1.0)) - sqrt(t)) + (1.0 / (sqrt(z) + sqrt((z + 1.0))))) + ((sqrt((y + 1.0)) + 1.0) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.6d+17) then
tmp = ((sqrt((t + 1.0d0)) - sqrt(t)) + (1.0d0 / (sqrt(z) + sqrt((z + 1.0d0))))) + ((sqrt((y + 1.0d0)) + 1.0d0) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.6e+17) {
tmp = ((Math.sqrt((t + 1.0)) - Math.sqrt(t)) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0))))) + ((Math.sqrt((y + 1.0)) + 1.0) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= 3.6e+17: tmp = ((math.sqrt((t + 1.0)) - math.sqrt(t)) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) + ((math.sqrt((y + 1.0)) + 1.0) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= 3.6e+17) tmp = Float64(Float64(Float64(sqrt(Float64(t + 1.0)) - sqrt(t)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 1.0))))) + Float64(Float64(sqrt(Float64(y + 1.0)) + 1.0) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= 3.6e+17)
tmp = ((sqrt((t + 1.0)) - sqrt(t)) + (1.0 / (sqrt(z) + sqrt((z + 1.0))))) + ((sqrt((y + 1.0)) + 1.0) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, 3.6e+17], N[(N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{+17}:\\
\;\;\;\;\left(\left(\sqrt{t + 1} - \sqrt{t}\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right) + \left(\left(\sqrt{y + 1} + 1\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}}\\
\end{array}
\end{array}
if y < 3.6e17Initial program 96.9%
associate-+l+96.9%
associate-+l-61.8%
associate-+l-96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
flip--96.9%
add-sqr-sqrt79.7%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
associate--l+97.6%
+-inverses97.6%
metadata-eval97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 49.4%
+-commutative49.4%
Simplified49.4%
if 3.6e17 < y Initial program 82.5%
associate-+l+82.5%
associate-+l-82.5%
associate-+l-82.5%
+-commutative82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in t around inf 3.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
add-cube-cbrt25.1%
pow325.2%
Applied egg-rr25.2%
rem-cube-cbrt24.1%
flip-+24.0%
add-sqr-sqrt24.4%
pow224.4%
Applied egg-rr24.4%
associate--l+26.2%
unpow226.2%
sqr-neg26.2%
rem-square-sqrt27.1%
+-inverses27.1%
metadata-eval27.1%
sub-neg27.1%
remove-double-neg27.1%
+-commutative27.1%
Simplified27.1%
Final simplification39.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t 170000000000.0)
(+
t_1
(-
(+ 2.0 (+ (sqrt (+ t 1.0)) (* 0.5 (+ y z))))
(+ (sqrt z) (+ (sqrt t) (sqrt y)))))
(+
t_1
(+
(- (sqrt (+ y 1.0)) (sqrt y))
(/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t <= 170000000000.0) {
tmp = t_1 + ((2.0 + (sqrt((t + 1.0)) + (0.5 * (y + z)))) - (sqrt(z) + (sqrt(t) + sqrt(y))));
} else {
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 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((x + 1.0d0)) - sqrt(x)
if (t <= 170000000000.0d0) then
tmp = t_1 + ((2.0d0 + (sqrt((t + 1.0d0)) + (0.5d0 * (y + z)))) - (sqrt(z) + (sqrt(t) + sqrt(y))))
else
tmp = t_1 + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((z + 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((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t <= 170000000000.0) {
tmp = t_1 + ((2.0 + (Math.sqrt((t + 1.0)) + (0.5 * (y + z)))) - (Math.sqrt(z) + (Math.sqrt(t) + Math.sqrt(y))));
} else {
tmp = t_1 + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t <= 170000000000.0: tmp = t_1 + ((2.0 + (math.sqrt((t + 1.0)) + (0.5 * (y + z)))) - (math.sqrt(z) + (math.sqrt(t) + math.sqrt(y)))) else: tmp = t_1 + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t <= 170000000000.0) tmp = Float64(t_1 + Float64(Float64(2.0 + Float64(sqrt(Float64(t + 1.0)) + Float64(0.5 * Float64(y + z)))) - Float64(sqrt(z) + Float64(sqrt(t) + sqrt(y))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 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((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t <= 170000000000.0)
tmp = t_1 + ((2.0 + (sqrt((t + 1.0)) + (0.5 * (y + z)))) - (sqrt(z) + (sqrt(t) + sqrt(y))));
else
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 170000000000.0], N[(t$95$1 + N[(N[(2.0 + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t \leq 170000000000:\\
\;\;\;\;t\_1 + \left(\left(2 + \left(\sqrt{t + 1} + 0.5 \cdot \left(y + z\right)\right)\right) - \left(\sqrt{z} + \left(\sqrt{t} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right)\\
\end{array}
\end{array}
if t < 1.7e11Initial program 97.7%
associate-+l+97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
associate-+l-97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in y around 0 58.3%
associate--l+58.3%
Simplified58.3%
Taylor expanded in z around 0 32.3%
distribute-lft-out32.3%
associate-+r+32.3%
+-commutative32.3%
Simplified32.3%
if 1.7e11 < t Initial program 82.8%
associate-+l+82.8%
associate-+l+82.8%
+-commutative82.8%
+-commutative82.8%
associate-+l-49.1%
+-commutative49.1%
+-commutative49.1%
Simplified49.1%
associate--r-82.8%
flip--83.0%
flip--83.3%
frac-add83.3%
Applied egg-rr83.4%
Simplified92.3%
Taylor expanded in t around inf 87.3%
Final simplification58.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (sqrt (+ x 1.0)) (sqrt x))))
(if (<= t 170000000000.0)
(+
t_1
(-
(+ 2.0 (+ (sqrt (+ t 1.0)) (* y 0.5)))
(+ (sqrt t) (+ (sqrt z) (sqrt y)))))
(+
t_1
(+
(- (sqrt (+ y 1.0)) (sqrt y))
(/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t <= 170000000000.0) {
tmp = t_1 + ((2.0 + (sqrt((t + 1.0)) + (y * 0.5))) - (sqrt(t) + (sqrt(z) + sqrt(y))));
} else {
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 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((x + 1.0d0)) - sqrt(x)
if (t <= 170000000000.0d0) then
tmp = t_1 + ((2.0d0 + (sqrt((t + 1.0d0)) + (y * 0.5d0))) - (sqrt(t) + (sqrt(z) + sqrt(y))))
else
tmp = t_1 + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((z + 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((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t <= 170000000000.0) {
tmp = t_1 + ((2.0 + (Math.sqrt((t + 1.0)) + (y * 0.5))) - (Math.sqrt(t) + (Math.sqrt(z) + Math.sqrt(y))));
} else {
tmp = t_1 + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t <= 170000000000.0: tmp = t_1 + ((2.0 + (math.sqrt((t + 1.0)) + (y * 0.5))) - (math.sqrt(t) + (math.sqrt(z) + math.sqrt(y)))) else: tmp = t_1 + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t <= 170000000000.0) tmp = Float64(t_1 + Float64(Float64(2.0 + Float64(sqrt(Float64(t + 1.0)) + Float64(y * 0.5))) - Float64(sqrt(t) + Float64(sqrt(z) + sqrt(y))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 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((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t <= 170000000000.0)
tmp = t_1 + ((2.0 + (sqrt((t + 1.0)) + (y * 0.5))) - (sqrt(t) + (sqrt(z) + sqrt(y))));
else
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 170000000000.0], N[(t$95$1 + N[(N[(2.0 + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[t], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t \leq 170000000000:\\
\;\;\;\;t\_1 + \left(\left(2 + \left(\sqrt{t + 1} + y \cdot 0.5\right)\right) - \left(\sqrt{t} + \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right)\\
\end{array}
\end{array}
if t < 1.7e11Initial program 97.7%
associate-+l+97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
associate-+l-97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in y around 0 58.3%
associate--l+58.3%
Simplified58.3%
Taylor expanded in z around 0 30.8%
if 1.7e11 < t Initial program 82.8%
associate-+l+82.8%
associate-+l+82.8%
+-commutative82.8%
+-commutative82.8%
associate-+l-49.1%
+-commutative49.1%
+-commutative49.1%
Simplified49.1%
associate--r-82.8%
flip--83.0%
flip--83.3%
frac-add83.3%
Applied egg-rr83.4%
Simplified92.3%
Taylor expanded in t around inf 87.3%
Final simplification57.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)) (sqrt x))))
(if (<= t 170000000000.0)
(+
t_1
(+
2.0
(- (+ (sqrt (+ t 1.0)) (* y 0.5)) (+ (sqrt z) (+ (sqrt t) (sqrt y))))))
(+
t_1
(+
(- (sqrt (+ y 1.0)) (sqrt y))
(/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0)))))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0)) - sqrt(x);
double tmp;
if (t <= 170000000000.0) {
tmp = t_1 + (2.0 + ((sqrt((t + 1.0)) + (y * 0.5)) - (sqrt(z) + (sqrt(t) + sqrt(y)))));
} else {
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 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((x + 1.0d0)) - sqrt(x)
if (t <= 170000000000.0d0) then
tmp = t_1 + (2.0d0 + ((sqrt((t + 1.0d0)) + (y * 0.5d0)) - (sqrt(z) + (sqrt(t) + sqrt(y)))))
else
tmp = t_1 + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((z + 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((x + 1.0)) - Math.sqrt(x);
double tmp;
if (t <= 170000000000.0) {
tmp = t_1 + (2.0 + ((Math.sqrt((t + 1.0)) + (y * 0.5)) - (Math.sqrt(z) + (Math.sqrt(t) + Math.sqrt(y)))));
} else {
tmp = t_1 + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) - math.sqrt(x) tmp = 0 if t <= 170000000000.0: tmp = t_1 + (2.0 + ((math.sqrt((t + 1.0)) + (y * 0.5)) - (math.sqrt(z) + (math.sqrt(t) + math.sqrt(y))))) else: tmp = t_1 + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) tmp = 0.0 if (t <= 170000000000.0) tmp = Float64(t_1 + Float64(2.0 + Float64(Float64(sqrt(Float64(t + 1.0)) + Float64(y * 0.5)) - Float64(sqrt(z) + Float64(sqrt(t) + sqrt(y)))))); else tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 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((x + 1.0)) - sqrt(x);
tmp = 0.0;
if (t <= 170000000000.0)
tmp = t_1 + (2.0 + ((sqrt((t + 1.0)) + (y * 0.5)) - (sqrt(z) + (sqrt(t) + sqrt(y)))));
else
tmp = t_1 + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 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[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 170000000000.0], N[(t$95$1 + N[(2.0 + N[(N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] + N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[t], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1} - \sqrt{x}\\
\mathbf{if}\;t \leq 170000000000:\\
\;\;\;\;t\_1 + \left(2 + \left(\left(\sqrt{t + 1} + y \cdot 0.5\right) - \left(\sqrt{z} + \left(\sqrt{t} + \sqrt{y}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right)\\
\end{array}
\end{array}
if t < 1.7e11Initial program 97.7%
associate-+l+97.7%
associate-+l+97.7%
+-commutative97.7%
+-commutative97.7%
associate-+l-97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in y around 0 58.3%
associate--l+58.3%
Simplified58.3%
Taylor expanded in z around 0 30.8%
associate--l+30.8%
*-commutative30.8%
associate-+r+30.8%
+-commutative30.8%
Simplified30.8%
if 1.7e11 < t Initial program 82.8%
associate-+l+82.8%
associate-+l+82.8%
+-commutative82.8%
+-commutative82.8%
associate-+l-49.1%
+-commutative49.1%
+-commutative49.1%
Simplified49.1%
associate--r-82.8%
flip--83.0%
flip--83.3%
frac-add83.3%
Applied egg-rr83.4%
Simplified92.3%
Taylor expanded in t around inf 87.3%
Final simplification57.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= x 1.35e+14)
(+
(- (sqrt (+ x 1.0)) (sqrt x))
(+ (- (sqrt (+ y 1.0)) (sqrt y)) (/ 1.0 (+ (sqrt z) (sqrt (+ z 1.0))))))
(+
(+ (* 0.5 (sqrt (/ 1.0 z))) (- (sqrt (+ t 1.0)) (sqrt t)))
(+ (* 0.5 (sqrt (/ 1.0 y))) (* 0.5 (/ 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.35e+14) {
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 1.0)))));
} else {
tmp = ((0.5 * sqrt((1.0 / z))) + (sqrt((t + 1.0)) - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * (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.35d+14) then
tmp = (sqrt((x + 1.0d0)) - sqrt(x)) + ((sqrt((y + 1.0d0)) - sqrt(y)) + (1.0d0 / (sqrt(z) + sqrt((z + 1.0d0)))))
else
tmp = ((0.5d0 * sqrt((1.0d0 / z))) + (sqrt((t + 1.0d0)) - sqrt(t))) + ((0.5d0 * sqrt((1.0d0 / y))) + (0.5d0 * (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.35e+14) {
tmp = (Math.sqrt((x + 1.0)) - Math.sqrt(x)) + ((Math.sqrt((y + 1.0)) - Math.sqrt(y)) + (1.0 / (Math.sqrt(z) + Math.sqrt((z + 1.0)))));
} else {
tmp = ((0.5 * Math.sqrt((1.0 / z))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t))) + ((0.5 * Math.sqrt((1.0 / y))) + (0.5 * (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.35e+14: tmp = (math.sqrt((x + 1.0)) - math.sqrt(x)) + ((math.sqrt((y + 1.0)) - math.sqrt(y)) + (1.0 / (math.sqrt(z) + math.sqrt((z + 1.0))))) else: tmp = ((0.5 * math.sqrt((1.0 / z))) + (math.sqrt((t + 1.0)) - math.sqrt(t))) + ((0.5 * math.sqrt((1.0 / y))) + (0.5 * (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.35e+14) tmp = Float64(Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) + Float64(Float64(sqrt(Float64(y + 1.0)) - sqrt(y)) + Float64(1.0 / Float64(sqrt(z) + sqrt(Float64(z + 1.0)))))); else tmp = Float64(Float64(Float64(0.5 * sqrt(Float64(1.0 / z))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) + Float64(Float64(0.5 * sqrt(Float64(1.0 / y))) + Float64(0.5 * Float64(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.35e+14)
tmp = (sqrt((x + 1.0)) - sqrt(x)) + ((sqrt((y + 1.0)) - sqrt(y)) + (1.0 / (sqrt(z) + sqrt((z + 1.0)))));
else
tmp = ((0.5 * sqrt((1.0 / z))) + (sqrt((t + 1.0)) - sqrt(t))) + ((0.5 * sqrt((1.0 / y))) + (0.5 * (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.35e+14], N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[Sqrt[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+14}:\\
\;\;\;\;\left(\sqrt{x + 1} - \sqrt{x}\right) + \left(\left(\sqrt{y + 1} - \sqrt{y}\right) + \frac{1}{\sqrt{z} + \sqrt{z + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sqrt{\frac{1}{z}} + \left(\sqrt{t + 1} - \sqrt{t}\right)\right) + \left(0.5 \cdot \sqrt{\frac{1}{y}} + 0.5 \cdot \frac{1}{\sqrt{x}}\right)\\
\end{array}
\end{array}
if x < 1.35e14Initial program 97.3%
associate-+l+97.3%
associate-+l+97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l-80.6%
+-commutative80.6%
+-commutative80.6%
Simplified80.6%
associate--r-97.3%
flip--97.3%
flip--97.5%
frac-add97.5%
Applied egg-rr98.0%
Simplified98.5%
Taylor expanded in t around inf 60.8%
if 1.35e14 < x Initial program 83.9%
associate-+l+83.9%
associate-+l-43.2%
associate-+l-83.9%
+-commutative83.9%
+-commutative83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in x around inf 85.6%
Taylor expanded in y around inf 40.9%
Taylor expanded in z around inf 29.7%
sqrt-div29.7%
metadata-eval29.7%
Applied egg-rr29.7%
Final simplification45.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))))
(if (<= y 1.95e-17)
(+
(- t_1 (sqrt x))
(+ (+ (- (* y 0.5) (sqrt y)) 1.0) (- (sqrt (+ z 1.0)) (sqrt z))))
(if (<= y 1.25e+15)
(+
t_1
(-
(+ (sqrt (+ y 1.0)) (* 0.5 (sqrt (/ 1.0 z))))
(+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 1.95e-17) {
tmp = (t_1 - sqrt(x)) + ((((y * 0.5) - sqrt(y)) + 1.0) + (sqrt((z + 1.0)) - sqrt(z)));
} else if (y <= 1.25e+15) {
tmp = t_1 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if (y <= 1.95d-17) then
tmp = (t_1 - sqrt(x)) + ((((y * 0.5d0) - sqrt(y)) + 1.0d0) + (sqrt((z + 1.0d0)) - sqrt(z)))
else if (y <= 1.25d+15) then
tmp = t_1 + ((sqrt((y + 1.0d0)) + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 1.95e-17) {
tmp = (t_1 - Math.sqrt(x)) + ((((y * 0.5) - Math.sqrt(y)) + 1.0) + (Math.sqrt((z + 1.0)) - Math.sqrt(z)));
} else if (y <= 1.25e+15) {
tmp = t_1 + ((Math.sqrt((y + 1.0)) + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 1.95e-17: tmp = (t_1 - math.sqrt(x)) + ((((y * 0.5) - math.sqrt(y)) + 1.0) + (math.sqrt((z + 1.0)) - math.sqrt(z))) elif y <= 1.25e+15: tmp = t_1 + ((math.sqrt((y + 1.0)) + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 1.95e-17) tmp = Float64(Float64(t_1 - sqrt(x)) + Float64(Float64(Float64(Float64(y * 0.5) - sqrt(y)) + 1.0) + Float64(sqrt(Float64(z + 1.0)) - sqrt(z)))); elseif (y <= 1.25e+15) tmp = Float64(t_1 + Float64(Float64(sqrt(Float64(y + 1.0)) + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 1.95e-17)
tmp = (t_1 - sqrt(x)) + ((((y * 0.5) - sqrt(y)) + 1.0) + (sqrt((z + 1.0)) - sqrt(z)));
elseif (y <= 1.25e+15)
tmp = t_1 + ((sqrt((y + 1.0)) + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.95e-17], N[(N[(t$95$1 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(y * 0.5), $MachinePrecision] - N[Sqrt[y], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+15], N[(t$95$1 + N[(N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 1.95 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_1 - \sqrt{x}\right) + \left(\left(\left(y \cdot 0.5 - \sqrt{y}\right) + 1\right) + \left(\sqrt{z + 1} - \sqrt{z}\right)\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\left(\sqrt{y + 1} + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.94999999999999995e-17Initial program 98.3%
associate-+l+98.3%
associate-+l+98.3%
+-commutative98.3%
+-commutative98.3%
associate-+l-79.3%
+-commutative79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in y around 0 79.3%
associate--l+79.3%
Simplified79.3%
Taylor expanded in t around inf 53.7%
if 1.94999999999999995e-17 < y < 1.25e15Initial program 83.6%
associate-+l+83.6%
associate-+l-67.4%
associate-+l-83.6%
+-commutative83.6%
+-commutative83.6%
+-commutative83.6%
Simplified83.6%
Taylor expanded in t around inf 23.1%
associate--l+32.2%
+-commutative32.2%
+-commutative32.2%
Simplified32.2%
Taylor expanded in z around inf 34.2%
if 1.25e15 < y Initial program 82.5%
associate-+l+82.5%
associate-+l-82.5%
associate-+l-82.5%
+-commutative82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in t around inf 3.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
add-cube-cbrt25.1%
pow325.2%
Applied egg-rr25.2%
rem-cube-cbrt24.1%
flip-+24.0%
add-sqr-sqrt24.4%
pow224.4%
Applied egg-rr24.4%
associate--l+26.2%
unpow226.2%
sqr-neg26.2%
rem-square-sqrt27.1%
+-inverses27.1%
metadata-eval27.1%
sub-neg27.1%
remove-double-neg27.1%
+-commutative27.1%
Simplified27.1%
Final simplification41.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ y 1.0))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 1.36e-17)
(+ (+ t_1 (- (sqrt (+ z 1.0)) (+ (sqrt x) (+ (sqrt z) (sqrt y))))) 1.0)
(if (<= y 3.7e+15)
(+ t_2 (- (+ t_1 (* 0.5 (sqrt (/ 1.0 z)))) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_2 (sqrt x)))))))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 (y <= 1.36e-17) {
tmp = (t_1 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(z) + sqrt(y))))) + 1.0;
} else if (y <= 3.7e+15) {
tmp = t_2 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_2 + 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((y + 1.0d0))
t_2 = sqrt((x + 1.0d0))
if (y <= 1.36d-17) then
tmp = (t_1 + (sqrt((z + 1.0d0)) - (sqrt(x) + (sqrt(z) + sqrt(y))))) + 1.0d0
else if (y <= 3.7d+15) then
tmp = t_2 + ((t_1 + (0.5d0 * sqrt((1.0d0 / z)))) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (t_2 + 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((y + 1.0));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 1.36e-17) {
tmp = (t_1 + (Math.sqrt((z + 1.0)) - (Math.sqrt(x) + (Math.sqrt(z) + Math.sqrt(y))))) + 1.0;
} else if (y <= 3.7e+15) {
tmp = t_2 + ((t_1 + (0.5 * Math.sqrt((1.0 / z)))) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_2 + Math.sqrt(x));
}
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 y <= 1.36e-17: tmp = (t_1 + (math.sqrt((z + 1.0)) - (math.sqrt(x) + (math.sqrt(z) + math.sqrt(y))))) + 1.0 elif y <= 3.7e+15: tmp = t_2 + ((t_1 + (0.5 * math.sqrt((1.0 / z)))) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_2 + math.sqrt(x)) 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 (y <= 1.36e-17) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(x) + Float64(sqrt(z) + sqrt(y))))) + 1.0); elseif (y <= 3.7e+15) tmp = Float64(t_2 + Float64(Float64(t_1 + Float64(0.5 * sqrt(Float64(1.0 / z)))) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_2 + 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((y + 1.0));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 1.36e-17)
tmp = (t_1 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(z) + sqrt(y))))) + 1.0;
elseif (y <= 3.7e+15)
tmp = t_2 + ((t_1 + (0.5 * sqrt((1.0 / z)))) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_2 + 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.36e-17], N[(N[(t$95$1 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[y, 3.7e+15], N[(t$95$2 + N[(N[(t$95$1 + N[(0.5 * N[Sqrt[N[(1.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$2 + 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{y + 1}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 1.36 \cdot 10^{-17}:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{z + 1} - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\right) + 1\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+15}:\\
\;\;\;\;t\_2 + \left(\left(t\_1 + 0.5 \cdot \sqrt{\frac{1}{z}}\right) - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 1.36e-17Initial program 98.3%
associate-+l+98.3%
associate-+l-61.5%
associate-+l-98.3%
+-commutative98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in t around inf 21.1%
associate--l+24.2%
+-commutative24.2%
+-commutative24.2%
Simplified24.2%
Taylor expanded in x around 0 17.0%
associate--l+24.8%
associate--l+32.4%
Simplified32.4%
if 1.36e-17 < y < 3.7e15Initial program 84.7%
associate-+l+84.7%
associate-+l-64.3%
associate-+l-84.7%
+-commutative84.7%
+-commutative84.7%
+-commutative84.7%
Simplified84.7%
Taylor expanded in t around inf 21.7%
associate--l+30.3%
+-commutative30.3%
+-commutative30.3%
Simplified30.3%
Taylor expanded in z around inf 32.6%
if 3.7e15 < y Initial program 82.5%
associate-+l+82.5%
associate-+l-82.5%
associate-+l-82.5%
+-commutative82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in t around inf 3.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
add-cube-cbrt25.1%
pow325.2%
Applied egg-rr25.2%
rem-cube-cbrt24.1%
flip-+24.0%
add-sqr-sqrt24.4%
pow224.4%
Applied egg-rr24.4%
associate--l+26.2%
unpow226.2%
sqr-neg26.2%
rem-square-sqrt27.1%
+-inverses27.1%
metadata-eval27.1%
sub-neg27.1%
remove-double-neg27.1%
+-commutative27.1%
Simplified27.1%
Final simplification30.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 (+ y 1.0))) (t_2 (sqrt (+ x 1.0))))
(if (<= y 7.2e-19)
(+ (+ t_1 (- (sqrt (+ z 1.0)) (+ (sqrt x) (+ (sqrt z) (sqrt y))))) 1.0)
(if (<= y 5e+15)
(+ t_2 (- t_1 (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_2 (sqrt x)))))))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 (y <= 7.2e-19) {
tmp = (t_1 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(z) + sqrt(y))))) + 1.0;
} else if (y <= 5e+15) {
tmp = t_2 + (t_1 - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_2 + 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((y + 1.0d0))
t_2 = sqrt((x + 1.0d0))
if (y <= 7.2d-19) then
tmp = (t_1 + (sqrt((z + 1.0d0)) - (sqrt(x) + (sqrt(z) + sqrt(y))))) + 1.0d0
else if (y <= 5d+15) then
tmp = t_2 + (t_1 - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (t_2 + 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((y + 1.0));
double t_2 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 7.2e-19) {
tmp = (t_1 + (Math.sqrt((z + 1.0)) - (Math.sqrt(x) + (Math.sqrt(z) + Math.sqrt(y))))) + 1.0;
} else if (y <= 5e+15) {
tmp = t_2 + (t_1 - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_2 + Math.sqrt(x));
}
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 y <= 7.2e-19: tmp = (t_1 + (math.sqrt((z + 1.0)) - (math.sqrt(x) + (math.sqrt(z) + math.sqrt(y))))) + 1.0 elif y <= 5e+15: tmp = t_2 + (t_1 - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_2 + math.sqrt(x)) 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 (y <= 7.2e-19) tmp = Float64(Float64(t_1 + Float64(sqrt(Float64(z + 1.0)) - Float64(sqrt(x) + Float64(sqrt(z) + sqrt(y))))) + 1.0); elseif (y <= 5e+15) tmp = Float64(t_2 + Float64(t_1 - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_2 + 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((y + 1.0));
t_2 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 7.2e-19)
tmp = (t_1 + (sqrt((z + 1.0)) - (sqrt(x) + (sqrt(z) + sqrt(y))))) + 1.0;
elseif (y <= 5e+15)
tmp = t_2 + (t_1 - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_2 + 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[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 7.2e-19], N[(N[(t$95$1 + N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[y, 5e+15], N[(t$95$2 + N[(t$95$1 - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$2 + 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{y + 1}\\
t_2 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 7.2 \cdot 10^{-19}:\\
\;\;\;\;\left(t\_1 + \left(\sqrt{z + 1} - \left(\sqrt{x} + \left(\sqrt{z} + \sqrt{y}\right)\right)\right)\right) + 1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+15}:\\
\;\;\;\;t\_2 + \left(t\_1 - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_2 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 7.2000000000000002e-19Initial program 98.3%
associate-+l+98.3%
associate-+l-61.8%
associate-+l-98.3%
+-commutative98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in t around inf 21.2%
associate--l+24.4%
+-commutative24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in x around 0 17.1%
associate--l+25.0%
associate--l+32.7%
Simplified32.7%
if 7.2000000000000002e-19 < y < 5e15Initial program 85.7%
associate-+l+85.7%
associate-+l-61.5%
associate-+l-85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in t around inf 20.6%
associate--l+28.6%
+-commutative28.6%
+-commutative28.6%
Simplified28.6%
Taylor expanded in z around inf 32.7%
if 5e15 < y Initial program 82.5%
associate-+l+82.5%
associate-+l-82.5%
associate-+l-82.5%
+-commutative82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in t around inf 3.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
add-cube-cbrt25.1%
pow325.2%
Applied egg-rr25.2%
rem-cube-cbrt24.1%
flip-+24.0%
add-sqr-sqrt24.4%
pow224.4%
Applied egg-rr24.4%
associate--l+26.2%
unpow226.2%
sqr-neg26.2%
rem-square-sqrt27.1%
+-inverses27.1%
metadata-eval27.1%
sub-neg27.1%
remove-double-neg27.1%
+-commutative27.1%
Simplified27.1%
Final simplification30.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) (sqrt y)))
(t_2 (sqrt (+ x 1.0)))
(t_3 (sqrt (+ y 1.0))))
(if (<= z 1.45) (+ t_2 (- (+ t_3 1.0) t_1)) (+ t_2 (- t_3 t_1)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt(x) + sqrt(y);
double t_2 = sqrt((x + 1.0));
double t_3 = sqrt((y + 1.0));
double tmp;
if (z <= 1.45) {
tmp = t_2 + ((t_3 + 1.0) - t_1);
} else {
tmp = t_2 + (t_3 - t_1);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt(x) + sqrt(y)
t_2 = sqrt((x + 1.0d0))
t_3 = sqrt((y + 1.0d0))
if (z <= 1.45d0) then
tmp = t_2 + ((t_3 + 1.0d0) - t_1)
else
tmp = t_2 + (t_3 - t_1)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(x) + Math.sqrt(y);
double t_2 = Math.sqrt((x + 1.0));
double t_3 = Math.sqrt((y + 1.0));
double tmp;
if (z <= 1.45) {
tmp = t_2 + ((t_3 + 1.0) - t_1);
} else {
tmp = t_2 + (t_3 - t_1);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt(x) + math.sqrt(y) t_2 = math.sqrt((x + 1.0)) t_3 = math.sqrt((y + 1.0)) tmp = 0 if z <= 1.45: tmp = t_2 + ((t_3 + 1.0) - t_1) else: tmp = t_2 + (t_3 - t_1) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = Float64(sqrt(x) + sqrt(y)) t_2 = sqrt(Float64(x + 1.0)) t_3 = sqrt(Float64(y + 1.0)) tmp = 0.0 if (z <= 1.45) tmp = Float64(t_2 + Float64(Float64(t_3 + 1.0) - t_1)); else tmp = Float64(t_2 + Float64(t_3 - t_1)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt(x) + sqrt(y);
t_2 = sqrt((x + 1.0));
t_3 = sqrt((y + 1.0));
tmp = 0.0;
if (z <= 1.45)
tmp = t_2 + ((t_3 + 1.0) - t_1);
else
tmp = t_2 + (t_3 - t_1);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, 1.45], N[(t$95$2 + N[(N[(t$95$3 + 1.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(t$95$3 - t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x} + \sqrt{y}\\
t_2 := \sqrt{x + 1}\\
t_3 := \sqrt{y + 1}\\
\mathbf{if}\;z \leq 1.45:\\
\;\;\;\;t\_2 + \left(\left(t\_3 + 1\right) - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(t\_3 - t\_1\right)\\
\end{array}
\end{array}
if z < 1.44999999999999996Initial program 97.9%
associate-+l+97.9%
associate-+l-75.2%
associate-+l-97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 23.5%
associate--l+26.2%
+-commutative26.2%
+-commutative26.2%
Simplified26.2%
Taylor expanded in y around inf 26.0%
Taylor expanded in z around 0 26.0%
if 1.44999999999999996 < z Initial program 84.6%
associate-+l+84.6%
associate-+l-66.9%
associate-+l-84.6%
+-commutative84.6%
+-commutative84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in t around inf 5.4%
associate--l+23.3%
+-commutative23.3%
+-commutative23.3%
Simplified23.3%
Taylor expanded in z around inf 33.1%
Final simplification29.8%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ x 1.0))))
(if (<= y 4.5e+15)
(+ t_1 (- (sqrt (+ y 1.0)) (+ (sqrt x) (sqrt y))))
(/ 1.0 (+ t_1 (sqrt x))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double t_1 = sqrt((x + 1.0));
double tmp;
if (y <= 4.5e+15) {
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y)));
} else {
tmp = 1.0 / (t_1 + sqrt(x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((x + 1.0d0))
if (y <= 4.5d+15) then
tmp = t_1 + (sqrt((y + 1.0d0)) - (sqrt(x) + sqrt(y)))
else
tmp = 1.0d0 / (t_1 + sqrt(x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((x + 1.0));
double tmp;
if (y <= 4.5e+15) {
tmp = t_1 + (Math.sqrt((y + 1.0)) - (Math.sqrt(x) + Math.sqrt(y)));
} else {
tmp = 1.0 / (t_1 + Math.sqrt(x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): t_1 = math.sqrt((x + 1.0)) tmp = 0 if y <= 4.5e+15: tmp = t_1 + (math.sqrt((y + 1.0)) - (math.sqrt(x) + math.sqrt(y))) else: tmp = 1.0 / (t_1 + math.sqrt(x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) t_1 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (y <= 4.5e+15) tmp = Float64(t_1 + Float64(sqrt(Float64(y + 1.0)) - Float64(sqrt(x) + sqrt(y)))); else tmp = Float64(1.0 / Float64(t_1 + sqrt(x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
t_1 = sqrt((x + 1.0));
tmp = 0.0;
if (y <= 4.5e+15)
tmp = t_1 + (sqrt((y + 1.0)) - (sqrt(x) + sqrt(y)));
else
tmp = 1.0 / (t_1 + sqrt(x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.5e+15], N[(t$95$1 + N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] - N[(N[Sqrt[x], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt{x + 1}\\
\mathbf{if}\;y \leq 4.5 \cdot 10^{+15}:\\
\;\;\;\;t\_1 + \left(\sqrt{y + 1} - \left(\sqrt{x} + \sqrt{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + \sqrt{x}}\\
\end{array}
\end{array}
if y < 4.5e15Initial program 96.9%
associate-+l+96.9%
associate-+l-61.8%
associate-+l-96.9%
+-commutative96.9%
+-commutative96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in t around inf 21.2%
associate--l+24.8%
+-commutative24.8%
+-commutative24.8%
Simplified24.8%
Taylor expanded in z around inf 23.1%
if 4.5e15 < y Initial program 82.5%
associate-+l+82.5%
associate-+l-82.5%
associate-+l-82.5%
+-commutative82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in t around inf 3.9%
associate--l+24.5%
+-commutative24.5%
+-commutative24.5%
Simplified24.5%
Taylor expanded in x around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
add-cube-cbrt25.1%
pow325.2%
Applied egg-rr25.2%
rem-cube-cbrt24.1%
flip-+24.0%
add-sqr-sqrt24.4%
pow224.4%
Applied egg-rr24.4%
associate--l+26.2%
unpow226.2%
sqr-neg26.2%
rem-square-sqrt27.1%
+-inverses27.1%
metadata-eval27.1%
sub-neg27.1%
remove-double-neg27.1%
+-commutative27.1%
Simplified27.1%
Final simplification24.8%
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 58000000.0) (- (sqrt (+ x 1.0)) (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 58000000.0) {
tmp = sqrt((x + 1.0)) - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 58000000.0d0) then
tmp = sqrt((x + 1.0d0)) - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 58000000.0) {
tmp = Math.sqrt((x + 1.0)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 58000000.0: tmp = math.sqrt((x + 1.0)) - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 58000000.0) tmp = Float64(sqrt(Float64(x + 1.0)) - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 58000000.0)
tmp = sqrt((x + 1.0)) - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 58000000.0], N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 58000000:\\
\;\;\;\;\sqrt{x + 1} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 5.8e7Initial program 97.6%
associate-+l+97.6%
associate-+l-97.6%
associate-+l-97.6%
+-commutative97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in t around inf 21.0%
associate--l+42.1%
+-commutative42.1%
+-commutative42.1%
Simplified42.1%
Taylor expanded in x around inf 30.5%
mul-1-neg30.5%
Simplified30.5%
unsub-neg30.5%
Applied egg-rr30.5%
if 5.8e7 < x Initial program 83.9%
associate-+l+83.9%
associate-+l-43.8%
associate-+l-83.9%
+-commutative83.9%
+-commutative83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in t around inf 6.5%
associate--l+7.3%
+-commutative7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 3.3%
mul-1-neg3.3%
Simplified3.3%
Taylor expanded in x around inf 7.8%
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 (/ 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) {
return 1.0 / (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 = 1.0d0 / (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 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 / 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 = 1.0 / (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[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{1}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
Initial program 90.7%
associate-+l+90.7%
associate-+l-70.7%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 13.7%
associate--l+24.7%
+-commutative24.7%
+-commutative24.7%
Simplified24.7%
Taylor expanded in x around inf 16.9%
mul-1-neg16.9%
Simplified16.9%
add-cube-cbrt17.9%
pow317.9%
Applied egg-rr17.9%
rem-cube-cbrt16.9%
flip-+16.9%
add-sqr-sqrt17.1%
pow217.1%
Applied egg-rr17.1%
associate--l+18.4%
unpow218.4%
sqr-neg18.4%
rem-square-sqrt19.1%
+-inverses19.1%
metadata-eval19.1%
sub-neg19.1%
remove-double-neg19.1%
+-commutative19.1%
Simplified19.1%
Final simplification19.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 1.0) (+ (- (* 0.5 x) (sqrt x)) 1.0) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = ((0.5 * x) - sqrt(x)) + 1.0;
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.0d0) then
tmp = ((0.5d0 * x) - sqrt(x)) + 1.0d0
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.0) {
tmp = ((0.5 * x) - Math.sqrt(x)) + 1.0;
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 1.0: tmp = ((0.5 * x) - math.sqrt(x)) + 1.0 else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(Float64(0.5 * x) - sqrt(x)) + 1.0); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 1.0)
tmp = ((0.5 * x) - sqrt(x)) + 1.0;
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 1.0], N[(N[(N[(0.5 * x), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(0.5 \cdot x - \sqrt{x}\right) + 1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 1Initial program 97.7%
associate-+l+97.7%
associate-+l-97.7%
associate-+l-97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.1%
associate--l+42.6%
+-commutative42.6%
+-commutative42.6%
Simplified42.6%
Taylor expanded in x around inf 30.3%
mul-1-neg30.3%
Simplified30.3%
Taylor expanded in x around 0 30.3%
associate--l+30.3%
Simplified30.3%
if 1 < x Initial program 84.1%
associate-+l+84.1%
associate-+l-44.9%
associate-+l-84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 6.7%
associate--l+7.5%
+-commutative7.5%
+-commutative7.5%
Simplified7.5%
Taylor expanded in x around inf 4.1%
mul-1-neg4.1%
Simplified4.1%
Taylor expanded in x around inf 8.0%
Final simplification18.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= x 0.021) (- 1.0 (sqrt x)) (* 0.5 (sqrt (/ 1.0 x)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.021) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * sqrt((1.0 / x));
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 0.021d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * sqrt((1.0d0 / x))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.021) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.sqrt((1.0 / x));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if x <= 0.021: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.sqrt((1.0 / x)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (x <= 0.021) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * sqrt(Float64(1.0 / x))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (x <= 0.021)
tmp = 1.0 - sqrt(x);
else
tmp = 0.5 * sqrt((1.0 / x));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[x, 0.021], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.021:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\
\end{array}
\end{array}
if x < 0.0210000000000000013Initial program 97.7%
associate-+l+97.7%
associate-+l-97.7%
associate-+l-97.7%
+-commutative97.7%
+-commutative97.7%
+-commutative97.7%
Simplified97.7%
Taylor expanded in t around inf 21.1%
associate--l+42.6%
+-commutative42.6%
+-commutative42.6%
Simplified42.6%
Taylor expanded in x around inf 30.3%
mul-1-neg30.3%
Simplified30.3%
Taylor expanded in x around 0 30.0%
if 0.0210000000000000013 < x Initial program 84.1%
associate-+l+84.1%
associate-+l-44.9%
associate-+l-84.1%
+-commutative84.1%
+-commutative84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in t around inf 6.7%
associate--l+7.5%
+-commutative7.5%
+-commutative7.5%
Simplified7.5%
Taylor expanded in x around inf 4.1%
mul-1-neg4.1%
Simplified4.1%
Taylor expanded in x around inf 8.0%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 - sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 - sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 - \sqrt{x}
\end{array}
Initial program 90.7%
associate-+l+90.7%
associate-+l-70.7%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 13.7%
associate--l+24.7%
+-commutative24.7%
+-commutative24.7%
Simplified24.7%
Taylor expanded in x around inf 16.9%
mul-1-neg16.9%
Simplified16.9%
Taylor expanded in x around 0 15.3%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- (sqrt x)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return -sqrt(x);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -sqrt(x)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(x);
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return -math.sqrt(x)
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(-sqrt(x)) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = -sqrt(x);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := (-N[Sqrt[x], $MachinePrecision])
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
-\sqrt{x}
\end{array}
Initial program 90.7%
associate-+l+90.7%
associate-+l-70.7%
associate-+l-90.7%
+-commutative90.7%
+-commutative90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in t around inf 13.7%
associate--l+24.7%
+-commutative24.7%
+-commutative24.7%
Simplified24.7%
Taylor expanded in x around inf 16.9%
mul-1-neg16.9%
Simplified16.9%
Taylor expanded in x around 0 15.3%
Taylor expanded in x around inf 1.6%
neg-mul-11.6%
Simplified1.6%
(FPCore (x y z t)
:precision binary64
(+
(+
(+
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(/ 1.0 (+ (sqrt (+ y 1.0)) (sqrt y))))
(/ 1.0 (+ (sqrt (+ z 1.0)) (sqrt z))))
(- (sqrt (+ t 1.0)) (sqrt t))))
double code(double x, double y, double z, double t) {
return (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))) + (1.0d0 / (sqrt((y + 1.0d0)) + sqrt(y)))) + (1.0d0 / (sqrt((z + 1.0d0)) + sqrt(z)))) + (sqrt((t + 1.0d0)) - sqrt(t))
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x))) + (1.0 / (Math.sqrt((y + 1.0)) + Math.sqrt(y)))) + (1.0 / (Math.sqrt((z + 1.0)) + Math.sqrt(z)))) + (Math.sqrt((t + 1.0)) - Math.sqrt(t));
}
def code(x, y, z, t): return (((1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))) + (1.0 / (math.sqrt((y + 1.0)) + math.sqrt(y)))) + (1.0 / (math.sqrt((z + 1.0)) + math.sqrt(z)))) + (math.sqrt((t + 1.0)) - math.sqrt(t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) + Float64(1.0 / Float64(sqrt(Float64(y + 1.0)) + sqrt(y)))) + Float64(1.0 / Float64(sqrt(Float64(z + 1.0)) + sqrt(z)))) + Float64(sqrt(Float64(t + 1.0)) - sqrt(t))) end
function tmp = code(x, y, z, t) tmp = (((1.0 / (sqrt((x + 1.0)) + sqrt(x))) + (1.0 / (sqrt((y + 1.0)) + sqrt(y)))) + (1.0 / (sqrt((z + 1.0)) + sqrt(z)))) + (sqrt((t + 1.0)) - sqrt(t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(y + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[Sqrt[N[(z + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(t + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}} + \frac{1}{\sqrt{y + 1} + \sqrt{y}}\right) + \frac{1}{\sqrt{z + 1} + \sqrt{z}}\right) + \left(\sqrt{t + 1} - \sqrt{t}\right)
\end{array}
herbie shell --seed 2024116
(FPCore (x y z t)
:name "Main:z from "
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (/ 1 (+ (sqrt (+ x 1)) (sqrt x))) (/ 1 (+ (sqrt (+ y 1)) (sqrt y)))) (/ 1 (+ (sqrt (+ z 1)) (sqrt z)))) (- (sqrt (+ t 1)) (sqrt t))))
(+ (+ (+ (- (sqrt (+ x 1.0)) (sqrt x)) (- (sqrt (+ y 1.0)) (sqrt y))) (- (sqrt (+ z 1.0)) (sqrt z))) (- (sqrt (+ t 1.0)) (sqrt t))))