Sunday, December 10, 2023

HP 71B and HP 75C: Degrees and DMS Conversions

HP 71B and HP 75C:  Degrees and DMS Conversions



At default, the HP 71B and HP 75C do not have conversions between degrees and degrees-minutes-seconds.   Here are two short programs to remedy this and can be used as subroutines.  The language used is BASIC.



HP 71B and HP 75C Code:  DMS to Degrees.  File Name: DMS2D


10 INPUT "d, m, s? ": H, M, S

20 D=SGN(H)*(ABS(H)+M/60+S/3600)

30 PRINT D; "°"




HP 71B and HP 75C Code:   Degrees to DMS.   File Name:  D2DMS


10  INPUT "DEC DEG? "; D

20 G=SGN(D) @ D=ABS(D) @ H=IP(D)

30 M=IP(FP(D)*60)

40 S=FP(FP(D)*60)*60

50 PRINT G*H; "°"; M; "m"; S; "s"



Notes:  


1.  The degree character, °, can be typed by the following combinations:

HP 71B:  g, CTRL, A

HP 75C:  CTL + A


2.  When entering DMS, separate degrees, minutes, and seconds by commas.  For negative degrees in DMS format, enter the negative sign in front of degrees.  


3.  Repeating decimals (like 42.606666666...) may produce approximate conversions.  



Examples to Try


43.25° ←→ 43° 15m 0s 


-63.27°  ←→ -63° 16m 12s


42.60166667° ←→ 42° 36m 6s  (about)




Eddie


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.