Lasso Soft Inc. > Home

[lp_math_root]

Linklp_math_root
AuthorBil Corry
CategoryMath
Version8.x
LicensePublic Domain
Posted28 Dec 2005
Updated28 Dec 2005
More by this author...

Description

Returns the nth root a number; square root is default.

Requires [lp_math_antilog] [lp_math_log] [lp_decimal_precisionset]

Sample Usage

lp_math_root: 16;
'
'; lp_math_root: 27, 3;

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_root',
		-description='Returns the nth root a number; square root is default.',
		-priority='replace',
		-required='decimal',
		-optional='root';

	// http://mathforum.org/library/drmath/view/52651.html
	
	if: !(local_defined:'root');
		// square root
		return: (math_sqrt: (decimal: #decimal));
	/if;
	
	local:'return' = (lp_math_antilog:((lp_math_log: (decimal:#decimal)) / (decimal: #root)));
	local:'temp' = (string:(lp_decimal_precisionset:#return, 2))->(removetrailing:'0') & ->(removetrailing:'.') &;
	if: #temp !>> '.';
		return: (decimal:#temp);
	/if;
	return: (lp_decimal_precisionset:#return);

/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