Monday, 19 November, 2001

More Palm Programming

As a first experiment in Palm programming, I'm porting my friend Jeff Duntemann's Mortgage Vision program.  Jeff originally wrote the program in Borland Pascal (or was it still Turbo Pascal back then?) to explore the Turbo Vision application framework.  He and I (mostly he) later converted parts of it to Delphi for inclusion in our Delphi Programming Explorer, and then I converted the code to C++ for the C++Builder Programming Explorer.  It's another one of those learning programs that's relatively simple but makes use of many programming language features.  It's a good learning tool.

So I immediately run into one of the Palm's minor weaknesses--floating point.  The computer can do floating point math okay through emulation, but there isn't really a math library.  The floating point library supplies addition, subtraction, multiplication, and division.  And a routine that'll convert a text string, "123.45" for example, into a floating point number.  There aren't any math functions, though, and the only output function displays the number in scientific notation.  Ugh.

Fortunately, the only math function that the mortgage program requires is pow()--raise a number to an integer power.  That was easy enough to duplicate.  Outputting a floating point number is going to require a little more work.  I guess I could include the standard C sprintf() function, but that seems like overkill.  I'll probably dig into their Calculator source example and see if I can come up with a decent number formatting routine.

Don't you love embedded systems programming?