On Thu, 2007-02-08 at 18:55 -0500, John Denker wrote:
> On 02/07/2007 02:14 PM, Andy Ross wrote:
> 
>  > So if there's a design flaw here, it's at a higher level.  Maybe
>  > what's really needed is a "digit extractor" animation instead.
> 
> Good news:   The /design/ is not as flawed as it looks.
> 
> All evidence indicates that the primary problem with the
> step-and-scroll function was not the design;  the primary
> problem had more to do with the implementation.  The code
> was practically begging to get bit by roundoff errors.

John,

I stripped the apply_mod() function out into its own small program for
analysis.  

In the first test, input to the program was a simulated property
changing from 109.89899999999999 to 109.89999999999998.  The '8' marches
one place to the right each run.  Both algorithms were tested with and
without bias, the original algorithm was also ran with a scroll value of
1e-6*step.

In the second test, property was held constant and step was varied
between 0.001 and 100.  The test was ran again with a slightly larger
property.  This test shows the most common usage of the apply_mod
function.

My conclusions:
- With bias set to 0.5 * (smallest expected step) both algorithms return
a correctly rounded result.
- With scroll set to 1e-6*step the original algorithm returns the same
result as your algorithm.
- With a very small error in property your algorithm returns a result
which is close to desired however the exact result varies with the input
error.  While your algorithm returns acceptable results in the instant
case I can not be certain it will not fail in different cases.
- Your algorithm's output can be achieved with the current code, however
you algorithm can not always reproduce the current code's output.

Therefore I recommend we stay with the current code and add either a
bias or scroll value to the xml files of the instruments which require
it.

V/r

Ron

**Test One**
Original algorithm with bias:
109.8989999999999867=109.9000000000000057 (delta=-0.0010000000000190) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8998999999999882=109.9000000000000057 (delta=-0.0001000000000175) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999899999999883=109.9000000000000057 (delta=-0.0000100000000174) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999989999999940=109.9000000000000057 (delta=-0.0000010000000117) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999998999999832=109.9000000000000057 (delta=-0.0000001000000225) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999899999835=109.9000000000000057 (delta=-0.0000000100000221) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999989999878=109.9000000000000057 (delta=-0.0000000010000178) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999998999897=109.9000000000000057 (delta=-0.0000000001000160) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999899870=109.9000000000000057 (delta=-0.0000000000100187) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999989967=109.9000000000000057 (delta=-0.0000000000010090) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999998920=109.9000000000000057 (delta=-0.0000000000001137) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999999773=109.9000000000000057 (delta=-0.0000000000000284) with 
step=0.0100, scroll=0.0000, bias=0.0050

Original algorithm without bias:
109.8989999999999867=109.8900000000000006 (delta=0.0089999999999861) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8998999999999882=109.8900000000000006 (delta=0.0098999999999876) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8900000000000006 (delta=0.0099899999999877) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999989999999940=109.8900000000000006 (delta=0.0099989999999934) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999998999999832=109.8900000000000006 (delta=0.0099998999999826) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999899999835=109.8900000000000006 (delta=0.0099999899999830) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999989999878=109.8900000000000006 (delta=0.0099999989999873) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999998999897=109.8900000000000006 (delta=0.0099999998999891) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999899870=109.8900000000000006 (delta=0.0099999999899865) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999989967=109.8900000000000006 (delta=0.0099999999989961) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999998920=109.8900000000000006 (delta=0.0099999999998914) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999999773=109.8900000000000006 (delta=0.0099999999999767) with 
step=0.0100, scroll=0.0000, bias=0.0000

Original algorithm without bias, with scroll=0.00000001:
109.8989999999999867=109.8900000000000006 (delta=0.0089999999999861) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8998999999999882=109.8900000000000006 (delta=0.0098999999999876) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8900000000000006 (delta=0.0099899999999877) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999989999999940=109.8900000000000006 (delta=0.0099989999999934) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999998999999832=109.8900000000000006 (delta=0.0099998999999826) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999899999835=109.8900000000000006 (delta=0.0099999899999830) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999989999878=109.8989999855502759 (delta=0.0010000134497119) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999998999897=109.8998999874010991 (delta=0.0001000124988906) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999899870=109.8999899847440105 (delta=0.0000100152459765) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999989967=109.8999989944258999 (delta=0.0000010055730968) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999998920=109.8999998897097470 (delta=0.0000001102901450) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999999773=109.8999999749748753 (delta=0.0000000250251020) with 
step=0.0100, scroll=0.0000, bias=0.0000

