#### 2.3.1 Numbers as Tokens

When a token is read, it is interpreted as a number or symbol. The token is interpreted as a number if it satisfies the syntax for numbers specified in the next figure.

 numeric-token ::= ↓integer | ↓ratio | ↓float integer ::= [sign] {decimal-digit}+ decimal-point | [sign] {digit}+ ratio ::= [sign] {digit}+ slash {digit}+ float ::= [sign] {decimal-digit}* decimal-point {decimal-digit}+ [↓exponent] | [sign] {decimal-digit}+ [decimal-point {decimal-digit}*] ↓exponent exponent ::= exponent-marker [sign] {digit}+

Figure 2.9: Syntax for Numeric Tokens

sign—a sign.
slash—a slash
decimal-point—a dot.
exponent-marker—an exponent marker.
decimal-digit—a digit in radix `10`.
digit—a digit in the current input radix.

##### 2.3.1.1 Potential Numbers as Tokens

To allow implementors and future Common Lisp standards to extend the syntax of numbers, a syntax for potential numbers is defined that is more general than the syntax for numbers. A token is a potential number if it satisfies all of the following requirements:

1. The token consists entirely of digits, signs, ratio markers, decimal points (`.`), extension characters (^ or `_`), and number markers. A number marker is a letter. Whether a letter may be treated as a number marker depends on context, but no letter that is adjacent to another letter may ever be treated as a number marker. Exponent markers are number markers.
2. The token contains at least one digit. Letters may be considered to be digits, depending on the current input base, but only in tokens containing no decimal points.
3. The token begins with a digit, sign, decimal point, or extension character,

but not a package marker. The syntax involving a leading package marker followed by a potential number is not well-defined. The consequences of the use of notation such as `:1`, `:1/2`, and `:2^3` in a position where an expression appropriate for `read` is expected are unspecified.

4. The token does not end with a sign.

If a potential number has number syntax, a number of the appropriate type is constructed and returned, if the number is representable in an implementation. A number will not be representable in an implementation if it is outside the boundaries set by the implementation-dependent constants for numbers. For example, specifying too large or too small an exponent for a float may make the number impossible to represent in the implementation. A ratio with denominator zero (such as `-35/000`) is not represented in any implementation. When a token with the syntax of a number cannot be converted to an internal number, an error of type `reader-error` is signaled. An error must not be signaled for specifying too many significant digits for a float; a truncated or rounded value should be produced.

If there is an ambiguity as to whether a letter should be treated as a digit or as a number marker, the letter is treated as a digit.

##### 2.3.1.1.1 Escape Characters and Potential Numbers

A potential number cannot contain any escape characters. An escape character robs the following character of all syntactic qualities, forcing it to be strictly alphabetic2 and therefore unsuitable for use in a potential number. For example, all of the following representations are interpreted as symbols, not numbers:

``` \256   25\64   1.0\E6   |100|   3\.14159   |3/4|   3\/4   5||
```

In each case, removing the escape character (or characters) would cause the token to be a potential number.

##### 2.3.1.1.2 Examples of Potential Numbers

As examples, the tokens in the next figure are potential numbers, but they are not actually numbers, and so are reserved tokens; a conforming implementation is permitted, but not required, to define their meaning.

 `1b5000` `777777q` `1.7J` `-3/4+6.7J` `12/25/83` `27^19` `3^4/5` `6//7` `3.1.2.6` `^-43^` `3.141_592_653_589_793_238_4` `-3.7+2.6i-6.17j+19.6k`

Figure 2.10: Examples of reserved tokens

The tokens in the next figure are not potential numbers; they are always treated as symbols:

 `/` `/5` `+` `1+` `1-` `foo+` `ab.cd` `_` `^` `^/-`

Figure 2.11: Examples of symbols

The tokens in the next figure are potential numbers if the current input base is `16`, but they are always treated as symbols if the current input base is `10`.

 `bad-face` `25-dec-83` `a/b` `fad_cafe` `f^`

Figure 2.12: Examples of symbols or potential numbers