Wednesday, June 29, 2022

# 2+2 is NOT always 4. Here’s why…

Okay, being a little esoteric here. Sure 2 units added to 2 units (whatever the unit is) will add to 4 units (whatever the unit is). A man with 2 balls arrives and gives you 2 balls. Another man (or woman) with 2 balls give you the 2 balls…you carefully count them and they’re exactly 4 and you’d be right. Right only in the analog world! Warning: We live in a digital world!

The simple analog assumptions are not be taken lightly and can cost you (or if you ever had/have a business, your business) immense errors, even disastrous!! Just recenty, a man ordered a diamond jewelry for his wife for \$2000/piece. He ordered one piece. He got 47 pieces @ \$2000/each! How did this error happen? Welcome to the world of automation==world of computing == world of different ways of calculating.

Inputs! Inputs (i.e. orders) are made by humans, either by phone or more often via web forms on the Internet. These forms are driven by computer codes, not humans. The computer code interprets the inputs, then sends the parameters to perhaps another web service, calling another API, finally one that makes entries to a database which is the backbone of all order processing for the company (e.g. Amazon, Alibaba, etc.). The order-filler comes in (who’s not technical) and his job is to pick up the orders shown on screen or print-outs for the day that he has to process…packaging, overseeing, etc. etc. Then then it goes further downstream finally to shipment. So, how do these errors occur? 1 order to 40x? ATMs giving out 100s of \$\$ on error?

Friends, it’s all about how differently computers process numbers than we humans. We count in simple digits…meaning fingers, base 10. We memorize the multiplication table to a degree and an accountant can figure out most numbers within reason. The calculators we’ve built and use regularly are tailored around that mindset. BUT! Computers don’t think that way 🙂 Languages that programmers use are not made that way. So 2+2 is NOT a simple 4!

Allow me to explain (it’s wonky, and it won’t make sense to people who haven’t deal with computer programming, but anyone with wonder should find it interesting)…

Programmers have to code EVERYTHING that happens from your input to the delivery (or what we call e2e). Their code is NEVER perfect and never will be, those defects are what we lovingly call “bugs”. There’s no software that I know of in my decades of experience working with the smartest people on Earth, Fortune 100 companies that are bug-free 🙂  That’s another story for another day, let’s get back to 2+2!

If x=”2″ and y=”2″ then x+y is NOT 4, but 22! Yes, try it in any modern language (C/C++/C#, Python, Javascript, etc.). Because “2” is NOT equal to 2.

then say, x=2, y=2. And you (programmer in charge) take the output and work in binary (the core numerical base for computing) and it becomes NOT 4, but 0001000. Whoa, what? Yes.

But now you want to get away from these cryptic computer lingo, and compute the more human-like inputs of “two” plus “two”. Well, the output in binary is then: 01110100 01110111 01101111 01110100 01110111 01101111

Damn! Let me convert it to decimal (which we use daily!)…it becomes 128056319833967

Heck, I didn’t order that many diamonds!

Anyway, I can go on with hexadecimals and other conversions, and using additional bases (other than base 10, decimal that humans use daily in “real” life). But when it comes to computing, the “real” life is very different my friends, and not knowing these differences can cost jobs, but worse, cost a company’s perpetuity/existence!!

I hope you had a glimpse to the underlying input processing, number-crunching variations, and their different outcomes. Feel free to comment or suggest new twists in comment section. Cheers!

This site uses Akismet to reduce spam. Learn how your comment data is processed.