discoveryjs / discovery

A framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
https://discoveryjs.github.io/discovery/
MIT License
331 stars 6 forks source link

Large integers are parsed incorrectly #53

Open rualark opened 3 years ago

rualark commented 3 years ago

Example:

{"P":590595,"U":5678518811589061657,"A":942,"S":78,"C":1,"P":171632,"B":72057603339518945}

Output: image

This seems to be a high priority issue because it garbles data.

This is probably due to limitation that js stores numbers as floats. Probably this should be fixed by either custom parsing or converting to a string.

lahmatiy commented 3 years ago

Yeah, you hit the limit of number precision. You can see the same effect everywhere, e.g. in the console: image Possible workarounds:

Custom parsing is quite complicated to implement, however it may to be added in the future. However it doesn't solve all the problems. I don't see a quick fix right now, sorry.

rualark commented 3 years ago

Ok. Then we can show icon near the number, that it was not parsed exactly. And add tooltip with exact (string) value. In index and report views. This approximation can cause great mistakes.