Usually we use pdf in log-domain and the log_sum trick to avoid numerical underflow  in particular for  IID samples.

In this class, I just follow the Matlab code and it is impossible to deal with 0 in log domain.