bignerdranch / Freddy

A reusable framework for parsing JSON in Swift.
MIT License
1.09k stars 120 forks source link

Implementing decimal support #247

Closed adotor closed 6 years ago

adotor commented 7 years ago

Hi,

last week I stumbled upon an issue regarding the encoding/decoding of floating point values. As far as I can see I have to deal with all the accuracy problems of Doubles when it comes to floating point values in the current implementation.

Therefore I tried to implement the support of Decimal for encoding and decoding as contribution. Encoding went well, but when it comes to Decoding the solution is not that straightforward.

After looking into the JSONParser I understand that the parser itself is using Doubles when it comes to parsing floating point numbers.

Has anyone thought of a strategy to improve the handling of floating point numbers in Freddy yet?

Kind regards, Alexander

zwaldowski commented 6 years ago

Unfortunately, after a few attempts on our end the decoding path isn't well-defined without breaking existing clients. Freddy is in maintenance mode and only seeking to make bug fixes at the moment. Please reopen if you have more thoughts on an implementation. Thanks for the suggestion.