IAppli Fixed Point Math Library

Henry Minsky (hqm@ai.mit.edu)

iMode Top : CLDC 16::16 FixedPoint Library


This is an implementation of a simple fixed point math library for the IAppli (CLDC) Java platform.

Note, I am not a numerical methods or computer arithmetic hacker. Not having easy access to my computer arithmetic texts from college (I'm in Japan at the moment) I scrounged the algorithms from various sources on the net (all references are in the source code). In each case I have very little clue as to how "good" these algorithms are in terms of maximum absolute error, or performance. Most of the functions are documented with some clues as to what kind of performance you can expect.

The package works on fixed-point 32 bit ints, with 16 bits of integer and 16 bits of fraction.

The logarithm function is still under development, and I haven't implemented an exponent function that works yet. If anyone knows a good implementation for fixed point exponential, please email me.

I tested the Sin, Cosine, Tangent and ArcTangent functions pretty well, but not some of the others. In particular watch out for invalid ranges of inputs. The Sin and Cosine should handle inputs from 0 to 2 PI (radians).

Below is a graphic demo that runs on the 503i IAppli phones. I have tested this on the F503i.

For higher precision and a more versatile approach, I recommend looking into the CORDIC algorithms, as described in this article.

Line intersection, Sin and Cosine tests. Hey, that circle looks a little flat on the tops and bottoms!