Sign in to follow this  
rcbarend

XML function "RNOR" BUG !!

Recommended Posts

After 2 day's (and nights :-() of debugging I finally detected why my "great-circle" formula's don't work properly.....Unlike what you would expect (and what is specified in the FS2004 panel SDK), the RNOR function doesnot normalise at "2-PI" (360 degrees, like DNOR), but only at "PI" (180 degrees).Another caution: The Modulo (%) function for negative values might work differently then you would expect:Example: "-1 4 %" gives result "-1", NOT "+3"Not a bug, but just MS'XML implementation of Modulo (this appears to be programming-language / implementation dependant).Hope this saves you some sleepsless nights :-)Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Yeah:(A couple ways around that:Convert to degrees and apply dnor then if necessary, convert back.The other method would be to use mod where:6.45771823 = 370 degrees in radians (6.45771823 pi 2 * %) = 0.17453 = 10 degrees normalized--Jon

Share this post


Link to post
Share on other sites

I didn' write it it too clearly in my xmlgau1 doc that rnor does not work as expected. The modulo functions in any language are not really what you expect mathematically when dealing with negative numbers. That's the reason for some strange huge offsets for some stripe type gauges. Just add a very big number to the altitude and you get a positve number, applying % later will get you back to the normal range anyway.Arne Bartels

Share this post


Link to post
Share on other sites

Hi Jon, ArneYes, solutions are usually easy once you know the problem :-)Cheers, Rob

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this