A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
From: John D. Howard
Date: 2017 Jul 26, 10:43 -0700
Not knowing what programing language you would use I will talk in general terms.
Let DD equal your decimal degrees DD=123.4567
Then use the function that gives you the interger of a number D=INT(DD)
Subtract the interger from the decimal degrees MMSS=DD-D
then multiply the remander by 60 MM=MMSS*60
You will now have D degrees and MM minutes ( with decimal minutes)
D=123 MMSS=DD-D=.4567 MM=MMSS*60=27.4
123 degrees 27.4 minutes
If you need seconds do the same thing again.
This does not deal with negative numbers but with some logic ( ie. if DD is less than 0 than .... ) you can multiply by -1 or take the absolute value or ...
This is only one of doing it. Brad probobly hav a different way.
Hope this helps