Fix serialization of nans, infs and negative floats to JS.

Fixes test_float_literals in https://github.com/kripken/emscripten/pull/2052 .