|
I'm not sure if this will make it to the list, but we'll see. I sent out a
message twice and it still hasn't shown up.
Anyway, I have uploaded my fixed-point math routines to my web site. This
includes simple stuff like multiplication and division, but also a full
set of trigonometry routines. Even if you'd rather use floating-point, you
may find the technique for the trig functions valuable, since they're
pretty fast and reasonably accurate, and wouldn't be difficult to convert
to floating.
The URLs are:
http://www.mikeash.com/lego/fixedpoint.h
http://www.mikeash.com/lego/fixedpoint.c
The code is fairly well-explained in the comments (I hope!). I don't have
any additional write-up besides them, though. If you have any questions,
please feel free to e-mail me.
I haven't done any speed tests, but I don't expect any significant speed
differences. 32-bit integer math isn't native to the RCX CPU, and there's
extra bitshifting work that has to be done as well, so my guess is that it
won't be much faster than floating-point. However, it does seem to take up
much less code space, which I personally find very valuable.
Comments, suggestions, criticisms, and offers of money are all welcome. :)
--
"Say not, 'I have found the truth,' but rather, 'I have found a truth.'
"Say not, 'I have found the path of the soul.' Say rather, 'I have met the
soul walking upon my path.'" -- Khalil Gibran
Mike Ash - <http://www.mikeash.com/>, <mailto:mail@mikeash.com>
|
|
Message has 1 Reply: | | Re: Fixed-point Math
|
| Mike- If you want to, I'd be happy (later- busy this week) to mirror those on the sourceforge site. They look quite useful, and I'll be sure to mention those in the HOWTO (whenever I next have time for that. :| Luis (...) ---...--- "Nobody ever said (...) (24 years ago, 16-Nov-00, to lugnet.robotics.rcx.legos)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|