Template:Interactive calculator/doc

This template offers a selection of different interactive calculators. These use JavaScript to provide live in-page calculations. A calculator's result is updated on pressing the 'Calculate' button, or when the user changes any of the input values.

This template uses JavaScript to provide live in-page calculations. The computed result is updated on pressing the 'Calculate' button, or when the user changes any of the input values.

Usage
Invoke with:

The type parameter is mandatory, and must be one of the enumerated values listed below in Supported calculators. Adding mode=test causes the calculator to run its unit tests and report the results. Parameters may also be supplied by position, in the order shown above.

The default input values to all the calculators are currently hardcoded. This template may be transcluded multiple times on a single page.

TWR
Invoke with:

Displays:

Calculates the "Tax Withholding Ratio" (TWR) for a nonresident alien, allowing comparison of US and non-US domiciled ETFs. The definition of TWR is:. For full details, see: Template:TWR.

Compound interest
Invoke with:

Displays:

The result is calculated by compounding an annual interest rate monthly over the given number of years.

Future value
Invoke with:

Displays:

The result is calculated to match the results of the Microsoft Excel and Google Sheets  function.

Present value
Invoke with:

Displays:

The result is calculated to match the results of the Microsoft Excel and Google Sheets  function.

US nonresident alien estate tax
Invoke with:

Displays:

The result is the US estate tax that would be due on this level of 'US situs' assets for a US nonresident alien without US estate tax treaty coverage.

Source code
For technical reasons, this template wraps its source code elements in Base64 encoding. This means that it is not directly visible in the wikitext editor. A listing of the decoded source code elements is shown below. For more on why this is necessary, and for general notes on how this template is designed and how to work with its JavaScript code, see Template Talk:Interactive calculator.