# [lp_math_percentage]

 Link lp_math_percentage Author Bil Corry Category Math Version 8.x License Public Domain Posted 23 Dec 2005 Updated 23 Dec 2005 More by this author...

#### Description

Returns the percentage value given the part and the total.

Requires [lp_decimal_precisionSet]

#### Sample Usage

```Percentage Examples:

Without precision:
['[']lp_math_percentage: 2, 5[']'] = [lp_math_percentage: 2, 5]
['[']lp_math_percentage: 2, 5.82[']'] = [lp_math_percentage: 2, 5.82]
['[']lp_math_percentage: 2.73, 5[']'] = [lp_math_percentage: 2.73, 5]
['[']lp_math_percentage: 2.73, 5.82[']'] = [lp_math_percentage: 2.73, 5.82]
['[']lp_math_percentage: 67, 13[']'] = [lp_math_percentage: 67, 13]

With precision:
['[']lp_math_percentage: 2, 5, 1[']'] = [lp_math_percentage: 2, 5, 1]
['[']lp_math_percentage: 2, 5.82, 2[']'] = [lp_math_percentage: 2, 5.82, 2]
['[']lp_math_percentage: 2.73, 5, 3[']'] = [lp_math_percentage: 2.73, 5, 3]
['[']lp_math_percentage: 2.73, 5.82, 4[']'] = [lp_math_percentage: 2.73, 5.82, 4]
['[']lp_math_percentage: 67, 13, 5[']'] = [lp_math_percentage: 67, 13, 5]

```

#### 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_percentage',
-description='Returns the percentage value given the part and the total.',
-priority='replace',
-required='part',
-required='total',
-optional='precision';

// did we get a precision?
if:!(local_defined:'precision');
// nope, set it to zero
local:'precision' = 0;
/if;

// return the percentage
return: (lp_decimal_precisionSet: (decimal: (decimal:#part) / (decimal:#total) * (decimal:100)), (integer:#precision));

/define_tag;

]
```

#### Related Tags 