Ax51 User's Guide

Numbers

Numbers may be specified in hexadecimal (base 16), decimal (base 10), octal (base 8), and binary (base 2). The default representation is decimal. A decimal, octal, or binary number's first character must always be a digit (0-9). Hexadecimal numbers whose first character is not a digit (0-9) must be prefixed with a zero ('0').

The base of a number is specified by the last character in the number. A number that is specified without an explicit base is interpreted as decimal number.

The following table illustrates various types of numbers:

BaseSuffixLegal CharactersExamples
HexadecimalH,h0-9, A-F, a-f1234H 99H 123H 0A0F0H 0FFH
DecimalD,d0-91234 65590D 20d 123
OctalO,o,Q,q0-7177O 7777o 25O 123o 177777O
BinaryB,b0-11111B 10011111B 101010101B

Note

  • Hexadecimal numbers may be written using C notation. For example, 0x12AB.
  • Hexadecimal numbers must begin with a 0 if the first digit is A-F.
  • The dollar sign character ('$') may be used in numbers to make them more readable (as long it is not the first or last character). For example:
    1111$0000$1010$0011B   - is equivalent to -   1111000010100011B
    1$2$3$4                - is equivalent to -   1234