Re: 128-bit integers can range only up to (2 ^ 63 -1) - Mailing list pgsql-hackers

From jian he
Subject Re: 128-bit integers can range only up to (2 ^ 63 -1)
Date
Msg-id CACJufxFuoOo=dE4XXrOeUrn-zP07jg7g4GpSTE_rv5MPbhzOJg@mail.gmail.com
Whole thread Raw
In response to Re: 128-bit integers can range only up to (2 ^ 63 -1)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: 128-bit integers can range only up to (2 ^ 63 -1)
List pgsql-hackers


On Tue, Jan 3, 2023 at 8:50 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
jian he <jian.universality@gmail.com> writes:
> I am slightly confused by the int128 type. I thought the 128 bit integer
> means range type will be upto 2 ^ 127 - 1.
> Now just copy the above code and test the int128 range.
> int128 can only up to  9223372036854775807 (2 ^ 63 -1).

What's your grounds for claiming that?

                        regards, tom lane


I did something like                     int128 a1 = 9223372036854775807 + 1;
I also did something like int128 a1 = (int128)9223372036854775807000;
I misread the warning.  I should do the cast first.

The second expression has a warning. I guess because
There is no support in GCC for expressing an integer constant of type __int128 for targets with long long integer less than 128 bits wide.



pgsql-hackers by date:

Previous
From: "agharta82@gmail.com"
Date:
Subject: Re: Is OpenSSL AES-NI not available in pgcrypto?
Next
From: Peter Eisentraut
Date:
Subject: Re: typos