Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

60%
+1 −0
Q&A Alternatives better to the binary "0b..." format?

As somewhat alluded to by Chenmunka, if your documentation is generally in the context of a specific programming language and/or compiler, it is probably best to stick to what is required by those....

posted 6y ago by thesquaregroot‭  ·  last activity 4y ago by System‭

Answer
#3: Attribution notice added by user avatar System‭ · 2019-12-08T08:04:07Z (over 4 years ago)
Source: https://writers.stackexchange.com/a/33564
License name: CC BY-SA 3.0
License URL: https://creativecommons.org/licenses/by-sa/3.0/
#2: Initial revision by user avatar thesquaregroot‭ · 2019-12-08T08:04:07Z (over 4 years ago)
As somewhat alluded to by Chenmunka, if your documentation is generally in the context of a specific programming language and/or compiler, it is probably best to stick to what is required by those. However, I think this is also somewhat dependent on why the numbers are appearing in your documentation.

If you are referencing these numbers as something would directly appear in code, you should definitely use the language's standard format for the base you're using. On the other hand, if the documentation is simply bringing up the binary representation to explain a feature or illustrate a point, I think this is less necessary, so long as it is very clear that he number is binary.

The reason for the prefixes in code is that the compiler cannot know what base you're using without a hint. 1011 is valid decimal, hexadecimal, octal, and binary, so a prefix is required to denote which is being used. In your documentation you may be introducing the number with an appropriate context that makes this unnecessary:

    Assuming the following binary representation of [foo]:
    
        10010100111010011000
    
    We can see that it has the properties [bar] and [baz].

In this case I think the `0b` prefix would be unnecessary and possibly even make the documentation less readable, depending on the audiences familiar with programming languages.

In circumstances where large amounts of your documentation may have numbers like this, especially if the base may change depending on the context, introducing the notation early on (e.g. "We will be using the prefix "0b" to denote binary sequences and "0x" to denote hexadecimal sequences") might help as well.

#1: Imported from external source by user avatar System‭ · 2018-01-31T13:40:59Z (about 6 years ago)
Original score: 10