An integer is a positive or negative number with no decimal part
Integer literals
354 -52689 +4432
Why use integers?
Mathematics: -ve infinity to +ve infinity
Computers: limited range
attributes: information about a data type
Example:
PUT ("The lowest integer value is: "); PUT (INTEGER'FIRST); NEW_LINE; PUT ("The highest integer value is: "); PUT (INTEGER'LAST); NEW_LINE; The lowest integer value is: -2147483648 The highest integer value is: 2147483647
I/O: special library provides GET, PUT
package int_io is new TEXT_IO.INTEGER_IO( INTEGER ); use int_io;
arithmetic
division 23 / 4 = 5 remainder 23 rem 4 = 3 -23 rem 4 = -3 modulus -23 mod 4 = 1 23 mod -4 = -1 exponentiation 2 ** 4 = 16
relational: