Added more builtin inverse conversion functions

Added builtin functions to convert between degrees, minutes and
    seconds and degrees under the config("mod") round rules:

	dms2d(d, m, s [,rnd]) - convert deg, min, and secs to deg
	dm2d(d, m [,rnd]) - convert deg, min to deg

	See help/dms2d and help/dm2d.

    Example:

	; print dms2d(12, 20, 44.16);
	12.3456

	; print dm2d(3601, -25.5594);
	0.57401

    Added builtin functions to convert between gradians, minutes and
    seconds and gradians under the config("mod") round rules:

	gms2g(g, m, s [,rnd]) - convert grad, min, and secs to grad
	gm2g(g, m [,rnd]) - convert grad and min to grad

	See help/g2gms and help/g2gm.

    Example:

	; print gms2g(12, 20, 44.16);
	12.3456

	; print gm2g(4001, -25.5594);
	0.57401

    Added builtin functions to convert between hours, minutes and
    seconds and hours under the config("mod") round rules:

	hms2h(h, m, s [,rnd]) - convert hours, min, and secs to hours
	hm2h(h, m [,rnd]) - convert hours, min to hours

	See help/hms2h and help/hm2h.

    Example:

	; print hms2h(12, 20, 44.16);
	12.3456

	; print hm2h(241, -25.5594);
	0.57401
This commit is contained in:
Landon Curt Noll
2021-09-27 02:14:18 -07:00
parent d5de36841a
commit ada15fdabc
10 changed files with 833 additions and 8 deletions

View File

@@ -530,3 +530,15 @@ E_H2HM1 Non-lvalue arguments 2 or 3 for h2hm
E_H2HM2 Non-real-number arg 1 for h2hm
E_H2HM3 No-assign-to argument 2 or 3 for h2hm
E_H2HM4 Invalid rounding arg 4 for h2hm
E_DMS2D1 Non-real-number aarguments 1, 2 or 3 for dms2d
E_DMS2D2 Invalid rounding arg 4 for dms2d
E_DM2D1 Non-real-number aarguments 1 or 2 for dm2d
E_DM2D2 Invalid rounding arg 4 for dm2d
E_GMS2G1 Non-real-number aarguments 1, 2 or 3 for gms2g
E_GMS2G2 Invalid rounding arg 4 for gms2g
E_GM2G1 Non-real-number aarguments 1 or 2 for gm2g
E_GM2G2 Invalid rounding arg 4 for gm2g
E_HMS2H1 Non-real-number aarguments 1, 2 or 3 for hms2h
E_HMS2H2 Invalid rounding arg 4 for hms2h
E_HM2H1 Non-real-number aarguments 1 or 2 for hm2h
E_HM2H2 Invalid rounding arg 4 for hm2h