Buoyancy and stability of submerged and floating bodies