[Development] JSON 64 bit int
Knoll Lars
Lars.Knoll at theqtcompany.com
Thu Feb 12 08:42:48 CET 2015
On 12/02/15 04:08, "Thiago Macieira" <thiago.macieira at intel.com> wrote:
>On Thursday 12 February 2015 01:18:47 Allan Sandfeld Jensen wrote:
>> On Thursday 12 February 2015, Marc Mutz wrote:
>> > On Thursday 12 February 2015 00:18:28 Allan Sandfeld Jensen wrote:
>> > > On Wednesday 11 February 2015, Marc Mutz wrote:
>> > > > 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.
>> > >
>> > > Apropos, the usefulness of extended precision floating point
>>happens to
>> > > be that they can represent both 64bit integers and 64bit floating
>>point.
>> >
>> > ...except if it cannot. That would've actually made for a good
>>requirement
>> > for a long double type: be a superset of values representable in
>>double
>> > and long long.
>> >
>> > But that's not what the standard says :(
>>
>> I was referring to x87's 80bit floating point.
>
>We don't want to use that.
>
>However, the in-memory format for QJsonValue could store a 64-bit int.
Yes, 80 or 128bit doubles are out of the question. The RFC basically
doesn’t specify the range of allowed values, but hints that it should at
least support doubles. We can go above that and allow 64bit integers as
well as they are rather common these days. But anything above that is IMO
something that is out of scope for Qt.
So I’d be ok with a patch that adds builtin support for 64bit integers.
We’d then need to decide at parse time whether to store the value as
integer or double, and since JSON only talks about numbers the getters
have to do automatic conversion (or we’d break existing code). To be able
to deal with them you’d need a isInteger() flag on QJsonValue.
Cheers,
Lars
More information about the Development
mailing list