Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-04-02 Thread Ron Jensen
On Sat, 2009-01-10 at 17:13 +0100, Csaba Halász wrote: #2 0x0080188d in FGNavRadio::update (this=0x98df490, dt=0.058334) at src/Instrumentation/navradio.cxx:613 613 double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES; (gdb) p x $1 =

Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-04-02 Thread Melchior FRANZ
* Ron Jensen -- Thursday 02 April 2009: I think we need double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES; Agreed. And that's also done just a few lines later, with the exact same parameters. Comitted, thanks! (I also re-used an already initialized node for altitude-ft.) m.

Re: [Flightgear-devel] [BUG] invalid argument to asin () in Instrumentation/navradio.cxx

2009-01-11 Thread Torsten Dreyer
Since dist is calculated by using sqrt() it should never become negative. So the line else if (dist = -y) angle = -90.0; // against roundoff. is probably not really needed. That leaves the question: what happens if dist becomes zero? Apparently that means you have hit the gs-antenna and you

[Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-01-10 Thread Csaba Halász
#2 0x0080188d in FGNavRadio::update (this=0x98df490, dt=0.058334) at src/Instrumentation/navradio.cxx:613 613 double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES; (gdb) p x $1 = 3.2580450943147174 (gdb) p y $2 = 3.258443598627875 (gdb) p y / x $3 =

Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-01-10 Thread John Denker
On 01/10/2009 09:13 AM, Csaba Halász wrote: #2 0x0080188d in FGNavRadio::update (this=0x98df490, dt=0.058334) at src/Instrumentation/navradio.cxx:613 613 double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES; (gdb) p x $1 = 3.2580450943147174 (gdb) p

Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-01-10 Thread Csaba Halász
On Sat, Jan 10, 2009 at 5:50 PM, John Denker j...@av8n.com wrote: On 01/10/2009 09:13 AM, Csaba Halász wrote: #2 0x0080188d in FGNavRadio::update (this=0x98df490, dt=0.058334) at src/Instrumentation/navradio.cxx:613 613 double angle = asin( y / x ) *

Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-01-10 Thread John Denker
On 01/10/2009 10:22 AM, Csaba Halász wrote: Clamping it is guaranteed 100% safe and effective. Something like the attached patch? Not sure what to do about the x == 0 case. How about this version? It assumes dist is not less than zero, but is otherwise pretty defensive. diff --git

Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-01-10 Thread Csaba Halász
On Sat, Jan 10, 2009 at 6:49 PM, John Denker j...@av8n.com wrote: On 01/10/2009 10:22 AM, Csaba Halász wrote: Clamping it is guaranteed 100% safe and effective. Something like the attached patch? Not sure what to do about the x == 0 case. How about this version? It assumes dist is not less

Re: [Flightgear-devel] [BUG] invalid argument to asin() in Instrumentation/navradio.cxx

2009-01-10 Thread John Denker
On 01/10/2009 11:10 AM, Csaba Halász wrote: That approach could also work. Of course the real problem is that this code should never have been performing an asin() in the first place. It's been that way for many years, and it works OK in typical cases, but it is unphysical and (as we have