Hacker News new | ask | show | jobs
by spiritus_ 3604 days ago
I still think the approach is kind of misleading. Because the (apparent) complexity of the math formula is only linked to the fact you're using a decimal formula for a binary operation.

The operation, mathematically, is extremely simple.

2 comments

> The operation, mathematically, is extremely simple.

You're absolutely right, and this was my main problem; labelling the complicated version as 'math' seems to imply that the simple definitions, the wonderful patterns, etc. are somehow 'not math'.

> a decimal formula for a binary operation

It's not the base which makes it complicated; it's extracting each digit individually. Using the same approach to define a digit-wise operation in base 10 would be just as nasty, except you'd have powers of 10 instead of powers of 2, and mod 10 instead of mod 2.

In other words, just because decimal lets you write numbers like "946", it doesn't make it trivial to get the "9", "4" or "6" individually using 'highschool algebra'; you need to use mod, division, floor/subtraction, powers of ten, etc. just like that formula does for base 2.

Of course, if we don't stick to highschool algebra, it can be as trivial as we like. "The digits of 946" is a perfectly well defined mathematical/numerical operation, so we can just say that and we're done. Likewise, we can make a trivial formula for bitwise AND, like "x ^ y", by defining "^" as 'bitwise AND'.

In a way, formulas like that given in the article are only complicated because they're making assumptions about some operations being 'more fundamental' than others; but in "real" math (i.e. not highschool rote learning and number crunching), we're free to use whatever operations we want, as long as we define them precisely; "bitwise AND" is a perfectly fine definition, and just as good as "addition" or "multiplication".

You're perfectly welcome to define operators in terms of other things you consider to be 'more fundamental'; Russell and Whitehead famously did this in Principia Mathematica, considering sets to be more fundamental than arithmetic and requiring 300+ pages to reach a proof of "1 + 1 = 2".

Yet Goedel showed that no set of axioms is 'best', in which case you might as well use whichever ones make life easiest. When you're calling a formula "dreadful", it implies that you've not made your life easy ;)

Fair, changed paragraph to "While the result is easily computed and the process easily understood in base 2 (i.e., using the ‘bit strings as language’ lens), the AND function written in base-10 notation looks in fact non-trivial:"

The point of the article is to switch bases (exploring the many facets).

Per my previous thoughts, "the binary notation is a contingency, useful to understand and define specific functions that will run fast on computers given their binary architectures. However, because the notation does not convey meaning in itself, those numbers and functions are as well described in any arbitrary base, namely base 10 for humans, or base 16 (hexadecimal) for conciseness."