I am trying to write a simulator for a hardware device with fairly low numeric precision (preferably in Java), and I am looking for a library that implements elementary mathematical operations.
Specifically, I need a class that implements binary floating point arithmetic, and allows the user to set the precision of both the mantissa and exponent. (Probably 8 or 10 bits for the mantissa, and 6 or 8 bits for the exponent.)
I've looked at a variety of packages intended for high precision arithmetic (Apfloat, jScience, the Dfp class in the Apache Commons package), but they all seem to either have the problem of only supporting radix 10, or they do not allow the user to control the precision of the exponent.
Do you have any suggestions for Java packages that would be a better match for my objective, or advice on how to modify an existing library to do what I want?
http://real-java.sourceforge.net/Real.html seems to work with base 2, so you may be able to modify it to support a more limited mantissa and exponent range.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With