<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [

<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../../doc/docbook/entities.xml">
%docentities;

]>
<!-- Module User's Guide -->

<chapter>

	<title>&adminguide;</title>

	<section>
	<title>Overview</title>
	<para>
		This module provides a collection of functions for math operations.
	</para>
	<para>
		Note that the result values are casted to intger (long value), being
		the type supported by the config variables.
	</para>
	</section>

	<section>
	<title>Dependencies</title>
	<section>
		<title>&kamailio; Modules</title>
		<para>
		The following modules must be loaded before this module:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>none</emphasis>
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	<section>
		<title>External Libraries or Applications</title>
		<para>
		The following libraries or applications must be installed before running
		&kamailio; with this module loaded:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>none</emphasis>
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	</section>

	<section>
	<title>Functions</title>
	<section id="math.f.pow">
		<title>
		<function moreinfo="none">pow(base, power, res)</function>
		</title>
		<para>
		The exponentiation function, computing the base raised to power, storing
		in res.
		</para>
		<para>
		This function can be used from ANY_ROUTE.
		</para>
		<example>
		<title><function>math_pow</function> usage</title>
		<programlisting format="linespecific">
...
    math_pow("2", "10", "$var(res)");
    $var(base) = 2;
    $var(power) = 10;
    math_pow("$var(base)", "$var(power)", "$var(res)");
...
</programlisting>
		</example>
	</section>
	<section id="math.f.logN">
		<title>
		<function moreinfo="none">math_logN(x, res)</function>
		</title>
		<para>
		The function computes the natural logarithm of x and stores the result
		in res.
		</para>
		<para>
		This function can be used from ANY_ROUTE.
		</para>
		<example>
		<title><function>math_logN</function> usage</title>
		<programlisting format="linespecific">
...
    math_logN("10", "$var(res)");
    $var(x) = 10;
    math_logN("$var(x)", "$var(res)");
...
</programlisting>
		</example>
	</section>
	<section id="math.f.log2">
		<title>
		<function moreinfo="none">math_log2(x, res)</function>
		</title>
		<para>
		The function computes the base-2 logarithm of x and stores the result
		in res.
		</para>
		<para>
		This function can be used from ANY_ROUTE.
		</para>
		<example>
		<title><function>math_log2</function> usage</title>
		<programlisting format="linespecific">
...
    math_log2("16", "$var(res)");
    $var(x) = 16;
    math_log2("$var(x)", "$var(res)");
...
</programlisting>
		</example>
	</section>
	<section id="math.f.log10">
		<title>
		<function moreinfo="none">math_log10(x, res)</function>
		</title>
		<para>
		The function computes the base-10 logarithm of x and stores the result
		in res.
		</para>
		<para>
		This function can be used from ANY_ROUTE.
		</para>
		<example>
		<title><function>math_log10</function> usage</title>
		<programlisting format="linespecific">
...
    math_log10("100", "$var(res)");
    $var(x) = 100;
    math_log10("$var(x)", "$var(res)");
...
</programlisting>
		</example>
	</section>
	<section id="math.f.sqrt">
		<title>
		<function moreinfo="none">math_sqrt(x, res)</function>
		</title>
		<para>
		The function computes the square root of x and stores the result
		in res.
		</para>
		<para>
		This function can be used from ANY_ROUTE.
		</para>
		<example>
		<title><function>math_sqrt</function> usage</title>
		<programlisting format="linespecific">
...
    math_sqrt("16", "$var(res)");
    $var(x) = 16;
    math_sqrt("$var(x)", "$var(res)");
...
</programlisting>
		</example>
	</section>
	</section>
</chapter>
