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.


Flightgear-devel mailing list

Reply via email to