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.

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.

Can anyone commit this?!

-- 
Roy Vegard Ovesen

_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to