[Development] JSON 64 bit int

Thiago Macieira thiago.macieira at intel.com
Wed Feb 11 22:11:09 CET 2015

On Wednesday 11 February 2015 21:26:40 Marc Mutz wrote:
> The interesting part is what Qt should do about it. Postel's Law clearly
> asks
> for accepting (even invalid) input as long as its meaning is clear. Clearly,
> that is the case for larger-than-double numbers. So, by Postel's Law, Qt
> should strive to support them. If you apply the law to the API side of
> QtJSON, then it should do so even for writing. So Bo has a valid point.

Accepting is one thing. But if we do this, we need to be able to generate 64-
bit integers. Think of this: what happens if you do a pass-through 
QJsonDocument of data outside of JSON documents? Should QJsonDocument:

1) output invalid data because it arrived in such a way?
2) silently lose up to 11 bits of precision?

If we chose #1, then the follow-up question is what happens if you extract the 
data to your structure and want to re-create the JSON document -- you wouldn't 
be able to.

> If long double was any useful (apparently it's no larger than double on 
> Windows), we could use that, but as it stands, that would be pointless.

There are very few architectures that support 80- or 128-bit precision floating 
point in hardware. x86 is one of them, but unlike single- and double-precision 
modes, the extended-precision support did not make the transition to the SSE 
world. That means x86-64 does support the type natively, but requires use of 
the expensive x87 unit and 32-bit style calling conventions.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list