links to this page:
Squeak in a Nutshell
literals
Swiki Page List
number literal
Last updated at 1:37 am UTC on 17 January 2006
Notation - BNF
number = ["-"][radix"r"]["-"]digits["."digits]["e"["-"]exponent]
exponent = decimal_digits
radix = decimal_digits
digits = [digit]+
digit = decimal_digit | uppercase letter
decimal_digits = [decimal_digit]+
decimal_digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
NOTE:
the set of digits allowed in a number of radix N is the first N characters of the string:
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
e.g., 2r10101 16r12ABCDEF
default radix = 10,
for all others you must explicitly specify the radix;
NOTE:
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 can represent only the first 36 digits of the larger base;
numbers entered using them are interpreted correctly however.
Examples:
123.2
16rABC
16r17
2r101
-112.3
2.5e6