Using proper math library. Corrected speed variance calculation