Lasso Soft Inc. > Home

[lp_math_degToDMS]

Linklp_math_degToDMS
AuthorBil Corry
CategoryMath
Version8.x
LicensePublic Domain
Posted20 Apr 2006
Updated02 Sep 2006
More by this author...

Description

Returns Degrees:Minutes:Seconds given an angle in degrees.

Requires [lp_math_range360] [lp_string_pad]

Sample Usage

(lp_math_degtodms: 180.508333);

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

[

define_tag:'lp_math_degToDMS',
	-description='Returns a string of Degrees Minutes Seconds given an angle in decimal degrees.',
	-priority='replace',
	-required='degrees',-copy,
	-optional='delimiter',
	-encodenone;
	
	#degrees = lp_math_range360: #degrees;

	local:'degree' = (math_floor: #degrees);
	#degrees -= #degree;

	local:'minute' = (math_floor: #degrees * 60.0);
	#degrees -= (#minute / 60.0);

	local:'second' = (integer: #degrees * 3600.0);

	if: #minute == 60;
		#minute = 59;
	/if;
	
	if: #second == 60;
		#second = 59;
	/if;	

	if: (local_defined:'delimiter');
		return: (lp_string_pad: #degree, 2) (string:#delimiter) (lp_string_pad: #minute, 2) (string:#delimiter) (lp_string_pad: #second, 2);
	else;
		return: (lp_string_pad: #degree, 2) '° ' (lp_string_pad: #minute, 2) "' " (lp_string_pad: #second, 2) '"';
	/if;

/define_tag;

]

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft