Make lrint more correct. Closes #1265.