Sunday, September 15, 2024

Learning Arithmetic

 Learning Arithmetic

By Bobby Neal Winters

Arithmetic was never my favorite subject. (Can I have an AMEN?) Indeed, I hated it. I used to get my mother to do my long division homework for me.

What an irony then that I am now a Professor of Mathematics at a respected state university.  They probably won’t want to include that in their press release.

Actually, the take away from that is mathematics is quite a bit more than arithmetic.

But here I am now, turning 62 next month, relearning arithmetic. 

Having stepped out of administration, I’ve been having a sabbatical of sorts before going back to the classroom, and I am using it to equip myself to step into my university’s growing Computer Science program.

As a part of that, I’ve been learning the architecture (that’s the term they use) of a particular integrated circuit and learning how to program it in assembly language.

I will be getting a little technical but will try not to fly off into full geek mode. You will need to tell me how I do.

Computers store numbers in binary form.  The number 0 is still zero, and the number 1 is still one. Okay, hang on, here we go: The number 10 is two; the number 11 is three; the number 100 is four; and the number 110 is five. I could go on, but it’s not important that you understand the particulars, but that there is a different way numbers are stored in a computer.

The numbers are stored in “bytes.”  This is a pun on the word byte. (Geeks have always been geeks.) Historically bytes have had different sizes.  It’s now been pretty well settled that a byte is 8 bits, i.e. 8 binary digits.  So 11001010 would be a byte.

The unit of memory that a processor works with is called a “word.” The size of the word varies from one type of processor to another.  In most computers these days, you can figure that the word is 32 or 64 bits long.

To bring me back to my topic, the longer the word size the more arithmetic you can do.

The chip I am working with uses the 8-bit byte for its most basic operations and you have to build up from there. You have to know some arithmetic. Let me show you what I mean.

An 8-bit byte can represent a number between 0 and 255 (between 00000000 and 11111111). If you want to add say 17 (00010001) to 20 (00010100), you can do that easily enough to get 37 (00100101). But if you want to add 250 (11111010) to 10 (00001010), you’ve got a problem. The answer is 260 (00100000100). I’ll save you the counting; it requires more than 8 bits to represent.

On this chip, you have to write your coding to extend the addition process.  It’s not hard. The designers of the chip knew this limitation was there and prepared for it.

They did this with multiplication as well. By its very nature, multiplication gives you bigger numbers quickly. The chip I am working with anticipates this by assuming that multiplying two 8-bit numbers will require 16-bits of storage. So right off the bat you can have a product that is as big as 65535 (1111111111111111).

As nice as that is, it will only get you so far, but you can get around this limitation by doing a little math and a little more programming.

Subtraction is handled in a way more similar to addition than it is to multiplication, though there are some complications in the way negative numbers are handled. (Buy me a coffee and a cookie at Signet, and I will tell you about it. You might want a whiskey. Signet can’t help you there.) 

We can even do the equivalent of decimal multiplication using this chip, but I am still getting my head wrapped around it.

Here we come to my favorite subject: division.  This chip doesn’t have 

If I am going to deal with division, there is not going to be any help from the chip. It’s all going to have to be done by programming.

I wish my momma was around to help, but I think she’d just tell me I was on my own.

Bobby Winters, a native of Harden City, Oklahoma, blogs at redneckmath.blogspot.com and okieinexile.blogspot.com. He invites you to “like” the National Association of Lawn Mowers on Facebook. Search for him by name on YouTube.



No comments: