clock: Fix unchecked overflows in linear regression code
The initial calculation for the precision shift was wrong and would allow for overflows during the calculations which were not detected and lead to wrong results.
Similarly, the gst_log2() implementation was wrong: it was rounding down instead of rounding up, and what we need to know here is the number of bits that are required to store a number, i.e. rounding up.
Also add a test for a case where overflows where previously not detected and caused a completely wrong result.
CC @thaytan