Adds JSON serialization in Float class.

Handles NaN and infinity properly.
`std::isnan` is better than `x != x` for testing NaN values.