Subject:
|
Re: FW: Something else is needed, I think...
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Wed, 5 May 1999 14:27:58 GMT
|
Original-From:
|
Paul Speed <pspeed@SAYNOTOSPAMaugustschell.com>
|
Viewed:
|
1244 times
|
| |
| |
Mario Ferrari wrote:
>
> In lugnet.robotics, Kekoa Proudfoot writes:
> > stephen p spackman <stephen@acm.org> wrote:
> > > But what does it benefit us? *This* is creeping featurism at its worst:
> > > FORTRAN has it, so we should too.... In my entire professional life I've
> > > never had an application for floating point.
> >
> > Floating point is easier to use than fixed point for many. Not that I need
> > floating point, I can figure out the math and use fixed point. Moreover, I
> > can use GCC and Librcx/LegOS and program at the lowest-level too!
> >
> > My point is that some people - the ones who the byte code is being targeted
> > for - want the convenience of floating point. The tradeoff I mentioned
> > before was between space and functionality/usefulness. The amount of
> > usefulness is fixed; the space is not. If I can write a satisfying set of
> > floating point routines in very small amount of space, that might be worth
> > including as part of a byte code interpreter.
> >
> > That's all I'm saying. This is not creeping featurism.
>
> I agree with Kekoa. Floating point is simply an easier paradigm for many of us
> to do things that take much more effort and math knowledge to be done with
> fixed point. I succeeded in writing a legOS program that performs a lot of
> trig math with fixed point (four decimals). I had to write fixed point
> versions of sin, cos and arcsin, all of them based on a single table for the
> first quadrant of the sin function.
> I am really happy with the whole thing, but if I had had FP emulation I'd had
> used it! :-)
So far every discussion I've seen about fixed point math
that's gone to any detail to explain the implementation has had it
a little off. Usually, trying to impose the decimal system onto
your fixed point routines makes them both harder to code and slower
to run.
The way it was usually done in the graphics code I used
to write was to pick some number of bits as your decimal portion.
A shift to the right gets you your whole number, and a masking off
to get the lower bits gets you your decimal value. Math operations
work pretty much the same way except that multiplication and
division require some special care. In general, single
multiplication results need to be divided by pow(2,n) and single
division results need to be multiplied by pow(2,n). As you can
see, in some cases that would be unnecessary when doing successive
mults and divs.
The nice thing about fixed point versus floating point is
that it is more consistent. By restricting yourself to a certain
quantity of numbers you get the same precision everywhere. Contrast
that to floating point where I can have really big numbers and
really small numbers and then I generally lose something from them
when I try to use them both in operations. Not to mention that
floating point seems to have trouble representing some whole
numbers.
Anyway, if the RCX's processor does not have any bit
operation routines then please ignore everything I've just
said. :) However, if it does have them then they need to be
exposed through byte codes in whatever interpretter is written.
Then a simple fixed point system can be implemented on top of that
perhaps even by the compiler.
As you can see, I'm not really a big fan of floating point.
-Paul (pspeed@progeeks.com)
--
Did you check the web site first?: http://www.crynwr.com/lego-robotics
|
|
Message has 1 Reply: | | Re: FW: Something else is needed, I think...
|
| (...) The one advantage to working with radix 10, on the RCX at least, is that the display routines use this radix, so even if you prefer working with some power of two radix, you might find yourself stuck converting in the end. Not that this is (...) (26 years ago, 5-May-99, to lugnet.robotics)
|
Message is in Reply To:
| | Re: FW: Something else is needed, I think...
|
| (...) I agree with Kekoa. Floating point is simply an easier paradigm for many of us to do things that take much more effort and math knowledge to be done with fixed point. I succeeded in writing a legOS program that performs a lot of trig math with (...) (26 years ago, 5-May-99, to lugnet.robotics)
|
32 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|