I think the main reason we’re talking past eachother here is that everyone has a different view on what P(\texttt{rand(T)} = 0) currently means for the floating point representation of the theoretically ideal uniform real-numbered [0, 1) distribution, what it should mean, and what it could mean (and we’re constantly shifting between these three views without stating it).
- Status quo: it currently means that a real number in [0, \texttt{eps(T)/2}) was drawn from a theoretically ideal [0,1) real number uniform distribution. This is meaningful and can be fully described, documented, advised upon, and defensively programmed against.
- Floating point ideal #1: it should mean that a real number in [0, \texttt{floatmin(T)}) was drawn.
- Floating point ideal #2: or it should mean that a real number in [0, \texttt{nextfloat(zero(T))}) was drawn.
- Gradient-of-compromises: it could mean that a real number in [0, 2^{-N}) was drawn. The status quo lives on this gradient at
N = Base.significand_bits(T)+1
. The ideals also live on this gradient. - Definitionally impossible: it could be defined to never happen by messing about with the probability of P(\texttt{rand(T)} = \varepsilon) is, where \varepsilon is the next-biggest output of
rand(T)
or by very slightly biasing all outputs.