Precisely

Precisely was Originally Posted on February 7, 2013 by

When computers were very young (at least for the general public) I had problems with number precision. I was never a math wiz and real vrs imaginary numbers and rounding errors were foreign to me. Although computers were supposed to be experts in math, you could multiple numbers together and divide them again and come up with different results. This was especially true if you used the wrong type container for a number.

So I was interested when my friend told me he could multiply 2 large numbers together with complete accuracy. I won’t bore you with details but in computers, there are some very common numbers that also filter out into real life. You may not realize why they are like they are, but computer people can tell you these are popular. 1, 2, 4, 8, 16, 32, 64, 126, 256 and so on. Also 32767 is another important number.

So when I heard how my friend was going to multiply 2 large numbers together and not use super long integers or whatever, I listened intently.

He put the numbers in a string variable (think text). He would then go through this text representation and convert this character that looked like a “1” to the number 1, multiply it and convert the number back into text to store it.

So, he changed the number to a different form and back again. Nobody said this was efficient, but it allowed him to represent a very large number with complete precision.

Sometimes we have to look at a problem from a different angle to solve a problem. When I wrote an inventory system I knew it would be used my people with no computer skills. At the time Selectric typewriters were common and some people would type a lower case “L” for a 1 or the letter “O” for a zero. Since computer variables (the things that hold data) are finicky about what they hold, I accepted all data from the user as text, testes and then converted as necessary. My programs never quit because the wrong type data was entered.

This is similar to an ATM. If it is possible to put a bank card in the wrong way, the ATM designer has some options. he can reject the card with an error message or he can put two stripe readers in so that if the card is backwards it can still be read.

As I say, looking at a problem from another angle can help solve a problem.

Have you ever thought how they transport nitroglycerin? It is very prone to exploding if jarred. It turns out that if you cool it to about 45 to 50 degrees F, it “freezes” and is safer to transport.

When Hawaii was inundated with coqui frogs, we found that they were very sensitive to PH. To kill them we used citric acid, which caused some environmental issues. We then found that rater than subjecting the fogs skin to an acid, we could go the other way and use something basic and a bit easier to handle and easier to find. Baking soda!

So as I say, when needing to solve a problem, the solution may be something completely off your radar.