From a mathematical viewpoint, 36, as with all highly composite numbers, is a convenient choice for a base in that it is divisible by both 2 and 3, and by their multiples 4, 6, 9, 12 and 18. Each base 36 digit can be represented as two base 6 digits.
The most common latinate name for base 36 seems to be hexatridecimal, although sexatrigesimal would arguably be more correct. The intermediate form hexatrigesimal is also sometimes used. For more background on this naming confusion, see the entry for hexadecimal. Another name occasionally seen for base 36 is alphadecimal, a neologism coined based on the fact that the system uses the decimal digits and the letters of the Latin alphabet.
32- and 64-bit integers will only hold up to 6 or 13 base-36 digits, respectively. For example, the 64-bit signed integer maximum value of "9223372036854775807" is "1Y2P0IJ32E8E7" in base-36. For numbers with more digits, one can use the functions mpz_set_str and mpz_get_str in the GMP arbitrary-precision math library. For floating-point numbers the corresponding functions are called mpf_set_str and mpf_get_str.
The decimal value of 12abcxyz is <?phpprintbase_convert("12abcxyz",36,10);?>
The base_convert function converts the value to a floating-point number, which loses accuracy for numbers above implementation-specific limits. For PHP 5.3.6 on 64-bit Linux, the highest base-36 integer that can be represented accurately is 1Y2P0IJ32E8E7, equal to 263 − 1 or 9223372036854775807. Negative signs, decimal points and any characters outside the range 0–Z are stripped prior to conversion, so −1.5 = 15 = F, rather than −1.I as might be expected.
def base36encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"""Converts an integer to a base36 string."""ifnotisinstance(number,(int,long)):
raiseTypeError('number must be an integer')
sign =''if number <0:
number = -number
if0<= number <len(alphabet):
return sign + alphabet[number]while number !=0:
number, i =divmod(number,len(alphabet))
base36 = alphabet[i] + base36
return sign + base36
returnint(number,36)print base36encode(1412823931503067241)print base36decode('AQF8AA0006EH')
PublicFunction ConvertBase10(ByVal d AsDouble, ByVal sNewBaseDigits AsString) AsString' call using ConvertBase10(12345, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") for base36
' can be used to convert to any base
' from http://www.freevbcode.com/ShowCode.asp?ID=6604
Dim S AsString, tmp AsDouble, i AsInteger, lastI AsIntegerDim BaseSize AsInteger
BaseSize = Len(sNewBaseDigits)
DoWhile Val(d) <> 0
tmp = d
i = 0
DoWhile tmp >= BaseSize
i = i + 1
tmp = tmp / BaseSize
LoopIf i <> lastI - 1 And lastI <> 0 Then S = S & String(lastI - i - 1, Left(sNewBaseDigits, 1)) 'get the zero digits inside the number
tmp = Int(tmp) 'truncate decimals
S = S + Mid(sNewBaseDigits, tmp + 1, 1)
d = d - tmp * (BaseSize ^ i)
lastI = i
S = S & String(i, Left(sNewBaseDigits, 1)) 'get the zero digits at the end of the number
ConvertBase10 = S
Geohash-36, a coordinate encoding algorithm uses radix 36 but uses a mixture of lowercase and uppercase alphabet characters in order to avoid vowels, vowel-looking numbers, and other character confusion.
Various systems such as RickDate use base 36 as a compact representation of Gregorian dates in file names, using one digit each for the day and the month.
Dell uses a 5- or 7-digit base 36 number (Service Tag) as a compact version of their Express Service Codes.
The software package SalesLogix uses base 36 as part of its database identifiers.
The TreasuryDirect website, which allows individuals to buy and redeem securities directly from the U.S. Department of the Treasury in paperless electronic form, serializes security purchases in an account using a 4-digit base 36 number. However, the Latin letters A–Z are used before the Arabic numerals 0–9, so that the purchases are listed as AAAA, AAAB... AAAZ, AAA0, AAA1... AAA9, AABA...
The E-mail client program PMMail encodes the UNIX time of the email's arrival and uses this for the first six characters of the message's filename.
MediaWiki stores uploaded files in directories with names derived from the base-36 representation of an uploaded file's checksum.
Siteswap, a type of juggling notation, frequently employs 0–9 and a–z to signify the dwell time of a toss (which may roughly be thought of as the height of the throw). Throws higher than 'z' may be made but no notation has widespread acceptance for these throws.
In SEDOL securities identifiers, the check digit is computed from a weighted sum of the first six characters, each character interpreted in base-36.