Calculation of electronic and optical properties of ferroelectric NaNO2