Lasso Soft Inc. > Home

[lp_math_log]

Linklp_math_log
AuthorBil Corry
CategoryMath
Version8.x
LicensePublic Domain
Posted03 Dec 2005
Updated23 Dec 2005
More by this author...

Description

Returns the natural log of a number.  Optionally can choose any base.

Requires [lp_math_e]

Sample Usage

loop: 20;
loop_count ' ';
lp_math_log: loop_count, 2;
'
'; /loop; Returns: 1 0.00000000000000000000000000000000 2 1.00000000000000000000000000000000 3 1.58496250072115630000000000000000 4 2.00000000000000000000000000000000 5 2.32192809488736220000000000000000 6 2.58496250072115610000000000000000 7 2.80735492205760420000000000000000 8 3.00000000000000000000000000000000 9 3.16992500144231260000000000000000 10 3.32192809488736260000000000000000 11 3.45943161863729780000000000000000 12 3.58496250072115650000000000000000 13 3.70043971814109220000000000000000 14 3.80735492205760370000000000000000 15 3.90689059560851870000000000000000 16 4.00000000000000000000000000000000 17 4.08746284125034000000000000000000 18 4.16992500144231220000000000000000 19 4.24792751344358520000000000000000 20 4.32192809488736260000000000000000

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_log',
		-description='Returns the natural log of a number.  Optionally can choose any base.',
		-priority='replace',
		-required='decimal',
		-optional='base';

	// http://mathforum.org/library/drmath/view/55568.html
	
	if: !(local_defined:'base');
		local:'base' = lp_math_e;
	/if;
	
	return: lp_decimal_precisionset:(decimal:(decimal:(math_log: (decimal: #decimal))) / (decimal:(math_log: (decimal: #base))));
	
/define_tag;

]

Related Tags

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