Page 1 of 1

BigInteger in pascal

Posted: Mon Nov 15, 2004 9:43 pm
by randomtaiwanese
is there such thing, or i have to write such thing myself?

Posted: Tue Jan 11, 2005 11:01 pm
by *luna*
i think you mean longinteger (longint)?

integer (-32768..32767)
longint (-2147483648..2147483647)

Posted: Wed Jan 12, 2005 2:23 am
by neowarez
well..

For integers up to 2^64 you can use long long on C or Int64 on Pascal.. but if the numbers are much more larger you need to write it..

To write, or not to write.

Posted: Wed Jan 12, 2005 6:03 am
by _.B._
Greetings!
For a 32-bit compiler like FreePascal, the big integer types and ranges are:

Code: Select all

Predefined integer types 

Type  Range  Size in bytes 
Byte  0 .. 255  1 
Shortint  -128 .. 127  1 
Smallint  -32768 .. 32767  2 
Word  0 .. 65535  2 
Integer  either smallint, longint or int64  size 2,4 or 8 
Cardinal  either word, longword or qword  size 2,4 or 8 
Longint  -2147483648 .. 2147483647  4 
Longword 0..4294967295  4 
Int64  -9223372036854775808 .. 9223372036854775807 8 
QWord  0 .. 18446744073709551615  8 
Check Free Pascal - Ordinal Types

If you need anything larger than that, you'll have to code it yourself 8)
IF you know an easy way, code it.

Keep posting!