binarysystemtyping

How to denote different numeral systems while typing?


I know that this isn't exactly a programming question, but it's related to the subject for me. How do you denote different numeral systems in just text? (By text I mean able to type at a proper speed and not copy-pasting it from another program.) For example if i have a number in base 2 how do I type it so others can understand that it's a base 2 number. On paper you can do something like (1001)2 where 2 is a small index. Is there some specific symbol that you have to type before the 2 so that others understand it as subscript? (Exponentiation uses the symbol ^ for this.) Or is it all just random and no standard exists in it?


Solution

  • The convention I've seen is that, just as a caret indicates superscript (as for exponentiation), an underscore indicates subscript. So the most "literal" way to translate your example to ASCII would be 1001_2. I agree with JacobM, though; the 0b prefix is unambiguous and unlikely to be misunderstood.