| Number BasesElzed can work in any of five different number bases: binary, octal, decimal, duodecimal, and hexadecimal.
In an expression, Elzed will accept numbers in any base, or combination of bases, at any time. A number's base is denoted by a two-character prefix code. The first character of the prefix is always zero; the second is the base identifier, always a lower-case letter. Here, for example, is the number 21 (base 10) encoded in all supported bases:
binary |
0b10101 |
|
octal |
0o25 |
lower-case 'o' |
decimal |
21, 0d21 |
base 10 is always the default input base |
duodecimal |
0t19 |
't' for twelve. Extended digits are 'D' (dec) and 'E' (el) |
hexadecimal |
0x15, 0h15 |
either 'x' or 'h' is accepted. Extended digits are A-F |
If a number has no base prefix, it is assumed to be presented in base 10. You cannot change the default input base.
The extended digits in bases 12 and 16 are letters. They may be entered in any combination of upper and lower case. Note, however, that base identifiers are always in lower case. Elzed's number base notation also affects how you enter scientific notation; click here for an explanation.
Numeric (double precision floating point) output is, by necessity, always in base 10. String output will display numbers in the currently selected output base. You may set the output base programmatically with the lzSetOutputBase Elzed call. Within an expression, use one of the output base operators:
desired base
|
base operator
|
binary
|
binary
|
octal
|
octal
|
decimal
|
decimal
|
duodecimal
|
duodec
|
hexadecimal
|
hex
|
Why support for base 12? Well, if it was up to me, we'd all be counting in twelves instead of tens. Don't get me started. |