Just a quick question, how do you go about storing an integer over 2147483647 (2^31-1)?
13 6121
Just a quick question, how do you go about storing an integer over 2147483647 (2^31-1)?
You can use an unsigned long or a long long. An unsigned long's maxium size is twice that of a regular long. However, it only stores positive values. If you really need a big number, use a long long or an unsigned long long.
Check here if you are interested: http://msdn2.microsoft.com/en-us/lib...tz(VS.80).aspx
Is there any way to store a number above 18,446,744,073,709,551,615?
Is there any way to store a number above 18,446,744,073,709,551,615?
No, I don't believe you can. That uses 64 bits and not many computers today even support that much. Only lately did processors came out as 64 bit. Why would you want to though? That's 18 quintillion!
You can store numbers as big as you like....(we use numbers as long as 128 Bytes (1024bit) in cryptography, and I'm sure there are systems that use at least twice that again)
There is, however no primitive type defined to handle these. At the end of the day, any number is a series of bits. How you do calculations with them may cause headaches, because you kind of have to define that yourself.......
Some math libraries have BigInteger (Unless I'm thinking Java) which is a non-primitive type. I'm not sure how big a number this can play with, though.
In terms of storing the integer, what is the harm in using text as you did....
123,456,789,123,456,789,123,456,789,123,456,789,12 3,456,789,123,456,789
That number is bigger than 18,446,744,073,709,551,615 and is stored easily....interpreting it as a number may be another matter thoguh....
Does anyone know how variables are stored in python, because , for all i know, there is no restriction on variables in python.
You can store numbers as big as you like....(we use numbers as long as 128 Bytes (1024bit) in cryptography, and I'm sure there are systems that use at least twice that again)
Could you please explain this.
An RSA Key pair generation generates large prime INTEGERS and then after calculation it returns a 128 byte array (BYTE).
there are 2048 bit keys and even more used in practical.
but i dont know why you compare this when we talk about integers.
The byte stream (or array) that you mention is treated as a single integer. Just like an int is not (usually) a byte (it's more commonly 2 or 4 bytes). Similarly, in RSA, the key used is of HUGE size - 1024 I have usually worked with, but I am aware of larger values being used also.
These 128bytes are stored in a contiguous 'lump' of memory. The actual calculations made with them, are done as though this is one LARGE number (which it is).
Essentially what I am saying, is that it is possibly to create numbers of arbitrary length, as long as you understand how to implement it.
If you were simply asking about primitive types, I apologise, I assumed you were interestedc in knowing how big a number you could use (or more specifically store). The limit in this is bound only by the overhead/complexity of implementing it.
Does anyone know how variables are stored in python, because , for all i know, there is no restriction on variables in python.
They may use strings. Try the python forum for more info.
Adrian
The byte stream (or array) that you mention is treated as a single integer. Just like an int is not (usually) a byte (it's more commonly 2 or 4 bytes). Similarly, in RSA, the key used is of HUGE size - 1024 I have usually worked with, but I am aware of larger values being used also.
These 128bytes are stored in a contiguous 'lump' of memory. The actual calculations made with them, are done as though this is one LARGE number (which it is).
Essentially what I am saying, is that it is possibly to create numbers of arbitrary length, as long as you understand how to implement it.
If you were simply asking about primitive types, I apologise, I assumed you were interestedc in knowing how big a number you could use (or more specifically store). The limit in this is bound only by the overhead/complexity of implementing it.
Hey Man, what does interestedc mean? Didn't find it in any dictionary.
Adrian
Its a variation on interested. It means interested in a c related topic
Its a variation on interested. It means interested in a c related topic
I think we have a thread about such usage as that. Look at the Expert's Panel under "To the keeper of the FAQ..."
Adrian
I think we have a thread about such usage as that. Look at the Expert's Panel under "To the keeper of the FAQ..."
Adrian
I'm pretty new to the forms, can you post a link to the article?
I'm pretty new to the forms, can you post a link to the article?
Sorry, Mods and Admins only. It has to do with using shortforms and such. Not really related to this thread.
Adrian
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James A. Donald |
last post by:
I am contemplating getting into Python, which is used by engineers I
admire - google and Bram Cohen, but was horrified to read
"no variable or argument declarations are necessary."
Surely that...
|
by: Faree |
last post by:
Hi all,
I am doing portal for storing info of visitors.it is working well
too.but my prob is with mysql..when i entered infoa bt thier phone
numbers ,fax or mobile numbers,soemtimes it is...
|
by: Jack Wasserstein |
last post by:
how come when i add two Int32 vars in a try catch statement with the value
of 2147483647 it results in -2 instead of an exception?
|
by: Shawn |
last post by:
As if it won't be clear enough from my code, I'm pretty new to C
programming. This code is being compiled with an ANSI-C compatible
compiler for a microcontroller. That part, I believe, will be...
|
by: gamehack |
last post by:
Hi all,
I'm writing an application which will be opening binary files with
definite sizes for integers(2 byte integers and 4 byte longs). Is there
a portable way in being sure that each integer...
|
by: Manuel |
last post by:
hi,
I have a problem, a stupid problem. I can't declare a variable of type
byte.
The g++ said that i have syntactic error in this line. The code is
this: byte * variable;
well, i think...
|
by: garyusenet |
last post by:
I'm trying to investigate the maximum size of different variable types.
I'm using INT as my starting variable for exploration. I know that the
maximum number that the int variable can take is:...
|
by: pbmods |
last post by:
VARIABLE SCOPE IN JAVASCRIPT
LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN )
PREREQS: VARIABLES
First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
|
by: Virtual_X |
last post by:
I am new to c++ and i know that
"short int" size is 2bytes with rang -32768 to
32767
and "int" size is 4bytes with rang -2147483648
to 2147483647
How!!
the "int" range must be ...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |