modula-2 home

  Home  
  Tutorial  
  Win32 API  
  Reference  
  Projects  
 

 

Type declarations

Basic types- ISO Standard Defined Types

The following table lists the pre-declared types in the Modula-2 language.  The identifiers for these types are automatically defined in every Modula-2 module.

 

Type Storage size Range
INTEGER 16-bit compiler: 2 bytes
32-bit compiler: 4 bytes
 -32768 to 32767
-2,147,483,648 to 2,147,483,647
CARDINAL 16-bit compiler: 2 bytes
32-bit compiler: 4 bytes
0 to 65535
0 to 4,294,967,295
REAL 4 bytes Real numbers with an approximate range of 8.43E-37 to 3.37E+38 and an accuracy of about 7 decimal digits
LONGREAL 8 bytes Real numbers with an approximate range of 4.19E-307 to 1.67E+308 and an accuracy of about 16 decimal digits
COMPLEX 8 bytes Complex numbers where the real and imaginary Components are of type REAL
LONGCOMPLEX 16 bytes Complex numbers where the real and imaginary Components are of type LONGREAL
BOOLEAN 1 byte An enumeration type with the values FALSE and TRUE
CHAR ANSI (8-bit): 1 byte
Unicode (16-bit): 2 bytes
A character in the ANSI (8-bit) or Unicode (16-bit) character set.
BITSET 2 bytes A PACKEDSET type with an ordinal range of CARDINAL[0..15]

 


Source:

  • Stony Brook Modula-2 documentation. Used with permission. Note: Stony-Brook M2 offers an extended syntax with features not described here. Stony Brook M2 users are encouraged to visit the Stony Brook website and to consult the Stony Brook help system.