**Help****- Language - Squeak Semi-formally - 3.3**

**Previous - Squeak Semi-formally - Next**

**3.3 Terms 3: Numerical Terms**

In Section (1) of this specification, digits were defined, which enables Squeak to deal with terms for simple natural numbers. But there are many more kinds of numbers in mathematics, and Squeak provides for these as follows, in a way differing from other computer languages:

number = ["-"][radix"r"]["-"]digits["."digits]["e"["-"]exponent]. |

The first character is an option "-" for negative numbers. The radix (or base, in standard mathematics in English) is specified thus

radix = decimal_digits. |

It is the number-base of the numerical expression following it (explained in beginning algebra). NOTE: In fact radix is between 2 and 36 inclusive (actually, Squeak checks only the lower bound - you may make the upper bound as large as you wish, but you can represent only the first 36 digits of the larger base; numbers entered using them are interpreted correctly however). Also, the set of digits allowed in a number of radix N is the first N characters of the string '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', while the default radix = 10, as in ordinary mathematics, and need NOT be explicitly written if it this is intended. In case you want to calculate on an alternative base, you must explicitly specify the radix, and then Squeak will use it. Note the radix in decimal_digits is followed by the letter "r", marking its end and the beginning of the actual digits of the number.

Having written the radix and the number, one may follow this by the letter "e" for "exponent", followed by more digits:

exponent = decimal_digits. |

This is also as in elementary mathematics.

Note that the given definition of "number" in Squeak allows Squeak to represent and indeed calculate very many different kinds of numbers, including binary (radix=2), octal (radix=8) and hexadecimal (radix = 16). If you are neither a mathematician nor a computer scientist much of this will probably be useless, but since computers store everyting in fact in powers of 2, these may be very handy.