How to compute relative error for the rounding of floating point numbers when the rounded number is 0? I have asked this question on Stack Overflow, I am asking it here in the hope to get more traction.

The relative rounding error for a floating point number x is defined as 

$e_r = |\frac{(round(x)  - x)}{x}| = |\frac{round(x)}{x} - 1|$ (1)

Assuming that the rounding to nearest mode is used for $round(x)$, the absolute rounding error $|round(x) - x|$ is going to be less than 0.5 ulp(E(x)), where the ulp are units in the last place

$ulp(E) = 2^E \cdot \epsilon$

and $E(x)$ is the exponent used for $x$, and $\epsilon$ is the machine epsilon $\epsilon=2^{-(p-1)}$, $p$ is precision (24 for the single precision and 53 for the double precision IEEE formats).  

Using this, the relative error can be expressed for any real number $x$

$e_r = |\frac{(round(x)  - x)}{x}| = \frac{|(round(x)  - x)|}{|x|} &lt; |0.5 \cdot 2^E \cdot 2^{-(p-1)}| / |2^E| &lt; 0.5 \epsilon$

For denormalized numbers $0 &lt; x &lt; 2^Em \epsilon$, where Em is the minimal exponent (-126 for single precision, -1022 for double):

$0 &lt; x \le 0.5 \cdot \epsilon \cdot 2^{Em}$

the rounding always goes to $0$! 

If the round(x) is 0, then by (1)

$e_r =|\frac{(0 - 1)}{1}| = |1|$ !

How is the relative error computed for such numbers? Should the relative error be even used for the numbers that are rounded to 0?
If x = 0 and is rounded to 0 then the error is 0, and the relative error is whatever you want it to be. 

If x ≠ 0 and is rounded to 0, then the absolute error is x, and the relative error is 1 (or 100% if that is more intuitive). 

If x = 0 and is round to y ≠ 0 then the absolute error is y, and the relative error is infinite or undefined, whatever you prefer.