int vs long
Dan Bishop
danb_83 at yahoo.com
Sat Jun 2 23:00:59 EDT 2007
More information about the Python-list mailing list
Sat Jun 2 23:00:59 EDT 2007
- Previous message (by thread): int vs long
- Next message (by thread): int vs long
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jun 2, 9:30 pm, jay <jyoun... at kc.rr.com> wrote: > I was reading in a book that the 'int' type can store whole numbers > up to 32 bits. I'm not exactly sure what that means, but got me > wondering, what's the largest number you can store as an 'int' before > you need to switch over to 'long'? sys.maxint. This is 2,147,483,647 on a 32-bit machine, or 9,223,372,036,854,775,807 on a 64-bit machine. In general, an N-bit signed integer can store numbers between -2**(N-1) and 2**(N-1)-1, inclusive. Note that recent versions of Python automatically promote the results of integer arithmetic to long if necessary, so the distinction is less relevant than it used to be.
- Previous message (by thread): int vs long
- Next message (by thread): int vs long
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list