calculate_speed returns a float instead requiring pointer