C++ int beyond 2,147,483,647?
#3 Members - Reputation: 334
Posted 31 August 2011 - 01:57 AM
yes "long long" / "__int64" although the latter is compiler/OS/vendor specifiec as far as i knowHi, out of curiousity, is it possible for a C++ integer (or long integer according to what i read) to go beyond 2,147,483,647?
How do i attain it? do i need a certain library or piece of code to make it possible?
Cheers.
they go from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
and uses 8 bytes.
big enough for you ?
check out this
Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.
#4 Members - Reputation: 285
Posted 31 August 2011 - 02:38 AM
unsigned int tens = 0x00000000;
unsigned int ones = 0xFFFFFFFF;
ones++;
boolean overflowed = true;
if (ones == 0 && overflowed == true) {
tens ++;
ones = 0x00000000;
}
else
{
overflowed = false;
}
Just mentioning that ints can do this.
#5 Members - Reputation: 109
Posted 31 August 2011 - 02:43 AM
#6 Members - Reputation: 122
Posted 31 August 2011 - 03:02 AM
yes "log long" / "__int64" although the latter is compiler/OS/vendor specifiec as far as i know
Hi, out of curiousity, is it possible for a C++ integer (or long integer according to what i read) to go beyond 2,147,483,647?
How do i attain it? do i need a certain library or piece of code to make it possible?
Cheers.
they go from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
and uses 8 bytes.
big enough for you ?
check out this
awesome. did the trick. Thanks!
btw, is "log long" supposed to be "long long"? thought we were gonna use logarithms hehe.
If you want arbitrarily big numbers you can use a library like https://mattmccutchen.net/bigint/
Interesting. Will check this out. Thanks!
#7 Members - Reputation: 122
Posted 31 August 2011 - 03:42 AM
yes "log long" / "__int64" although the latter is compiler/OS/vendor specifiec as far as i know
Hi, out of curiousity, is it possible for a C++ integer (or long integer according to what i read) to go beyond 2,147,483,647?
How do i attain it? do i need a certain library or piece of code to make it possible?
Cheers.
they go from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
and uses 8 bytes.
big enough for you ?
check out this
awesome. did the trick. Thanks!
btw, is "log long" supposed to be "long long"? thought we were gonna use logarithms hehe.
If you want arbitrarily big numbers you can use a library like https://mattmccutchen.net/bigint/
Interesting. Will check this out. Thanks!
#9 Members - Reputation: 334
Posted 31 August 2011 - 05:49 AM
Yes, it was most likely just a typo on his part; it's supposed to be "long long".
btw, is "log long" supposed to be "long long"? thought we were gonna use logarithms hehe.
Yes, it was supposed to be long long.
will correct it now.
Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.
#10 Members - Reputation: 122
Posted 01 September 2011 - 06:13 AM
Yes, it was most likely just a typo on his part; it's supposed to be "long long".
btw, is "log long" supposed to be "long long"? thought we were gonna use logarithms hehe.
Yes, it was supposed to be long long.
will correct it now.
Awesome. Kudos to you!
#12 Members - Reputation: 767
Posted 01 September 2011 - 06:09 PM
It's not really double the space; rather, the range starts at 0 instead of being centered on 0. But the size of the range remains unchanged.You can also used unsigned long long if you need double the space. I think that trick let me do a project euler exercise without having to use the bigint library.






