Search code examples
numbersdecimalradixprefix

Standard radix for decimal base?


If I need to identify hex, octal, or binary numbers, I can just use prefixes 0x, 0, 0b. They aren't necessarily universal but are pretty recognizable in the programming world.

Is there an identifier like that for decimal (base 10) numbers? I would like to be able to explicitly denote a decimal base number and would like to use a somewhat standard notation if possible.


Solution

  • If you need a general form, then (number)b(base) is used in a couple of projects. 1b10, 1b16, 1b2, etc. can give you some standard way to express bases.

    I've never seen 8x used anywhere tbh. 0 as a prefix - yes.