From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: 128-bit integers can range only up to (2 ^ 63 -1) |
Date: | 2023-01-03 16:12:13 |
Message-ID: | CACJufxFuoOo=dE4XXrOeUrn-zP07jg7g4GpSTE_rv5MPbhzOJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 3, 2023 at 8:50 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> jian he <jian(dot)universality(at)gmail(dot)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.
>
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2023-01-03 16:16:29 | Re: typos |
Previous Message | agharta82@gmail.com | 2023-01-03 16:07:40 | Re: Is OpenSSL AES-NI not available in pgcrypto? |