Often the question is asked "What is the notation for
There are sometimes incomplete or conflicting notations. Please add any other forms. Reformatted as a table for easier comparison. -sf
NOTE: not all forms listed below are actually syntactically correct; rather, the forms would be correct if taken to their extremes and actually implemented.
Intel/ 6502/68K
Raw Form CeeLanguage Zilog Ada/VHDL assembler RexxLanguage Verilog
Binary 10011101 0b10011101 10011101B 2#10011101 %10011101 '10011101'b 8'b10011101
Octal 5 05 05O 8#5 @5 '101'b 4'o5
Hex 1F 0x1F 01FH 16#1F $1F '1F'x 8'h1F
Decimal 27 27 27 27 27 27 27
Footnotes:
There are conflicts. For instance, is "1001" binary or base-ten? Lexical analysis will not be able to resolve the difference, although a LALR syntax analyzer might - with proper context
Why is there no nice notation for binary. . . or "why doesn't C/C++ recognize 1001B as binary?"
Some languages have an arbitrary-radix format.
Verilog, a hardware description language, extends number to include "don't care's" and "high-impedance" values as well as traditional numbers.
'
Where
Other languages have similar constructs.
shouldn't the same example value (e.g. 42 2A 52 101010) be used for all bases?
I interpreted the original idea behind this page as demonstrating syntax, not arithmetic equality. In fact, I used the same numbers which were originally posted by the original author. --SamuelFalvo
See also: NumberTypes