Link | lp_math_HMStoDeg |
Author | Bil Corry |
Category | Math |
Version | 8.x |
License | Public Domain |
Posted | 21 Apr 2006 |
Updated | 21 Apr 2006 |
More by this author... |
Returns degrees given an angle in Hours:Minutes:Seconds.
Requires [lp_decimal_precisionset]
(lp_math_HMStoDeg:'23:59:59');
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_HMStoDeg', -description='Returns degrees given an angle in Hours:Minutes:Seconds.', -priority='replace', -required='degrees', -optional='precision'; if: !(local_defined:'precision'); local:'precision' = 6; /if; // replace the delimiters with ours local:'deg' = (string_replaceregexp: (string:#degrees), -find='[^0-9]',-replace=' '); #deg = (string_replaceregexp: #deg, -find=' +',-replace=' '); #deg->trim; #deg = #deg->(split:' '); // get hours, minutes, seconds local:'h' = 0; local:'m' = 0; local:'s' = 0; if: #deg->size == 1; #h = (decimal: #deg->(get:1)); else: #deg->size == 2; #h = (decimal: #deg->(get:1)); #m = (decimal: #deg->(get:2)); else: #deg->size == 3; #h = (decimal: #deg->(get:1)); #m = (decimal: #deg->(get:2)); #s = (decimal: #deg->(get:3)); /if; // return answer return: (lp_decimal_precisionset: (#h * 15.0) + (#m * 0.25) + (#s * 0.0041666666666666666666666666666667), (integer:#precision)); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft