MicroFloat is a Java software library for doing IEEE-754 floating-point math on small devices that don't have native support for floating-point types. Basically this means Java-powered mobile phones (J2ME CLDC 1.0), but I imagine that it could be useful in other similar environments, such as embedded systems. It also turns out to be useful for checking the accuracy of other floating-point implementations. While testing and debugging my own code, I discovered quantitative errors in several other math libraries, including the one used by Sun's 1.4 JRE.
In this package you get support for single and double precision data types, including all standard primitive operations (add, subtract, multiply, divide, mod, comparisons, typecasts) as well as a full reproduction of all methods in java.lang.Math (sin, cos, exp, pow, log, etc.). In theory, these operations should return results which are fully compliant with the IEEE-754 and J2SE specs.
Consult the javadoc for more information on how to use the library.
Version 1.1 (released September 19, 2009) contains a bugfix for a quantitative error in MicroDouble.mul(). All users should upgrade. Thanks to Wolfgang Puffitsch of jopdesign.com for reporting the bug and providing a patch.
You can download the source here: microfloat-1.1.tgz or microfloat-1.1.zip
The contents of this library are Copyright (c) 2003,2004 David Clausen, all rights reserved. Use and distribution are governed by the GNU General Public License
home | contact