Fixed loss of precision due to incorrect use of float in place of double