Ok, and then the final step is the bits.test(bar,0). I spent a couple of 
minutes searching the web but could not find docs for the bits.test 
function. I assume bits.test(oddnumber,0) returns 1 and something else 
for even numbers, presumably 0?

Jari - learning Nasal



On 1/29/10 2:34 AM, Ron Jensen wrote:
> On Thu, 2010-01-28 at 21:59 +0100, Jari Häkkinen wrote:
>> For me the Nasal function looks strange. I can't understand what the
>> addition of 0.001 to freq does? For me it seems to be a waste of
>> precious CPU time.
>>
>>
>> Jari
>
> var bar=int((freq+0.001)*10)-int(freq)*10;
>
> The 0.001 ensures we get the proper number since 'int' truncates and
> doesn't round.
>
> For example, 111.70 is stored internally as 111.69999... since base 2
> and base 10 don't play well together below the decimal point.
>
> int((111.699999...)*10) returns 1116 when what was expected and desired
> was 1117.
>
> 0.001 is large enough to correct the result but small enough not to push
> us to the next station, station spacing is assumed at 0.05.  (The same
> problem exists in C++.)
>
> Ron
>
>
>
> ------------------------------------------------------------------------------
> 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


------------------------------------------------------------------------------
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