<HTML ><HEAD ><TITLE >Mathematical Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="mailparse_uudecode_all" HREF="function.mailparse-uudecode-all.html"><LINK REL="NEXT" TITLE="abs" HREF="function.abs.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.mailparse-uudecode-all.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.abs.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.math" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >LI. Mathematical Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN44212" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="math.intro" ></A >Introduction</H1 ><P > These math functions will only handle values within the range of the <A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A > and <A HREF="language.types.float.html" ><B CLASS="type" >float</B ></A > types on your computer (this corresponds currently to the C types long resp. double). If you need to handle bigger numbers, take a look at the <A HREF="ref.bc.html" >arbitrary precision math functions</A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="math.requirements" ></A >Requirements</H1 ><P >No external libraries are needed to build this extension.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="math.installation" ></A >Installation</H1 ><P >There is no installation needed to use these functions; they are part of the PHP core.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="math.configuration" ></A >Runtime Configuration</H1 ><P >This extension has no configuration directives defined in <TT CLASS="filename" >php.ini</TT >.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="math.resources" ></A >Resource Types</H1 ><P >This extension has no resource types defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="math.constants" ></A >Predefined Constants</H1 ><P > The constants below are always available as part of the PHP core. </P ><P > <DIV CLASS="table" ><A NAME="AEN44236" ></A ><P ><B >Table 1. Math constants</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Constant</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Value</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_PI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >3.14159265358979323846</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Pi</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_E</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >2.7182818284590452354</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >e</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_LOG2E</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.4426950408889634074</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >log_2 e</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_LOG10E</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.43429448190325182765</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >log_10 e</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_LN2</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.69314718055994530942</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >log_e 2</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_LN10</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >2.30258509299404568402</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >log_e 10</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_PI_2</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.57079632679489661923</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >pi/2</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_PI_4</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.78539816339744830962</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >pi/4</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_1_PI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.31830988618379067154</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1/pi</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_2_PI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.63661977236758134308</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >2/pi</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_SQRTPI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.77245385090551602729</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >sqrt(pi) [4.0.2]</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_2_SQRTPI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.12837916709551257390</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >2/sqrt(pi)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_SQRT2</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.41421356237309504880</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >sqrt(2)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_SQRT3</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.73205080756887729352</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >sqrt(3) [4.0.2]</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_SQRT1_2</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.70710678118654752440</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1/sqrt(2)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_LNPI</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1.14472988584940017414</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >log_e(pi) [4.0.2]</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >M_EULER</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >0.57721566490153286061</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Euler constant [4.0.2]</TD ></TR ></TBODY ></TABLE ></DIV > Only M_PI is available in PHP versions up to and including PHP 4.0.0. All other constants are available starting with PHP 4.0.0. Constants labeled [4.0.2] were added in PHP 4.0.2. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.abs.html" >abs</A > -- Absolute value</DT ><DT ><A HREF="function.acos.html" >acos</A > -- Arc cosine</DT ><DT ><A HREF="function.acosh.html" >acosh</A > -- Inverse hyperbolic cosine</DT ><DT ><A HREF="function.asin.html" >asin</A > -- Arc sine</DT ><DT ><A HREF="function.asinh.html" >asinh</A > -- Inverse hyperbolic sine</DT ><DT ><A HREF="function.atan2.html" >atan2</A > -- arc tangent of two variables</DT ><DT ><A HREF="function.atan.html" >atan</A > -- Arc tangent</DT ><DT ><A HREF="function.atanh.html" >atanh</A > -- Inverse hyperbolic tangent</DT ><DT ><A HREF="function.base-convert.html" >base_convert</A > -- Convert a number between arbitrary bases</DT ><DT ><A HREF="function.bindec.html" >bindec</A > -- Binary to decimal</DT ><DT ><A HREF="function.ceil.html" >ceil</A > -- Round fractions up</DT ><DT ><A HREF="function.cos.html" >cos</A > -- Cosine</DT ><DT ><A HREF="function.cosh.html" >cosh</A > -- Hyperbolic cosine</DT ><DT ><A HREF="function.decbin.html" >decbin</A > -- Decimal to binary</DT ><DT ><A HREF="function.dechex.html" >dechex</A > -- Decimal to hexadecimal</DT ><DT ><A HREF="function.decoct.html" >decoct</A > -- Decimal to octal</DT ><DT ><A HREF="function.deg2rad.html" >deg2rad</A > -- Converts the number in degrees to the radian equivalent </DT ><DT ><A HREF="function.exp.html" >exp</A > -- Calculates the exponent of <TT CLASS="constant" ><B >e</B ></TT > (the Neperian or Natural logarithm base)</DT ><DT ><A HREF="function.expm1.html" >expm1</A > -- Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero </DT ><DT ><A HREF="function.floor.html" >floor</A > -- Round fractions down</DT ><DT ><A HREF="function.fmod.html" >fmod</A > -- Returns the floating point remainder (modulo) of the division of the arguments</DT ><DT ><A HREF="function.getrandmax.html" >getrandmax</A > -- Show largest possible random value</DT ><DT ><A HREF="function.hexdec.html" >hexdec</A > -- Hexadecimal to decimal</DT ><DT ><A HREF="function.hypot.html" >hypot</A > -- Returns sqrt( num1*num1 + num2*num2) </DT ><DT ><A HREF="function.is-finite.html" >is_finite</A > -- </DT ><DT ><A HREF="function.is-infinite.html" >is_infinite</A > -- </DT ><DT ><A HREF="function.is-nan.html" >is_nan</A > -- </DT ><DT ><A HREF="function.lcg-value.html" >lcg_value</A > -- Combined linear congruential generator</DT ><DT ><A HREF="function.log10.html" >log10</A > -- Base-10 logarithm</DT ><DT ><A HREF="function.log1p.html" >log1p</A > -- Returns log(1 + number), computed in a way that accurate even when the val ue of number is close to zero </DT ><DT ><A HREF="function.log.html" >log</A > -- Natural logarithm</DT ><DT ><A HREF="function.max.html" >max</A > -- Find highest value</DT ><DT ><A HREF="function.min.html" >min</A > -- Find lowest value</DT ><DT ><A HREF="function.mt-getrandmax.html" >mt_getrandmax</A > -- Show largest possible random value</DT ><DT ><A HREF="function.mt-rand.html" >mt_rand</A > -- Generate a better random value</DT ><DT ><A HREF="function.mt-srand.html" >mt_srand</A > -- Seed the better random number generator</DT ><DT ><A HREF="function.octdec.html" >octdec</A > -- Octal to decimal</DT ><DT ><A HREF="function.pi.html" >pi</A > -- Get value of pi</DT ><DT ><A HREF="function.pow.html" >pow</A > -- Exponential expression</DT ><DT ><A HREF="function.rad2deg.html" >rad2deg</A > -- Converts the radian number to the equivalent number in degrees </DT ><DT ><A HREF="function.rand.html" >rand</A > -- Generate a random value</DT ><DT ><A HREF="function.round.html" >round</A > -- Rounds a float</DT ><DT ><A HREF="function.sin.html" >sin</A > -- Sine</DT ><DT ><A HREF="function.sinh.html" >sinh</A > -- Hyperbolic sine</DT ><DT ><A HREF="function.sqrt.html" >sqrt</A > -- Square root</DT ><DT ><A HREF="function.srand.html" >srand</A > -- Seed the random number generator</DT ><DT ><A HREF="function.tan.html" >tan</A > -- Tangent</DT ><DT ><A HREF="function.tanh.html" >tanh</A > -- Hyperbolic tangent</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.mailparse-uudecode-all.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.abs.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >mailparse_uudecode_all</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >abs</TD ></TR ></TABLE ></DIV ></BODY ></HTML >