|
Following some discussion about the topic a few weeks ago, I was
sufficiently curious and motivated enough to write a floating point library
for the H8/RCX. Initially I thought I'd implement a non-IEEE floating
point format optimized for the RCX, but eventually I decided that having
the C compiler (GCC) integrate seemlessly with the library was much more
important than compactness, so I ended up choosing to use the IEEE format.
I also started out thinking I would throw out features like denorms and
NaNs, but then realized that they weren't that costly to implement, that
floating point didn't make as much sense without them, and that testing
would be easier the closer I stayed to the standard, so I ended up
implementing denorms and NaNs according to IEEE. I did end up leaving out
a few things however, namely traps, signalling NaNs, status flags, rounding
modes besides round to even, and (in this version at least) functions not
directly invoked by the compiler: sin, cos, sqrt, etc. The result is a
floating point library that implements all of the underlying floating point
you'd expect to have on mostly any other machine.
The cost of linking the entire library is 1142 bytes, which is
substantially less than the 6K or so reportedly needed by the floating
point support that comes with the compiler. In addition, the library comes
in pieces so that by default the linker only includes the parts of it you
truly need.
The new floating point library has been thrown into a new Librcx
distribution, which includes not only the new floating point routines, but
also a fixed version of malloc, a slightly updated rom.h, and a new long
integer compare function used by the compiler when invoking certain
floating point functions.
The latest version of Librcx can be found at:
http://graphics.stanford.edu/~kekoa/rcx/tools.html#Librcx
-Kekoa
|
|
Message has 1 Reply:
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|