Your algorithm with bias:
109.8989999999999867=109.9000000000000057 (delta=-0.0010000000000190) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8998999999999882=109.9000000000000057 (delta=-0.0001000000000175) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999899999999883=109.9000000000000057 (delta=-0.0000100000000174) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999989999999940=109.9000000000000057 (delta=-0.0000010000000117) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999998999999832=109.9000000000000057 (delta=-0.0000001000000225) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999899999835=109.9000000000000057 (delta=-0.0000000100000221) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999989999878=109.9000000000000057 (delta=-0.0000000010000178) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999998999897=109.9000000000000057 (delta=-0.0000000001000160) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999899870=109.9000000000000057 (delta=-0.0000000000100187) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999989967=109.9000000000000057 (delta=-0.0000000000010090) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999998920=109.9000000000000057 (delta=-0.0000000000001137) with 
step=0.0100, scroll=0.0000, bias=0.0050
109.8999999999999773=109.9000000000000057 (delta=-0.0000000000000284) with 
step=0.0100, scroll=0.0000, bias=0.0050

Your algorithm without bias:
109.8989999999999867=109.8900000000000006 (delta=0.0089999999999861) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8998999999999882=109.8900000000000006 (delta=0.0098999999999876) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8900000000000006 (delta=0.0099899999999877) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999989999999940=109.8900000000000006 (delta=0.0099989999999934) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999998999999832=109.8900000000000006 (delta=0.0099998999999826) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999899999835=109.8900000000000006 (delta=0.0099999899999830) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999989999878=109.8989999872676577 (delta=0.0010000117323301) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999998999897=109.8998999891184809 (delta=0.0001000107815088) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999899870=109.8999899864613923 (delta=0.0000100135285948) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999989967=109.8999989961432817 (delta=0.0000010038557150) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999998920=109.8999998914271288 (delta=0.0000001085727632) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999999773=109.8999999766922571 (delta=0.0000000233077202) with 
step=0.0100, scroll=0.0000, bias=0.0000

**Test Two**
Original algorithm with property=109.89998999999999 step varing between 0.001 
and 100:
109.8999899999999883=109.8990000000000009 (delta=0.0009899999999874) with 
step=0.0010, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8900000000000006 (delta=0.0099899999999877) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8000000000000114 (delta=0.0999899999999769) with 
step=0.1000, scroll=0.0000, bias=0.0000
109.8999899999999883=109.0000000000000000 (delta=0.8999899999999883) with 
step=1.0000, scroll=0.0000, bias=0.0000
109.8999899999999883=100.0000000000000000 (delta=9.8999899999999883) with 
step=10.0000, scroll=0.0000, bias=0.0000
109.8999899999999883=100.0000000000000000 (delta=9.8999899999999883) with 
step=100.0000, scroll=0.0000, bias=0.0000

Your algorithm with property=109.89998999999999 step varing between 0.001 and 
100:
109.8999899999999883=109.8990000000000009 (delta=0.0009899999999874) with 
step=0.0010, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8900000000000006 (delta=0.0099899999999877) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999899999999883=109.8000000000000114 (delta=0.0999899999999769) with 
step=0.1000, scroll=0.0000, bias=0.0000
109.8999899999999883=109.0000000000000000 (delta=0.8999899999999883) with 
step=1.0000, scroll=0.0000, bias=0.0000
109.8999899999999883=100.0000000000000000 (delta=9.8999899999999883) with 
step=10.0000, scroll=0.0000, bias=0.0000
109.8999899999999883=100.0000000000000000 (delta=9.8999899999999883) with 
step=100.0000, scroll=0.0000, bias=0.0000

Original algorithm with property=109.89999999999999 step varing between 0.001 
and 100:
109.8999999999999915=109.8990000000000009 (delta=0.0009999999999906) with 
step=0.0010, scroll=0.0000, bias=0.0000
109.8999999999999915=109.8900000000000006 (delta=0.0099999999999909) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999999915=109.8000000000000114 (delta=0.0999999999999801) with 
step=0.1000, scroll=0.0000, bias=0.0000
109.8999999999999915=109.0000000000000000 (delta=0.8999999999999915) with 
step=1.0000, scroll=0.0000, bias=0.0000
109.8999999999999915=100.0000000000000000 (delta=9.8999999999999915) with 
step=10.0000, scroll=0.0000, bias=0.0000
109.8999999999999915=100.0000000000000000 (delta=9.8999999999999915) with 
step=100.0000, scroll=0.0000, bias=0.0000

Your algorithm with property=109.89999999999999 step varing between 0.001 and 
100:
109.8999999999999915=109.8999999905631029 (delta=0.0000000094368886) with 
step=0.0010, scroll=0.0000, bias=0.0000
109.8999999999999915=109.8999999909031118 (delta=0.0000000090968797) with 
step=0.0100, scroll=0.0000, bias=0.0000
109.8999999999999915=109.8999999800992668 (delta=0.0000000199007246) with 
step=0.1000, scroll=0.0000, bias=0.0000
109.8999999999999915=109.0000000000000000 (delta=0.8999999999999915) with 
step=1.0000, scroll=0.0000, bias=0.0000
109.8999999999999915=100.0000000000000000 (delta=9.8999999999999915) with 
step=10.0000, scroll=0.0000, bias=0.0000
109.8999999999999915=100.0000000000000000 (delta=9.8999999999999915) with 
step=100.0000, scroll=0.0000, bias=0.0000



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to