Add tests for encode/decode infinities and nans