harmonize 32/64bit behavior when rounding

- use lrint
- avoid floats
- no implicit casts