Next: , Previous: , Up: Data constants   [Contents][Index]


3.1.2 Numbers

The available range of integers is -(2^31-1) to 2^31-1 on a 32 bit machine and -(2^63-1) to 2^63-1 on a 64 bit machine. Integers can be represented in any of the following ways.

  1. Any sequence of numeric characters. This method denotes the number in decimal, or base 10.

    For example:

    123
    
  2. BaseNumber, where Base ranges from 2 to 36 and Number can have any sequence of alphanumeric characters. Both upper and lower case alphabetic characters in Number are used to represent the appropriate digit when Base is greater than 10.
    For example, integer value 10 can be written as:
    2'1010
    16'A
    16'a
    
  3. Binary numbers can also be represented in the form 0b followed by binary digits. Similarly octal and hexadecimal numbers can be represented by 0o or 0x followed by digits.
    For example
    0b1011
    0o3170
    0x3afd
    
  4. 0’Character gives the character code of Character.
    For example,
    0'A
    

    gives the ASCII character code 65.

A natural number is a non-negative integer.

num type numbers include double precision floating point numbers. They are represented using either a decimal point or scientific e notation. Examples:

27.8
1.896e4