Lasso Soft Inc. > Home

[lp_math_degToHMS]

Linklp_math_degToHMS
AuthorBil Corry
CategoryMath
Version8.x
LicensePublic Domain
Posted21 Apr 2006
Updated21 Apr 2006
More by this author...

Description

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

Requires [lp_math_range360] [lp_string_pad]

Sample Usage

(lp_math_degtohms: 359.99583);

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_degToHMS',
	-description='Returns Hours:Minutes:Seconds given an angle in degrees.',
	-priority='replace',
	-required='degrees',-copy,
	-optional='delimiter';
	
	if: !(local_defined:'delimiter');
		local:'delimiter' = ':';
	/if;

	#degrees = lp_math_range360: (decimal:#degrees);

	local:'hour' = (math_floor: #degrees / 15.0);
	#degrees -= (#hour * 15.0);

	local:'minute' = (math_floor: #degrees / 0.25);
	#degrees -= (#minute * .25);

	local:'second' = (integer: #degrees / 0.0041666666666666666666666666666667);

	return: (lp_string_pad: #hour, 2) (string:#delimiter) (lp_string_pad: #minute, 2) (string:#delimiter) (lp_string_pad: #second, 2);

/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