MathFP

Because CLDC doesn't provide the primitive Java types float and double or the corresponding classes Float and Double, it seems that you cannot write a J2ME CLDC application that performs mathematical calculations beyond integer calculations. As a substitute for the missing floating-point arithmetic, Onno Hommes created a library called MathFP providing 32-bit fixed-point integer math functions. The MathFP library and the corresponding documentation can be downloaded at http://www.jscience.net.

To perform calculations in the MathFP format, you need to convert an integer or a string representing a floating-point value to the MathFP format. Those conversions are performed using the static methods of the class MathFP given in Table 10.4.

Get Java™ 2 Micro Edition Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.