Improved floating-point encoding + tests.