Fix histogram computation

 * the previous implementation had problems due to cases
   where `ms+eps()==ms`
 * handle the case in which all values are equal
 * handle the case of a single bin
 * avoid some more corner cases (e.g. if `(ms:delta:Ms)[end] != Ms`)
 * return the exact number of bins requested (i.e. remove the empty
   one at the end)