On 28 Jan 2010, at 03:45, Ron Jensen wrote:

> Here is a nasal function to determine if a frequency is a localizer.  It
> accepts a frequency in megahertz and returns "1" if the frequency is an
> ILS frequency.
> 
> 
> var isILS=func(freq) {
>  if(freq < 108.10) return 0;
>  if(freq > 111.95) return 0;
>  var bar=int((freq+0.001)*10)-int(freq)*10;
>  return(bits.test(bar,0));
> }

A general observation - it'd be much better to request C++ properties / 
native-nasal functions that implement such logic, rather than coding it up in 
Nasal (in each aircraft / instrument). 

Individually each function is trivial but it does add up to a lot of Nasal 
being run. I've seen other code manually computing if a VOR is in range, and 
various other mathematical / trigonometric / geometric operations. In practice 
the CPU hit is probably negligible, but semantically, the C++ code is already 
computing all this stuff - if it's not being exposed (via properties), or being 
exposed badly or unhelpfully, then I'd much prefer people complain loudly about 
the fact, here.

As Syd already mentioned, this is a case in point with the nav/nav-loc property 
... both that it exists, but also that it wasn't working right - but will be 
(again), soon.

Regards,
James


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to