Unsolved How to write a decimals of the pression in QJson
-
As we know, sometimes, a decimals in Dec couldn't transform to a bin, just like 0.1.
It is different between string and decimal in Json format;
so that a decimals in json may output like this: 0.9999999 or 0.100000001 .
How can I write a decimals of the pression in QJson, just like 0.1 , 0.10 or 0.100? A string "0.1" or "0.10" isn't what I want.
Thank you for your help! -
Are you trying to simply control the formatting of double output, or are you trying to get an exact representation of the number? Are you using JSON just internally, or does your app send data to others using these JSON files?
-
@Chris-Hennes said in How to write a decimals of the pression in QJson:
Are you trying to simply control the formatting of double output, or are you trying to get an exact representation of the number? Are you using JSON just internally, or does your app send data to others using these JSON files?
Thank you for your attention! Yes, I was trying to simply control the formatting of double output. My app send data to others using these JSON files(bytearray).
-
Can I ask why you care? As you mention, the actual number being stored "under the hood" is not the rounded version. I know that JSON files are typically human-readable, but they are really designed for program-to-program communications.