2020-09-29

How to encode Double to the long format

I create a Double from a string using:

let doubleValue = Double(value)

The value is 23450000000000000000

And in the debugger I see doubleValue shown as 2.345e+20

And my code has a encoder(to encoder:Encoder) to encode the doubleValue.

try container.encode(doubleValue, forKey: .akey)

When i run it, I see doubleValue is being encode as 2.345e+20. Is there a way to encode the doubleValue in the long format? i.e. 23450000000000000000?



from Recent Questions - Stack Overflow https://ift.tt/36dLvlR
https://ift.tt/eA8V8J

No comments:

Post a Comment