There are several ways to encode floating-point values so that encrypting them allow you to operate homomorphically.
First of all, it is worth noticing that nowadays the simplest (?) way of homomorphically operating with floating-point values is by using the CKKS scheme.
But if you want to use other schemes, such as BGV, then you basically have to find a way of representing floating points values with polynomials so that adding and multiplying those polynomials corresponds to adding and multiplying the original values, that is, you need an encoding $\mu$ that takes a real number $r$ and outputs a polynomial $p_r(X)$ such that
- $\mu(r_0) + \mu(r_1) = \mu(r_0 + r_1)$
- $\mu(r_0) \cdot \mu(r_1) = \mu(r_0 \cdot r_1)$
Then, thanks to the homomorphic properties, you can encode then encrypt, and the homomorphic operations will work as expected over the original real numbers. For instance,
$$ \mathtt{Hom.Add}\left( \mathtt{Enc}(\mu(r_0)) , \mathtt{Enc}(\mu(r_1)) \right) = \mathtt{Enc}(\mu(r_0) + \mu(r_1)) = \mathtt{Enc}(\mu(r_0 + r_1))$$
So if you decrypt then decode, you obtain $r_0 + r_1$, as expected.
There are many ways of implementing this encoding function. The basic idea is to represent $r$ in some basis $B$ (e.g., $B = 2$) such that
$$ r = r_{-d}\cdot B^{-d} + r_{-d+1}\cdot B^{-d+1} + ... + r_0 + r_1 \cdot B + ... + r_n \cdot B^{n}$$
where the digits $r_{-1}, ..., r_{-d}$ represent the decimal part of $r$ and
$r_0, ..., r_n$ represent the integral part.
For instance, $B=2$ and $r = 4.5$, then $n = 2$, $d=1$,
$r_0 = 0$, $r_1 = 0$, $r_2 = 1$, and $r_{-1} = 1$.
Then, this basic encoding function shifts $r$ multiplying it by $B^d$ so that it becomes the integer
$$ B^d \cdot r = r_{-d}+ r_{-d+1}\cdot B^{1} + ... + r_0 \cdot B^d+ r_1 \cdot B^{d+1} + ... + r_n \cdot B^{d+n}$$
and sends $B^d \cdot r$ to the polynomial
$p(X) = \sum_{i=0}^{n+d} r_{i-d} \cdot X^{i}$.
To decode, you evaluate $p$ on $B$ and divide by $B^d$, since
$p(B) / B^d = (B^d \cdot r) / B^d = r$.
You can check that the encoding respects the additive and multiplicative properties, at least while the degree of the encoded polynomial is not larger then $N$, when working modulo $X^N+1$, and while the coefficients are less $t$, when working with plaintext modulus $t$ (well, there are some technicalities, because you have to keep track of the scaling factor you applied and adjust it before homomorphic additions, if needed).
There are more involved techniques where you can use windows (sequences of zeros between the non-zero coefficients) [CSVW16] or even use the basis $B$ as a real number itself [BBBCIV17].