To convert a decimal number (dn) to degrees (d), minutes (m) and seconds (s):
d = int(dn)
mi = frac(dn)*60
m = int(mi)
s = frac(mi)*60
Note that int(n) denotes taking the integer part of a number (i.e. int(49.5125) = 49) and frac its fractional part (i.e. frac(49.5125) = 0.5125). mi is an intermediate result.
Example: To convert 49.5125 decimal degrees to degrees, minutes and seconds:
d = int(49.5125) = 49
mi = frac(49.5125)*60 = 0.5125*60 = 30.75
m = int(mi) = int(30.75) = 30
s = frac(mi)*60 = 0.75*60 = 45
Many calculators have a built-in function to compute this - it is often called "dms" or "hms". Switch to scientific mode on your calculator. To convert from decimal to degrees, minutes and seconds, enter the number, then hit the dms button.
To convert from degrees, minutes and seconds to decimal degrees, enter the degrees, a decimal point, then the minutes (2 digits) and seconds, then hit the [x]Inv (Inverse) button to get the inverse function and hit the dms button again.