Added an assert if you try and take the square root of a negative number.