On Friday 22 April 2005 01:46, Norman Vine wrote:
> Andy Ross writes:
> > Vivian Meazza wrote:
> > > I used the power form because it is easier to read, but if the other
> > > form produces a performance advantage, then of course we must use
> > > it.
> >
> > It's actually not so much about performance, really.  Readability can
> > mean different things.  The problem is that when I see a trancendental
> > function in code, I immediately start thinking that it much be some
> > complicated formula typed in from a book, as these things don't occur
> > in typical programmer's brains all that often.  Basically, even though
> > in isolation it's easier to read "pow(foo, 3)" than "foo*foo*foo",
> > when you look at the whole expression, your original one is
> > "complicated" to me:
> >
> >   (-0.25 * math::pow(rpm_norm,3)) + (-0.15 * math::pow(rpm_norm,2))
> >    + (1.11 * rpm_norm);
> >
> > Whereas this one is just really obviously a polynomial, and I
> > understand polynomials, they're simple and not scary at all:
> >
> >    rpm_norm * (1.11 - rpm_norm * (0.15 * rpm_norm + 0.25))
> >
> > I'll work up a version of the new one with the sign bug fixed, and try
> > to get that checked in tonight.
>
> Hmmm.....
>
> I find it all to easy to make silly mistakes with nested parentheticals
> and usually avoid them unless absolutely needed

The silly mistake was that 0.15 and 0.25 got swapped. This is what it should 
have read:
         rpm_norm * (1.11 - rpm_norm * (0.25 * rpm_norm + 0.15))

-- 
Roy Vegard Ovesen

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to