what type of variable to go beyond 2,5 billion ?

Posted By: djfeeler

what type of variable to go beyond 2,5 billion ? - 02/27/14 11:58

Hello,

I have a problem :

I would like a type of variable to go beyond 2,5 billion.

Type Size Range Minimum Precision*
var, fixed | 4 bytes | -1048577.999 to 1048576.999** | 0.001 | ~9
int, long | 4 bytes | -2147483648 to 2147483647 | 1 | ~10

With var and int I can't to go beyond 2,5 billion. what type of variable choose ?

Thanks in advance

Djfeeler
Posted By: sivan

Re: what type of variable to go beyond 2,5 billion ? - 02/27/14 12:23

here you can find the available stuff:
http://www.conitec.net/beta/aarray.htm
Posted By: Ch40zzC0d3r

Re: what type of variable to go beyond 2,5 billion ? - 02/27/14 13:22

long long int?
Also why do you need such hight values? Which value is minimum for your needs? Probably an integer * 1000000000 will help
Posted By: djfeeler

Re: what type of variable to go beyond 2,5 billion ? - 02/27/14 13:55

Thanks for your help ^^. I need 10 billions.
Posted By: WretchedSid

Re: what type of variable to go beyond 2,5 billion ? - 02/27/14 14:25

Roll your own 64bit integer. It's pretty much like 32bit arithmetic, except that you need to take care of the carry yourself. Gives you access to 1.8446744074×10^19 numbers.

An alternative would be double (don't use float), the largest integer you can represent without running into rounding errors is 2^53+1.

long long int and the likes doesn't exist in Lite-C, neither does the concept of an unsigned variable. 32 bit integers is all you get before you have to look into alternatives.
Posted By: djfeeler

Re: what type of variable to go beyond 2,5 billion ? - 02/27/14 14:34

Thanks for you explanation ^^
© 2024 lite-C Forums