Wikipedia talk:Manual of Style/Dates and numbers/Archive 22

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 15 Archive 20 Archive 21 Archive 22 Archive 23 Archive 24 Archive 25

Non-base ten numbers

We currently do not have a guideline on how to write numbers that are not decimal (base 10), but hexadecimal (16), octal (8) or binary (2), to name the most frequent different bases. Do we need one? If so, which style?

I am using 0x00 for hexdecimal code points in general, but have also seen most of x00, h00 or 00h, $00, #00, HEX00 or hex00 and 0016 or 1600 in Wikipedia. (Luckily not in articles I edited so far.) Subscript indices are certainly the most flexible solution, but also the most cumbersome to write, second is HEX, DEC, OCT, BIN (upper, lower or caps case) and h, d, o, b, which do not pose a problem when copied to plain text.

I usually use uppercase letters A–F (10–15) for the additional hexadecimal digits and would also use these with other bases larger than ten, if I needed to, although duodecimal (base 12) also commonly uses X (10) and # (11). Christoph Päper 8 July 2005 03:27 (UTC)

When I expanded the base (mathematics) article a while back, I used the 1238 style because I needed that flexibility, and because it was the only non-computer way I knew. A style for that wouldn't be a bad idea - what do you think it should be? (Maybe different contexts call for different notations?) Neonumbers 8 July 2005 10:29 (UTC)
0x prefixing is "C notation". It is fairly widely used in programming languages that are (or were originally) built on C, like Perl, Python, and Java, and is often adopted in more general texts. I've used it myself in prose, but also made sure to add a note explaining the convention. Other times I just put something like "2C (hex)". Subscripts seem to be the preferred format in mathematical formulas, from what I remember reading, and I've seen them in prose, but when they appear in prose or in tables (like character code charts), it's terribly distracting, especially if it is used more than once. Someone recently tried to use a subscripted "HEX" on a bunch of code value ranges in one article I watch, and it looked horrible. Even if the subscripts were made extra small, I don't think they should be recommended in prose, ever. — mjb 8 July 2005 19:14 (UTC)
What I had in mind was, in articles about programming etc., use C notation, and in all other articles, use that subscript notation that you (mjb) advise against; but in articles that use lots of only one type of number, just say so at the beginning of the article and let that be the only notice for that article. Same goes for sections and tables. Neonumbers 9 July 2005 12:17 (UTC)
I agree. In articles in which the numbers are binary-related, use the C prefixes (0x, 0b, uhh... what is the prefix for octal?) For general descriptions of numbers, in which the base could just as easily be 12 or 37, use subscript notation of some type. - Omegatron 18:55, July 11, 2005 (UTC)
For octal it's just "0", which might be confusing. – Smyth\talk 10:58, 12 July 2005 (UTC)

Possible addition to MoS on this topic:

For numbers not in base ten,
  • in computer-related articles, use the C programming language prefixes, that is, 0x for hexadecimal, 0 for octal and 0b for binary
  • in all other articles, use subscript notation, for example 1379, 2416, 2X9#12

Please check that the C prefixes I wrote are correct. Any changes? Neonumbers 01:46, 14 July 2005 (UTC)

I like it. 0 for octal is pretty confusing/ambiguous, though. It's only used in a few articles, I'm sure, so maybe a note should be made on each page where it's used? - Omegatron 04:00, July 14, 2005 (UTC)
After thinking about it, I'm in favor of prefixed, lowercase ‘b’, ‘o’, ‘d’, ‘h’, where that suffices. They are short, easy to type and their meaning can be guessed easily. Otherwise, which should be rare, use decimal subscripts. Use uppercase letters A–Z for d10–35, if necessary, i.e. A–F in hexadecimal. Christoph Päper 04:26, 17 July 2005 (UTC)
Well, whatever's convention... Neonumbers 01:20, 18 July 2005 (UTC)
For numbers in bases other than base ten,
  • in computer-related articles, use the C programming language prefixes, that is, 0x for hexadecimal, 0 for octal and 0b for binary. It may be a good idea to include a note at the top of the page about these prefixes.
  • in all other articles, use subscript notation, for example 1379, 2416, 2X9#12, A87D16 (use <sub> and </sub>)
  • For bases eleven and higher, use whatever symbols are convention for that base. Where applicable, use uppercase rather than lowercase letters, thus 0x5AB3 not 0x5ab3.
I haven't changed the part about computer-related prefixes, could someone in that field please advise of convention.
If there are no objections on or before 25 July 2005 UTC, I will add the above text to the Manual of Style. Neonumbers 11:17, 19 July 2005 (UTC)