Re: int128 error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeffrey,

thanks for the quick response. I actually tried appending LL to the end of the value, but the compiler is still complaining, which isnt surprising because a test shows that long long has a sizeof of 8 bytes, whereas __int128_t reports 16 bytes.

btw Im compiling with -march=core2 and its a 64 bit cpu and linux distro.

Regards

TS

----- Original Message ----- From: "Jeffrey Walton" <noloader@xxxxxxxxx>
To: "Touros Spoon" <touros.spoon@xxxxxxxxx>
Cc: <gcc-help@xxxxxxxxxxx>
Sent: Sunday, January 02, 2011 6:34 PM
Subject: Re: int128 error


wibble=170141183460469231731687303715884105727;
wibble=170141183460469231731687303715884105727LL;

or

wibble=170141183460469231731687303715884105727UL;

On Sun, Jan 2, 2011 at 11:24 AM, Touros Spoon <touros.spoon@xxxxxxxxx> wrote:
I have been trying to use the gcc extension __int128, but although I am able
to declare a variable, when I test it by assigning a value, gcc warns me:
"constant value is too large for its type".

I am using gcc 4.4.4 on 64 bit Slackware 13.1 with a core 2 duo processor.

This is the code Im using to test it:


#include <iostream>

int main ()

{

__int128_t wibble;

wibble=170141183460469231731687303715884105727;

std::cout << "size of wibble: " << sizeof(wibble) << std::endl;

return 0;

}



Unless Im mistaken, the maximum value that a signed int128 should be able to
cope with is 170141183460469231731687303715884105727. However I tried
knocking off a few digits to see what happened and the compiler is still
complaining. The output of the above program displays a sizeof result of 16 for "wibble" indicating that it is seeing __int128_t as a 16 byte (128 bit)
integer. So I guess the problem is with the assignment, perhaps something
Ive missed?

I put this on the gcc list because although it is probably a c++ problem,
the only resources I can find relevant to this are related to external math
libraries.
Has anyone else come accross this problem / can see what I have done wrong
and if so, please can you advise.

Regards
TS




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux