Regarding the universe, doesn't "almost flat" mean "not flat?" If you are kind enough to answer my question, please bear in mind my background is not in physics, so I may need some corrections in setting up the proper framework. On the other hand, my background is in math so feel free to include technicalities of that nature.
We have been able to approximate the curvature of the observable universe by measuring triangles with vertices near the boundary of our limits of observation. We are also able to approximate the error in these computations, and data shows that the observable universe is flat up a 0.4% error margin.
First question: What is the value being measured here, having this error margin? How is it defined? At first I thought it would be the curvature but that doesn't seem right. After all, we only get flat with curvature at exactly $0$, so if one knew the curvature to be in an interval around $0$, flat would be a single option among infinitely many other (small) numbers. For instance, a curvature of $-0.00001$ would still be negative, i.e. not flat, right?
Regardless of that, the observable universe is "almost" flat. The more interesting issue to me is whether the general universe is flat, but a well known property of a smooth manifold is that any sufficiently small sample is "almost" flat. Yet, based on my limited web-researching, we have a way of saying whether or not the flatness of the general universe is determinable, by looking at our local flatness. (This seems incredible, am I understanding it right?) It comes down to the cosmological curvature parameter, which apparently has something to do with expansion rate. For instance, Wikipedia says that we "will not be able to distinguish between flat, open and closed universe if the true value of cosmological curvature parameter is smaller than $10^{−4}$."
Second question: What is the definition of the cosmological curvature parameter? Is this something we can measure up to some bounded error? Or is it impossible to even approximate such a parameter for the general universe, since we only have the observable portion to work with?
I did exhaust my web-searching in attempt to answer this and can only find things telling me how to interpret the parameter, not how it is defined or computed.
 A: (Almost) duplicate of an answer I previously wrote :
The homogeneity and isotropy hypotheses lead to the FLRW metric for the universe, namely :
$$ds^2 = cdt^2 - a(t)^2\left [ \dfrac{dr^2}{1+kr^2/R^2}+r^2 d^2\Omega \right ]$$ where $R$ is the curvature radius of the universe and $k$ can take the values -1, 0, or 1 for a spherical, flat or hyperbolic universe. This result is a direct consequence of the cosmological principle.
In order to derive the relationship between these parameters and the universe content, one has to apply the Einstein equations. One thus obtains the so-called Friedmann equations :
$$\left\{\begin{matrix}
            \dot{a}^2-\dfrac{8 \pi G}{3c^2} \displaystyle \sum_i \rho_i a^2 & = & \dfrac{kc^2}{R^2} \\
            \dfrac{d}{dt}\left ( \rho_i a^3 \right ) & = & -P_i \dfrac{d}{dt} \left (a^3 \right) \\ 
            \end{matrix}\right.$$
Where $\rho_i$ and $P_i$ denote the energy density and pressure of each component of the universe, whose behavior is determined by their state equation (e.g. $P = 0$ for dust-like matter, $P=\rho/3$ for radiation, $P=-\rho$ for dark-energy.)
The present value of $a$ is 1. Evaluating the first equation at the present time $t_0$, and using the definition of the Hubble constant $H_0 = \dot{a}(t_0)/a(t_0) = \dot{a}(t_0)$, we find :
$$H_0^2 - \dfrac{8 \pi G}{3c^2} \displaystyle \sum_i \rho_i = \dfrac{kc^2}{R^2}$$
It is convenient to define the critical density as $\rho_c = 3c^2 H_0^2/(8\pi G)$, so that :
$$\rho_c - \displaystyle \sum_i \rho_i = \dfrac{3c^2}{8 \pi G} \dfrac{kc^2}{R^2}$$
This result means that the universe is spherical if the total energy density exceeds $\rho_c$, flat if they are equal, and hyperbolic if the total density is lesser. This is how the curvature is related to the universe content. You can see that this doesn't depend on the density distribution (i.e. how much is dark energy, how much is otherwise)
One way to quantify departure of the universe from a flat geometry is to evaluate the curvature density parameter $\Omega_k$ defined as :
\begin{equation}
\Omega_k \equiv \dfrac{\rho_c-\rho}{\rho_c}
\end{equation}
But this also equates, according to the Friedmann equations :
\begin{equation}
\Omega_k = \dfrac{kc^2}{H_0^2R^2}
\end{equation}
So you can interpret in terms of the relative difference of energy density vs critical energy density (1st expression), or in geometrical terms (2nd expression). Note that curvature tensors/scalars or in $\mathcal{O}(1/R^2)$. 
The most stringent limits on $\Omega_k$ are obtained by the analysis of the CMB anisotropies and are compatible with a flat universe ($|\Omega_k| < 5 \times 10^{-3}$, arXiv:1502.01589) but there exists other ways to measure of this parameter using standard candles and standard rulers. 
Now, going back to your question title. 
In physics, like always, continuous parameters cannot be measured with infinite precision. So, in a way, "almost flat" might be understood as "our measurements are compatible with it being flat". Also, if you look at the expression for $\Omega_k$, you can see that it is proportional to $R_H^2/R^2$, where $R_H = c/H_0$ is the Hubble radius. The Hubble radius more or less tells you the size of the visible universe. So a small curvature means, a curvature radius much larger than the size of the visible universe. If you recall that up to recently the curvature parameter was poorly known (for some time it was thought to be $\sim 10 \%$) then "almost flat" would just emphasize the coincidence that $\rho$ and $\rho_c$ are at least the same order of magnitude. Nowadays, the standard model of cosmology (standard $\Lambda$ CDM) includes an inflationary epoch, that tend to flatten space dramatically, so $\Omega_k$ is set to 0 in this model by default (sometimes expressed as $\Omega_M+\Omega_{\Lambda} = 1$).
A: I will reference a previous stack exchange post on cosmology I wrote. The energy equation I derive using Newtonian mechanics is modified in general relativity to
$$
\left(\frac{\dot a}{a}\right)^2 = H^2 = \frac{8\pi G\rho}{3} + \frac{k}{a^2},
$$
where $k~=~0$ corresponds to a flat space for the cosmology. For $k~=~1$ the spatial manifold is spherical and closed and for $k~=~-1$ the spatial manifold is hyperbolic and open. The curious thing is that since the last term varies with the reciprocal of the scale squared its physical implications can be very subtle. For a large cosmology or one that has expanded for a long period of time it is very difficult to ascertain the shape of the spatial surface. A very large sphere can locally appear flat.
