Small optimization to avoid unnecessary square roots