Hyperglycaemia pulls water into the plasma and dilutes sodium. Corrects the measured sodium so the true water balance is visible (DKA, HHS).
The calculator on this page needs JavaScript. The formula and its source are above.