]> git.mxchange.org Git - flightgear.git/commit
Lee Elliot:
authorcurt <curt>
Fri, 16 Sep 2005 20:21:15 +0000 (20:21 +0000)
committercurt <curt>
Fri, 16 Sep 2005 20:21:15 +0000 (20:21 +0000)
commite60223a9529849183623a09a6ce76ffb346b4e8a
treefe54aeac6505cc606d38710c794fe6235fad2335
parente17bc29986a51d917e2127353585d5d600e64bfe
Lee Elliot:

>> Hello List,
>>
>> I think there's a small bug in the moving-average filter in
>> xmlauto.cxx
>>
>> I noticed that the output from it was always out a bit and
>> checking with a calculator showed that it seemed to be dividing
>> by the number of samples + 1 instead of just the number of
>> samples.
>>
>> subtracting 1 from 'samples' in line 702 seems to fix the problem
>> and as 'samples' doesn't seem to be used elsewhere I think it's
>> safe.  Possibly implies that the number of samples may be one
>> less than specified but I'm not familiar enough with c++ to spot
>> it.

Roy Ovesen:

You are right. I would suggest resizing input[] to (samples + 1) instead.
Change lines 654 and 661 to:

input.resize(samples + 1, 0.0);

That way we average over the number of samples as configured.
src/Autopilot/xmlauto.cxx