Related to #15, but I want to make sure it's numerically stable since squares are involved
Related to #15, but I want to make sure it's numerically stable since squares are involved