As most of you probably have already noticed, Binary Clock for Palm OS now supports the WristPDA. When creating the WristPDA frontend, I decided to add a cool new feature that shows the battery status permanentely(not only if low).
Recreating the Palm OS battery gadget is not too difficult, however, the program simply didn’t work. I managed to track the bug down to a line like this one:
A bit of research made me find out that most Palm OS compilers need globals to execute this operation – multiplication was no option, and division wasnt either. However, as you can see in the image below, the battery gadget works. But why?
I decided to substitute the multiplication with a lookup table. Here is the new code:
Obviously, lookup tables don’t work for very big ranges of numbers – however, when you have less than a few hundred values, they make for a very good way around the problem.
Ever had such a problem?