Title:PHP Arbitrary precision math functions (BCMATH)Contributor: Randall Goguen (aka Ranman)
Last Update: Wednesday January 17 17:59 EDT 2001
PHP uses 32-bit signed longs for all integer math.
The signed range is from -2,147,483,648 to
2,147,483,647. The unsigned range is 0 to 4,294,967,295.
bcmath functions allow you to perform math
operations on numbers of any size.
These functions are only available if PHP was configured with:
--enable-bcmath# Arbitrary precision mathematics functions.
string bcadd(string left_operand, string right_operand [, int scale])
Returns the sum of two arbitrary precision numbers
string bccomp(string left_operand, string right_operand [, int scale])
Compares two arbitrary precision numbers
string bcdiv(string left_operand, string right_operand [, int scale])
Returns the quotient of two arbitrary precision numbers (division)
string bcmod(string left_operand, string right_operand)
Returns the modulus of the two arbitrary precision operands
string bcmul(string left_operand, string right_operand [, int scale])
Returns the multiplication of two arbitrary precision numbers
string bcpow(string x, string y [, int scale])
Returns the value of an arbitrary precision number raised to the power of
another
string bcscale(int scale)
Sets default scale parameter for all bc math functions
string bcsqrt(string operand [, int scale])
Returns the square root of an arbitray precision number
string bcsub(string left_operand, string right_operand [, int scale])
Returns the difference between two arbitrary precision numbers
Anyone who wishes to make additions or changes to this
PHP Tip email them to webmaster@linuxguruz.org
This document is Copyright (c) 1999, 2000 by LinuxGuruz