Make lrint more correct. Closes #1265.

This implements the [round half to even](https://en.wikipedia.org/wiki/Rounding#Round_half_to_even) behavior.