Add explicit handling for inf/nan.
Add a few TODOs.