More fixes from Rocco Romeo: do the correct thing near a small negative integer, and handle denormalized inputs correctly.