The World According to Nick
My take on Software, Technology, Politics, and anything else I feel like talking about.
Saturday, November 13, 2004

sizeof( short ) 

There are a lot of different rumors floating around about how Bush stole another election. I'm not going to discuss them because they are really the talk of tin foil hat wearing folks. Instead I will approach part of this from a geek's perspective. This Wired article goes over those myths pretty thoroughly. However, while reading this article on debunking those rumors, I finally saw a more detailed explanation for one of the electronic voting machine problems in Florida:

CLAIM: Touch screen machines in Broward County started "counting backwards."

No, they didn't. The voting machines in the precincts worked fine.

Broward's central vote-counter was not programmed to expect more than 32,000 votes in any single precinct.

With the limit exceeded, the running totals in four races (all constitutional amendments) did, indeed, start declining.

Observers quickly noticed it. It got fixed. The accuracy of the individual voting machines was never in question. Nobody's vote was a "negative" that subtracted from the vote totals.

32,000? I'm sure those of you non-geeks out there are probably thinking "What an arbitrary number". Actually the number isn't 32,000... it would be 32,768. Huh? That's even stranger Nick. Actually it's not. In computer parlance, that's the size of a two byte signed integer (called a short). In other words, that's the largest number that can be held in two bytes of memory if you assume negative numbers are possible. It is equal to 2 to the power of 15 (the 16th bit represents positive or negative). When you run past that maximum size, one of two things will occur depending on you the environment. Either an exception gets thrown and you get an ugly error box (which it sounds like never happened), or it overflows, setting the "sign bit" making the number negative. Sounds like that's what happened.

I have a couple of questions for the programmers of those touch screen voting systems. First of all, why would you use a signed integer? Votes can never be negative, so why not make it unsigned? Two things happen when you do this. First of all you instantly double the number of votes those same two bytes can represent, to 65,536. The second is you reduce your chance of error by one less possibility.

My second question is, why a two byte integer? Now then, I have no idea what operating system this uses, or how what kind of hardware we're talking about. But memory is cheap. Spring for a 4 byte integer guys (4,294,967,296 unsigned). I know. Even better... use a god damn long, which is 8 bytes (18,446,744,073,709,551,616 unsigned). The primary job of this machine is to count! Why on Earth would you try to short change the ability of this machine to do the one thing it's intended to do? You're telling me that out of the megabytes of memory that I guarantee this piece of hardware has available, you couldn't find a measly 2 or 6 more bytes somewhere to use?

Comments:

I'll kill 2 birds with one stone.
1. You complain that you don't get that many comments. Here you go.
B. 32768 would be stranger. 32767 would be correct.

  Posted at November 16, 2004 12:52 PM by Anonymous Anonymous  
Oh sure... can't forget about zero. ;)

  Posted at November 16, 2004 1:24 PM by Blogger Nick  
Post a Comment

About Me



Name: Nick
Home: Wauwatosa, WI, United States

I'm a Software Consultant in the Milwaukee area. Among various geeky pursuits, I'm also an amateur triathlete, and enjoy rock climbing. I also like to think I'm a political pundit.


 View My Profile

Archives
 Home Page

Subscribe to this Feed

Search Archives
Previous Posts
Tools vs. Weapons
You Know You're a Geek When...
You've Got to Be Kidding Me
The Control Group
What Do You Workout To?
Speaking of Winamp
What's the Point?
Anonymity and Venom
Oh... If Madonna Says So
Remember Those Activist Judges?

Personal Links
Carnival of the Badger
The Coding Monkey
del.icio.us Links
Flickr Photos
Blog Critics Reviews





Blogroll Me!

music
books
video
culture
politics
sports
gaming

www.flickr.com
This is a Flickr badge showing public photos from Nick_Schweitzer. Make your own badge here.

Credits

Blogcritics: news and reviews







This page is powered by Blogger. Isn't yours?

Weblog Commenting and Trackback by HaloScan.com

RSS-to-JavaScript.com

Listed on BlogShares

Design By maystar