Although this solution has been known for decades, not enough people know about it. Most people are probably unaware that computing sample variance can be difficult until the first time they compute a standard deviation and get an exception for taking the square root of a negative number.
It is not obvious that the method is correct even in exact arithmetic. It’s even less obvious that the method has superior numerical properties, but it does. The algorithm is as follows.