News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Bearing and distance

Started by GregL, September 04, 2007, 01:33:36 AM

Previous topic - Next topic

GregL

Writing code for the FPU is a kick. I coded this "Great Circle" bearing and distance formula for the FPU. I use it for Amateur "Ham" Radio. There is a text file in the zip that describes the formula. It's giving correct results for the tests I've run. I think I have optimized the 'BearingDistance' procedure about as much as I can.


[attachment deleted by admin]

raymond

QuoteWriting code for the FPU is a kick.

That's what I've always maintained once you learn the ropes. And you seem to have mastered it well, specially keeping track of the content of the registers. :clap: :clap:

I don't know what you meant by "I have optimized the 'BearingDistance' procedure about as much as I can". If it's only to display one result at a time while the user ponders over the result for a few seconds, optimizing it further would make no sense. If it was to loop a few million times to search for a specific result, a few minor tweaks could probably afford some minor improvement but probably not very significant.

One detail I noticed: Initializing REAL10 variables with more than 19 significant digits is totally useless; even the 19th one may be useless depending on how the assembler performs the conversion. And simply computing the constants for converting to/from degrees/radians would provide you with the most precise REAL10 values you could expect without having to find such values and insert them in your source code as ascii.

BTW, some of the code comments looked "pleasantly" familiar; made me feel good. :clap:
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

GregL

Raymond,

Thanks for the comments.

QuoteI don't know what you meant by "I have optimized the 'BearingDistance' procedure about as much as I can"
By optimize I meant doing it in the least number of operations, and trying to make best use of the FPU registers.

QuoteInitializing REAL10 variables with more than 19 significant digits is totally useless;
You're right. The REAL10 variable values were copied and pasted from Microsoft Calculator Plus. The extra digits don't hurt, so I just left them there.

QuoteAnd simply computing the constants for converting to/from degrees/radians would provide you with the most precise REAL10 values you could expect without having to find such values and insert them in your source code as ascii.
Yes, but computing the constants is slower. Accuracy versus speed.

QuoteBTW, some of the code comments looked "pleasantly" familiar;
'Simply FPU' is great when your coding this stuff. Thanks.  :bg