Closed jeremyswright closed 3 years ago
Thanks for finding this @jeremyswright. We've seen issues around this in other languages too (ref: https://github.com/openactive/modelling-opportunity-data/issues/245). Option 2 above looks like the current favoured approach.
I think we need to allow strings in the library, so clients can use things like bcmath
without having to parse back to floats and getting rounding errors.
This issue has been resolved.
Issue Report
I'm seeing rounding issues with the floats in PriceSpecification and TaxChargeSpecification. I'm setting the values to floats with 2 decimal places, but when it comes to serialising the Order/OrderQuote/OrderProposal, it's appending a load of precision issues.
The issue lies in
JsonLd->prepareDataForSerialization
I believe.Suggested Resolution
Two possible options: