News for hackers. Stuff that matters.
Re:Claude Shannon Turns 1100100 by svantana on Saturday April 30, 2016 @03:01PM (#11603039)
Do you also prefer "standard" lengths of decimal numbers, and if so, what are those?

On a related note, I once had the weirdest bug in a C program that I couldn't figure out. It turns out that I had stylized an array of integers with preceding zeros, like: {025, 057, 112} to make it pretty. Little did I know that those zeros made the numbers octal!

Re:Claude Shannon Turns 1100100 by Natsu on Saturday April 30, 2016 @05:12PM (#11603624)
Yes, I do prefer standard lengths of decimal numbers. With decimal numbers, we break every group of 3 up with a comma. It's much easier to read 1,000,000 than 10000000, after all. If you disagree, I hope you noticed that I wrote two different numbers (1 and 10 million).

So I prefer if you break up binary numbers on either 4 or 8 bit boundaries with a space and leading zeroes, as is very common in hex editors. So I'd have written either 01100100 or 0110 0100, either of which would be easier to interpret.

Re:Claude Shannon Turns 1100100 by jacobolus on Saturday April 30, 2016 @05:18PM (#11603644)
Using an initial 0 to indicate octal is a terrible convention. I’m very glad that Python 3 makes 0123 into a syntax error, and uses the form 0o123 instead for octal literals, to match the style of 0x53 (also adds 0b1010011 for binary).
Re:Claude Shannon Turns 1100100 by Tiksi on Saturday April 30, 2016 @07:20PM (#11604100)
I wonder if there's a reason for keeping the leading 0 there past tradition/convention. 0x as a prefix makes sense to differentiate between 0x12 and 012, but if it's 0x 0b and 0o, imo it'd make more sense to drop it and just leave it as o12, b12, x12, etc.
Re:Claude Shannon Turns 1100100 by MaxGabriel on Saturday April 30, 2016 @07:46PM (#11604168)
o12, b12, and x12 are all valid variable names
Re:Claude Shannon Turns 1100100 by Tiksi on Saturday April 30, 2016 @08:24PM (#11604303)
Yeah... not sure how that slipped my mind, seems quite obvious now. Thanks
Re:Claude Shannon Turns 1100100 by chj on Saturday April 30, 2016 @09:02PM (#11604406)
I prefer the Scheme way: #x53, #o123, #b1010011

It feels more natural to my taste. We already use #1, #2, ...

Re:Claude Shannon Turns 1100100 by Cyph0n on Saturday April 30, 2016 @03:33PM (#11603161)
With binary especially I feel it's easier to read if the number is written out in nibbles. Besides, many of us were introduced to binary through ASCII, so the 8 bit format feels even more natural imo.

Oh damn, that must have been tough to find!

Re:Claude Shannon Turns 1100100 by B1FF_PSUVM on Saturday April 30, 2016 @06:23PM (#11603893)
Ah, the oblivious tyranny of the victorious 8-bitters.

The days of the 6-bit register or the 18 or 36 bit words are gone, dust beneath the heels of the conquering hordes of the 8008 microprocessor heirs.