[FIX] bug fix in QDA

Fixes #3721

sum of log is more stable numerically than the log of a prod