PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




Mathematical Functions


OverviewThis function group provides a basic set of functions for performing mathematical computations, as well as a set of named constants providing useful values. These functions are part of the standard function set built into PHP, and can only be disabled by either modifying the source code or by using the disable_functions directive in php.ini.

Named constantsPHP provides the following named constants. Not all constants are available in all versions of PHP, and only M_PI is available in any version of PHP 3.

Named constant Value Description Availability
M_1_PI 0.31830988618379067154 1 / pi PHP 4 RC 1+
M_2_PI 0.63661977236758134308 2 / pi PHP 4 RC 1+
M_2_SQRTPI 1.12837916709551257390 2 / sqrt(pi)() PHP 4 RC 1+
M_E 2.7182818284590452354 e; natural logarithm base PHP 4 RC 1+
M_EULER 0.57721566490153286061 Euler's constant PHP 4.0.2+
M_LN2 0.69314718055994530942 loge2 PHP 4 RC 1+
M_LN10 2.30258509299404568402 loge10 PHP 4 RC 1+
M_LNPI 1.14472988584940017414 logepi PHP 4.0.2+
M_LOG2E 1.4426950408889634074 log2e PHP 4 RC 1+
M_LOG10E 0.43429448190325182765 log10e PHP 4 RC 1+
M_PI 3.14159265358979323846 pi All versions
M_PI_2 1.57079632679489661923 pi / 2 PHP 4 RC 1+
M_PI_4 0.78539816339744830962 pi / 4 PHP 4 RC 1+
M_SQRT1_2 0.70710678118654752440 1 / sqrt(2)() PHP 4 RC 1+
M_SQRT2 1.41421356237309504880 sqrt(2)() PHP 4 RC 1+
M_SQRT3 1.73205080756887729352 sqrt(3)() PHP 4.0.2+
M_SQRTPI 1.77245385090551602729 sqrt(pi)() PHP 4.0.2+


NotesThese functions are dependent upon the underlying system limits when working with numbers. For instance, this means that if your system supports 32-bit integers, you will not be able to work with integers larger than 2147483647 or smaller than -2147483647 (PHP supports only signed integers). Similarly, floating-point precision will be limited to whatever the system supports. In most cases this is a 64-bit value.

If you require greater precision or larger/smaller numbers, please check out the Arbitrary Precision (BC) Mathematics functions.




PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.