Template::Plugin::Math(3) User Contributed Perl Documentation Template::Plugin::Math(3)

# [NAME](#NAME)

Template::Plugin::Math - Plugin providing mathematical functions

# [SYNOPSIS](#SYNOPSIS)

```
    [% USE Math %]
    [% Math.sqrt(9) %]
```

# [DESCRIPTION](#DESCRIPTION)

The Math plugin provides numerous mathematical functions for use within templates.

# [METHODS](#METHODS)

"Template::Plugin::Math" makes available the following functions from the Perl core:

[abs](#abs)

[atan2](#atan2)

[cos](#cos)

[exp](#exp)

[hex](#hex)

[int](#int)

[log](#log)

[oct](#oct)

[rand](#rand)

[sin](#sin)

[sqrt](#sqrt)

[srand](#srand)

In addition, if the Math::Trig module can be loaded, the following functions are also available:

[pi](#pi)

[tan](#tan)

[csc](#csc)

[cosec](#cosec)

[sec](#sec)

[cot](#cot)

[cotan](#cotan)

[asin](#asin)

[acos](#acos)

[atan](#atan)

[acsc](#acsc)

[acosec](#acosec)

[asec](#asec)

[acot](#acot)

[acotan](#acotan)

[sinh](#sinh)

[cosh](#cosh)

[tanh](#tanh)

[csch](#csch)

[cosech](#cosech)

[sech](#sech)

[coth](#coth)

[cotanh](#cotanh)

[asinh](#asinh)

[acosh](#acosh)

[atanh](#atanh)

[acsch](#acsch)

[acosech](#acosech)

[asech](#asech)

[acoth](#acoth)

[acotanh](#acotanh)

[rad2deg](#rad2deg)

[rad2grad](#rad2grad)

[deg2rad](#deg2rad)

[deg2grad](#deg2grad)

[grad2rad](#grad2rad)

[grad2deg](#grad2deg)

If the Math::TrulyRandom module is available, and you've got the time to wait, the "truly\_random\_number" method is available:

```
    [% Math.truly_random_number %]
```

# [AUTHOR](#AUTHOR)

Andy Wardley &lt;abw@wardley.org&gt; &lt;http://wardley.org/&gt;

# [COPYRIGHT](#COPYRIGHT)

Copyright (C) 1996-2022 Andy Wardley. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

# [SEE ALSO](#SEE_ALSO)

Template::Plugin

2026-08-30 perl v5.44.0

---

Document: Template::Plugin::Math(3pm) from perl-template-toolkit 3.106-r2 (Chainguard OS)
Source: https://github.com/abw/Template2.git
